This is a migrated thread and some comments may be shown as answers.

Layout Customization to Ignore Certain Node Types

1 Answer 46 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 15 Jul 2015, 12:30 PM

Hello,

I am trying to create "anchored flag" labels for nodes (see image) where the labels are essentially a different type of node with a single link to the primary node type.  The label nodes allow for text editing, changing fonts, colors, etc and when a user moves a primary node the corresponding label follows.  But the user can move the label independently of the node but the label will always have a link to the node.  I basically have this behavior implemented, but the issue I have involves layouts.

When a layout is run, all nodes are considered equal and the label nodes are arranged as one would expect nodes to be arranged in the layout (using tree layouts).  But this breaks the behavior of the anchored flag label I am trying to achieve.  What I would like to do is have the layout ignore the label nodes and just affect the primary nodes.  When the primary node locations are finalized, the label nodes will follow.  The only way I can do this is to set the TreeLayoutSettings IgnoreInvisible flag to true, and when a layout is run, set all label nodes to Visibility = Collapsed, run the layout, then for all label nodes set Visibility = Visible.

Is there a way to customize the layout so that it can ignore nodes of a certain type, (or if they have a certain property, interface, etc)?  And if that is not possible, is there a better way to handle the layout issue described above?

Thanks!

Mike

 

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 17 Jul 2015, 08:47 AM
Hello MIchael,

This is the best well-known solution for excluding shapes from the layout - to make it invisible and after layout to make it visible again.

Other solution which can be considered in some scenarios is to add some shapes in parent ContainerShape and use the IgrnoreContainers property set to true. This is helpful if you need to preserve some group of shapes and their relative positions when you perform global Layout.

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Diagram
Asked by
Michael
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or