We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

essential diagram (snap and glue)

Do you have a snap and glue facility like provided in visio?
How would I achieve the same functionality with your product e.g. I would like to drag a shape from a pallet onto another shape on the design form and have it snap on to a particular edge of that shape and stay there within boundaries. And to be able to add more shapes of the same type to to this shape on the form in the same way.




6 Replies

AD Administrator Syncfusion Team January 3, 2008 11:40 AM UTC

Hi Rhawk,

Sorry for the delay in responding you.

Snap and Glue

Yes, the diagram entities (shapes, text nodes etc.,) can be grouped (or glued) together to act as a composite whole.

The nodes in the Essential diagram can be grouped and ungrouped by using the Group( ) and UnGroup( ) methods as shown in the code snippet below,

[C#]

// Group nodes
this.diagram1.Controller.Group();

// Ungroup nodes
this.diagram1.Controller.UnGroup();

Sample reference

Please refer the sample that shipped with Essential studio in the below location. This sample demonstrates how nodes in the Diagram Model can grouped together or ungrouped. You can also add more shapes of the same type.

[Install drive]:\Documents and Settings\UserName\My Documents\Syncfusion\EssentialStudio\version\Windows\Diagram.Windows\Samples\2.0\Quick Start\Serialization

Thank you for your interest in Syncfusion products.

Please let me know if you have any further questions.

Regards,
Jaya




RH Roger Hawkins January 6, 2008 12:58 AM UTC

hi I'm not sure I understand how this enables snap and glue.

The scenario is there is an object on the drawing area and I drag a different object from the pallet on to it. The new one snaps and glues to the bottom (for example) of the existing one and stays there if the object is moved around - this can be repeated and the new objects get attached (glued) next to the other ones on the bottom of the existing object. I can detatch by simply selecting one of the dragged objects and deleting it or cutting and pasting elsewhere.
does this make sense?
thx



AD Administrator Syncfusion Team January 7, 2008 05:09 AM UTC

Hi Rhawk,

Thanks for the update.

It is possible with Essential diagram to group the new diagram object to the bottom of existing diagram object. You can also detach them by ungrouping it.

Please refer the video file that demonstrates on grouping the new diagram object to the bottom of an existing diagram object.

http://websamples.syncfusion.com/samples/Diagram.Windows/F70766/Video/main.htm

You can also use SendToBack() method of the diagram model to send a node back to another. Below is the code snippet.

[C#]

this.diagram1.Model.SendToBack(dgmobject);

Please refer previous post for grouping and ungrouping the diagram entities programmatically.

Sample reference

Please refer the DiagramBuilder sample that shipped with Essential diagram in the below location that accomplishes the above said feature.

[Install drive]:\Documents and Settings\UserName\My Documents\Syncfusion\ EssentialStudio\x.x.x.xx\Windows\Diagram.Windows\Samples\2.0\In Depth\DiagramBuilder

Please let me know if this meets your requirement.

Regards,
Jaya



RH Roger Hawkins January 8, 2008 05:44 AM UTC

thanks for this,

the video doesnt show an object connecting to the bottom of another just grouped.

I understand that your API allows grouping of objects (thanks for the info) but this is different to snapping and gluing - e.g. the level of control available.

What I wanted to know was can I drag one object on to another and have it 'snap' to the bottom (or wherever I tell it) of this object. .e.g. like to visio snap and glue (as mentioned).

thx



AD Administrator Syncfusion Team January 9, 2008 06:18 PM UTC

Hi Rhawk,

Thanks for the update.

Visio like Snap and Glue

I regret to let you know currently we don't have support for snap one diagram object to another diagram object like in Visio. We have forwaded this to development team and will let you know once this feature is implemented.

Please let me know if you have any further questions.

Regards,
Jaya



TH Tony Hansen April 19, 2010 11:57 PM UTC

Has there been any progress with this?

I've been toying with the Diagram component, and for this component to be usable for us, we really need some "snapping" functionality.

Our use case: we currently load a scanned image of a shopping center site plan into the Diagram component as a background image. We then use the "polygon" tool to trace the shape of each individual store on the plan, thus producing a diagram of the entire floorplan in which each store can be selected as a node.

The issue is that drawing the lines for each store is very difficult because the polygon tool allows a little TOO much flexibility in how lines are drawn.

Here's what we need to get this to work:

1. The ability to hold down either the Shift, Ctrl or Alt keys, in order to ensure our line draws at either 0,45,90,135,180,225,270,315 or 360 degrees. That way we can get absolutely horizontal, vertical or 45 degree lines; and
2. "Vertex snapping" ... as we draw each side of the polygon and click the mouse button to set a vertex (corner) point, the control should detect whether or not we're clicking close to the vertex of another control, and if so, "snap" the click to that point. That way we can ensure that all of our vertexs overlap precisely.

What do you think? Is it possible to implement those functions? If so, what kind of timeframe would we be looking at? We have a fairly urgent requirement for a diagram component, and I'd really like to use the Syncfusion component, if those 2 requirements can be addressed...

Thanks!

Tony

Loader.
Live Chat Icon For mobile
Up arrow icon