Comments (6)
I'm sorry, what exactly are we supposed to be looking at?
What is the problem? The paper does not have to originate at 0x0
for multiple reasons.
What would be the expected result?
How to reproduce it? Providing a code to see the issue always helps.
from joint.
Sorry for the ambiguity.
SVG tag is positioned from (0,0) in viewport but g tag is positioned way too right. I am not able to figure out what is the root cause of being g tag with classname = "joint-layers" positioned this way instead of (0,0).
Can we force manipulate the position of g tag??
You talked about multiple reason for this. Can you highlight some of them?
It would have been better with a small code demo but I cant share code as it is confidential one.
from joint.
What is graph.getBBox()
? The top left corner of the bounding box is most likely in negative coordinates. So for the paper to display the entire graph, it must change its origin to negative coordinates as well.
But I think you don't like the space around the paper. Not the transformation of the paper (the transformation
attribute does not change the position of the <g>
tag within the paper scroller). The space around the paper within the paper scroller is controlled by the padding
and borderless
options. I suggest reading the PaperScroller
documentation first.
from joint.
In this case the graph.getBBox is -> Rect {x: 55, y: 140, width: 4840, height: 2440}.
Yeah! Space around the paper is not needed.
Let me re-phrase my desired outcome.
Steps:
step1:
Created Paper
const graph = new dia.Graph({}, { cellNamespace });
const paper = new dia.Paper({
model: graph,
async: true,
preventContextMenu: true,
sorting: dia.Paper.sorting.APPROX,
//interactive: true,
snapLabels: true,
interactive: {
labelMove: true,
},
cellViewNamespace: cellNamespace,
background: { color: "transparent" },
defaultConnectionPoint: { name: "boundary", args: { offset: 3 } },
defaultConnector: {
name: "jumpover",
args: { jump: "arc" }, //other values arc / cubic
},
defaultRouter: function (_vertices, _opt, linkView: any) {
const link = linkView.model;
const source = link.getSourceCell();
const target = link.getTargetCell();
if (
(source && isCellHidden(source)) ||
(target && isCellHidden(target))
) {
//use straight line if either source or target is hidden
return [];
}
return routers.normal([], { margin: 100 }, linkView);
},
defaultAnchor: multiLinkAnchor,
viewport: function (view: any) {
return !isCellHidden(view.model);
},
// viewport: (view: dia.CellView) => !isCellHidden(view.model),
});
Step2:
I created paperscroller the way it is mentioned in doc.
const paperScroller = new ui.PaperScroller({
paper,
// padding: { top: 0, left: 0 },
autoResizePaper: true,
// contentOptions: function (paperScroller) {
// var visibleArea = paperScroller.getVisibleArea();
// return {
// padding: {
// bottom: visibleArea.height / 2,
// top: visibleArea.height / 2,
// left: visibleArea.width / 2,
// right: visibleArea.width / 2,
// },
// allowNewOrigin: "any",
// };
// },
});
The outcome in browser is:
Screenshot1:
Paperscroller position:
Paperscroller position is perfect as per division of layout.
but,
Screenshot2:
The div.jointpaper is positioned somewhere in middle with some calculated left and top.How are these positioned calculated???? I want this div.jointpaper to be positioned at top:0,left:0 so that it is aligned with paperscroller.
Desired output:
from joint.
Perhaps calling paperScroller.positionContent('top-left', { padding: 50, useModelGeometry: true })
will do the job?
There are many methods to modify the position of the paper inside the paper scroller (e.g. scroll()
, center()
).
from joint.
This issue is stale because it has been open 60 days with no activity. Please remove stale label or comment or this will be closed in 14 days.
from joint.
Related Issues (20)
- [Performance]: Backbone's set is checking too many attributes HOT 2
- [Bug]: Cache misses because of wrong assumptions in the ordering of hashmap keys HOT 4
- [Bug]: Segments tool is broken with manhattan router HOT 2
- [Bug]: Multiple inheritance with custom shapes not working (as expected?) HOT 7
- [Bug]: The padding of PaperScroller's "scrollWhileDragging" is measuring incorrectly the position of the cursor (part 2) HOT 2
- [Docs]: Stencil height inconsistency HOT 4
- [Bug]: Grid layout dx / dy incorrect default values HOT 2
- [Bug]: Safari doesn't render link arrow markers after loading data HOT 10
- [Bug]: Can't prevent default on "blank:contextmenu" event HOT 2
- [Bug]: The direction of the source and target points cannot always run along the center, but will run to the edge HOT 5
- [Bug]: RegEx for breakText and textWrap opt.hyphen does not include international characters HOT 1
- [Bug]: Custom events do not trigger HOT 2
- [Bug]: Using graph.findModelsUnderElement(cell) with lables positioned outside the rectangle cell
- [Bug]:Jointjs+ Navigator
- Issue with JointJS in Typescript when integrated in own project
- [Bug]: Ports positioning in jointJS with angular HOT 1
- Vectorizer: can not convert zero-length arc to curve HOT 1
- [Bug]: Angular 17, Builder Application or Esbuild, does not provide an export named "dia" HOT 2
- SVG's height is overlapped by uikit.js HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joint.