OrgChart sample, modifying TreeLayoutView to use TreeLayout direction of BR #2854
-
IntroductionI was modifying the OrgChart sample code, and one of the things I wanted to see was if I could draw the tree aligned to the top/bottom as well as the right - so a user could see the parent node without scrolling down a potentially long list of child nodes... So I made the following change:
According to the API help, this is a legitimate value for defining a TreeLayout. However all of the 2 character options allowed will cause the TreeLayoutView to break with the following error:
There are several other demos which feature tree layouts that I can play with, but I thought this should be mentioned. Steps to reproduceNo response Restrictions & ConstraintsNo response Does your question relate to JointJS or JointJS+. Select both if applicable.JointJS+ |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
If I change the direction to |
Beta Was this translation helpful? Give feedback.
-
Attached is a complete Angular project that demonstrates the problem. The code provided works (the default Note: this is an Angular 8 project, so it will only run with NodeJS 10.9. You will probably need a virtual machine to run it to reproduce the problem as I see it on my system. This also demonstrates the compile/deploy problems as started in another post (it still fails to --prod compile unless I turn minimise off). The node_modules folder is pre-populated with the edited copy of |
Beta Was this translation helpful? Give feedback.
-
The problem is with The If you wanted to use this.paper.transformToFitContent({
padding: {
top: 16,
bottom: 16,
left: 16,
right: 16
},
useModelGeometry: true,
verticalAlign: 'top',
horizontalAlign: 'left',
// scaleGrid: 1
maxScale: 1,
minScale: 1
}); |
Beta Was this translation helpful? Give feedback.
The problem is with
paper.transformToFitContent()
method rather than layoutdirection
.The
scaleGrid
option snap the resulting zoom level to the closest grid. In your case, the scale was between 0 and 1 so it round down the scale to 0.That made every element effectively invisible, impossible to get their correct SVG screen matrix. Hence the error.
If you wanted to use
transformToFitContent()
because of the alignment and padding without the zooming of the paper, you can usemaxScale
andminScale
instead.