Morning all!
Imagine this....
I have one Node on the screen, holding a shape which has two ports at the bottom on either side.
I "intend" to draw a simple "L" shape bend, traveling from left to right, then up to the port on a Node where it connects.
Initially, the line changes shape upon connection, so now I have a total of 3 segments, not the two I intended. I correct the line, so now its 2 segments ( L shape ) but upon moving the node, or altering the line, it becomes 3 segments again (seen in the image bellow).
How do I prevent the line from adding additional segments to a Ortho type line, when I do not want them?
Is there an option somewhere I don't know about, which enforces the quantity of segments?
The first image here is how it looks after the line has "adjusted" itself. The second image is how I "want" it to look (which is possible, but difficult as a user to draw).
Hi Robert,
We are validating your requirement and will update you the details on September 12, 2022. We appreciate your patience until then.
Regards,
Suganthi K.
Hi Robert,
By default, the segments are added or removed automatically, when dragging the node.
We have achieved your requirement at the sample level using the "PositionChanged" event to prevent an extra connector segment from being added when dragging the node. But we have an issue for updating the values in “PositionChanged”, we resolved the issue and the fix will included in our upcoming NuGet release which is expected to be rolled out on September 13, 2022.
We have prepared a video to demonstrate your requirement. If the provided video is not your exact requirement. Kindly share the sample or video for as per your requirement. This would be helpful for us to provide a quick solution.
Regards,
Suganthi K.
Hi Robert,
We have shared the sample for your requirement to prevent an extra connector segment from being added when dragging the node. Also we have fixed the issue for updating the values in “PositionChanged” event and included the fix in weekly NuGet version 20.2.0.49 which is available for download (https://www.nuget.org/ ). We thank you for your support and appreciate your patience in waiting for this update. Please contact us if you would require any further assistance.
Regards,
Suganthi K.
Note: If this post is
helpful, please consider Accepting it as the solution so that other members can
locate it more quickly.
This addresses the lines changing when the object is moved. However, the initial line is still adding segments when the line is connected to the object.
I tried correcting the line using the event "ConnectionChanged", but this still shows the line as two segments, and it seems that the additional segment is added "after" this event is called, so I am unable to correct it via code.
Video of the issue, attached....
Hi Robert,
We have achieved your requirement at the sample level by using the "TargetPointChanged" event to prevent an extra connector segment from being added when connected to the node. This event will be triggered while the target point has been changed. Using the event, we check if the connector is connected to the port, then we calculate the difference between the source and target point of the x point. This value will be updated in the first segment length. Now the output of the connector looks like an "L" shape.
Regards,
Suganthi K.
Note: If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.
This resolves the issue for the line on the left.
Your video shows line on the right, ending on the node (traveling from left to right then up).
For me, the line on the right starts at the node, and travels down, then right, but the code provided changes the line from traveling down, to traveling right instead (basicly change the direction of the line and see how it alters the line after the object is moved)
Ultimately, if there was a way to see the connector before and after, then we can correct the line to match the "direction" of each segment of the original line. At the moment, we can only see the "result" of the line changes. Then all I have to do is to change the "length" of each segment, and not the direction.
Our desire is to see the connector before and after of a given event that fires when we "connect" the start or end of the line to something, or, we reposition the start or end of the line (without connection), or we move the object attached to the line.
With this, we can correct the line based on its shape and segment direction, before the firing of the event.
Is this a possible feature that could be added? With this in place, I can correct the line after the events are fired.
Hi Robert,
We have achieved the “L” shape connector from the right of source node to target node at sample level while moving the node.
Query: move the object attached to the line
The "PositionChanging" event has been triggered while "dragging" the node or connection from one location to another. "PositionChanged" event has been fired once the dragging has been finished. Using the event’s argument, You can get the connector's “ID” from the InEdges/OutEdges property in the selected node. You can use the “ID” to get the connector from the “GetObject” method in the diagram.
Documentation link: https://blazor.syncfusion.com/documentation/diagram/nodes/events#position-change-event
Query: we reposition the start or end of the line (without connection)
The "SourcePointChanging" event was triggered when the connector's source point was being moved. The "SourcePointChanged" event will be fired after the dragging is finished. The "TargetPointChanging" event was triggered when the connector's target point was being moved. The "TargetPointChanged" event will be triggered after the target point has been changed. You can get the connector information from the “SelectionSettings” property in the diagram.
Query: "connect" the start or end of the line to something
The “ConnectionChanging” event has been trigger before the connector’s source or target point is connected or disconnected from the source or target. After connect/disconnect the connector from source or target, “ConnectionChanged” event will be triggered. You can get the connector information from the “SelectionSettings” property in the diagram.
Documentation link: https://blazor.syncfusion.com/documentation/diagram/connectors/events#connection-change
The same scenario you will achieve the “L” shape for right and top direction of the connector segment.
If we misunderstood your requirement, could you please share the sample or video for your requirement, it will useful to provide a solution.
Regards,
Suganthi K.