This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I have a few questions regarding the feature of snapping: 1. I have implemented my own way of snapping my nodes to the diagram, instead of using the snapping settings in the diagram. The reason is we want to enable the "smoothness" of dragging nodes around, and at the same time, performing snapping according to the drag and drop event. Ok, everything works well for the snapping, except that the connections are going haywired after the snapping. To further illustrate the behaviour, i've created the sample project for your reference, you can try to move the nodes around and see it being snapped to a certain distance / bounds. Try create a connection between them, and then start moving around, then you'll see the connections are kind of disconnected and not sticked with the connection point. 2. Is there anyway to specify the background snap line drawings like in the attachment? We want to kind of implement that as our diagram background for snapping. Sorry, image kind of dark, but it's a parrallel line that separates each rectangle snapping point. |
|
|
Hello Your first issue can be solved by calling DiagramSurface.FormatAllConnectionElements after you have performed your custom snapping. A good place to do this would be after the it-else statement that ends on line 63 of MainWindow.xaml.cs in the sample you provided. For the custom grid lines, yes this should be possible by creating your own ISnapLineDrawing. When overriding the Draw method, ignore the first 2 parameters as these will not be correct when using your own snapping logic. Instead, you can use your own horizontal and vertical snapping values. Let me know if you need help implementing this. - Jason |
|
|
Hi, it would be best if you could provide a sample code on how the diagram actually use the drawings to render the view. Thanks. ;) |
|
|
Hello I have attached a simple implementation of an ISnapLineDrawing. You will notice the first 2 parameters of the Draw method have not been used like I mentioned. Lines 31 and 37 include values that determine the horizontal and vertical spacing. Here I have used the values used in your custom snapping logic. From this code you should be able to modify it to get the effect shown in your image. You can create an instance of this class in xaml and use it to set the DiagramSurface.SnapLineDrawing property. Let me know how it goes. Regards |
|
|
ooops, file not found? or the server is down? |
|
|
Sorry about that. Try now. |
|