The MindFusion Forums | |
Flow Diagramming Components >> Html Canvas & JavaScript >> Custom Conatiner Node
https://mindfusion.eu/Forum/YaBB.pl?num=1492524225 Message started by Ankur shah on Apr 18th, 2017 at 2:03pm |
Title: Custom Conatiner Node Post by Ankur shah on Apr 18th, 2017 at 2:03pm
Please download video from given URL. In this video when ever i collapse the container node heading text for every node i.e. text in caption goes out of the box as you can see in video. And also when i expand it again you can see the diagram please let me know how can i solve these issues.
https://goo.gl/A0saNX |
Title: Re: Custom Conatiner Node Post by Slavcho on Apr 19th, 2017 at 7:45am
If you are custom-drawing that text using MindFusion.Drawing.Text in onUpdateVisuals, I guess you aren't updating its bounds on subsequent onUpdateVisuals calls after creating it the first time.
If second issue you mention is that child tree nodes do not offset when container gets folded, you will need to handle the containerUnfolded event too and move child nodes with offset in the other direction this time (http://mindfusion.eu/Forum/YaBB.pl?num=1491205900/5#5) |
Title: Re: Custom Conatiner Node Post by Ankur shah on Apr 19th, 2017 at 1:22pm
I tried to use MindFusion.Drawing.Text in onUpdateVisuals. but facing the problem that text in every container node i.e. heading text is same for all container node present in that diagram. As per my requirement Heading text will be changed accordingly for every custom container. To avoid this problem I have created a separate shape Node and assign text to that then adding it to container node using attachNode api.
the below code is for Container node UpdateVisuals. Code (javascript):
Code for adding heading text Code (javascript):
Code For adding Nodes child nodes in container node Code (javascript):
For your Ref. i am adding custom-conatiner.component.ts file ![]() |
Title: Re: Custom Conatiner Node Post by Slavcho on Apr 20th, 2017 at 8:40am
The way you set ContainerNode.prototype.onUpdateVisuals to e nested function -
Code (] private createCustomTableTableNode() { MindFusion.Diagramming.ContainerNode.prototype.onUpdateVisuals = (item: MindFusion.Diagramming.DiagramItem) => { ... };}[/code):
|
Title: Re: Custom Conatiner Node Post by Ankur shah on Apr 21st, 2017 at 10:36am
Thanks this resolved the issue.
|
Title: Re: Custom Conatiner Node Post by Ankur shah on Apr 21st, 2017 at 10:54am
Now I am facing problem wierd problem Please have a look at the Pic 1 which in expanded state. If collapsed the root node tree appears like this in pic 2.Please let me know where i am going wrong.
|
Title: Re: Custom Conatiner Node Post by Slavcho on Apr 21st, 2017 at 11:39am
Child table nodes in whole tree disappear when you fold the root container? You were handling containerFolded event to offset descendant containers in the tree, are you doing anything else from the event handler?
|
Title: Re: Custom Conatiner Node Post by Ankur shah on Apr 21st, 2017 at 11:58am
yes Child nodes in tree disappears.
Code for Folded Event Code (javascript):
Code For Unfolded Event Code (javascript):
|
Title: Re: Custom Conatiner Node Post by Slavcho on Apr 21st, 2017 at 12:30pm
Right, node.setBounds(r) only moves specified node and not child nodes and connected links. So in version 2.8 there are optional parameters like setBounds: function(rect, updateLinks, updateChildren) and you'd need to call it with true for updateChildren to automatically offset the table too. In version 3 it's a single bool parameter - setBounds: function(rect, updateDependencies). We haven't added these to Typescript definitions, you can either add them to d.ts file depending on what version you are using, or call setBounds(rect) for the child table too when offsetting its container. We'll add the updateDependencies argument for v3 Typescript definitions next week.
|
Title: Re: Custom Conatiner Node Post by Ankur shah on Apr 23rd, 2017 at 11:46am
This resolved my issue. Please let me know when are you going to release the typescript definitions files
One more problem i am facing now please have look at the pics. Please let me know how can i solve this issue. |
Title: Re: Custom Conatiner Node Post by Slavcho on Apr 24th, 2017 at 6:58am
As we discussed before node.setBounds only offsets end points of connected links, and if your links consist of more than one segments you'll need to apply same offset to their points too. E.g. add this to offsetChildNodesFolded after the child.setBounds call -
Code (] for (var c = 1; c < link.getControlPoints().length - 1; c++) link.getControlPoints()[c):
and same in Unfolded variant but adding the offset to y instead. |
Title: Re: Custom Conatiner Node Post by Ankur shah on May 29th, 2017 at 10:07am
In below diagram i need to drag the node highlighted in red and drop in to parent node and It should get appended to parent node in blue section. Here comes my problem
1. When ever we dragging node i need to show ghost image of the node which we are dragging in tooltip which is not happening right now please have a look at the code. We are using Angular 2 and not able to find out the definitions of get_element and Dispose Code (javascript):
Can you please let me know what is going wrong over here? |
Title: Re: Custom Conatiner Node Post by Slavcho on May 29th, 2017 at 11:27am
Comparing with our code above, you have changed MindFusion.Drawing.Canvas to MindFusion.Diagramming.Diagram and have removed the lines that call repaint and set canvas.scale. Return these back and it will work.
[code] var canvas = MindFusion.AbstractionLayer.createControl(MindFusion.Drawing.Canvas, null, null, null, canvasElement); canvas.scale = 1; canvas.setBounds(bounds); var cnode = node.clone(); cnode.shadowColor = 'transparent'; cnode.parent = canvas; cnode.setBounds(bounds); cnode.addCanvasElements(); canvas.repaint();[/code] |
The MindFusion Forums » Powered by YaBB 2.6.11! YaBB Forum Software © 2000-2025. All Rights Reserved. |