Get the offset of click on selection of connector

Dear Syncfusion Team,


when selecting a connector, is it possible to receive the "offset" of my selections click based on the mouse position on the connector relative to the length of the whole connectors path?


I need this because we place ports on connectors (ConnectorPorts) also by offset and I need to determine if the selection happened "before or after" certain ports.

Image_4242_1722418928837


Best regards

Mario


3 Replies

AK Arun Kumar Sivakumar Syncfusion Team August 1, 2024 07:41 AM UTC

Hi Mario,


Requirement: How to get the offset when selecting a connector using a mouse click for port creation.


We have analyzed your request to get the offset value for creating ports. We want to inform you that our SfDiagram control offers an option to dynamically create a port by clicking and dragging the mouse over any node or connector. This feature is disabled by default, but it can be enabled by setting the GraphConstraints.AutomaticPortCreation property. To draw a connector, you will need to configure the Tool and DrawingTool properties of the diagram.


For more details about automatic port creation, please refer to the following user guide link:   AutomaticPortCreation in WPF Diagram control | Syncfusion


Regards,

Arun Kumar S



MV Mario Vielitz August 1, 2024 09:34 AM UTC

Hello,


thank you for the response. Unfortunately that is not what I asked for. To clarify my request:
On selection of a connector, i would like to determine/receive/calculate the relative offset (0.0 - 1.0) of the point where i selected the connector. 

When i click a connector closer to the source it would be close to 0.0, when i click the connector closer to the target, it would be a number closer to 1.0.

I hope this clarifies my question :)


Best regards

Mario

edit:  

  To further clarify based on my initial screenshot:
the request ist about what connectors i'd like to select. 

- When clicking before the first connector port, I'd like to select all connections

- when clicking between the first and second connector port, I'd like to select only the main connection and the connection branching from the second port. 

- When clicking between the second port and the final target of the main connection, I'd like to only select the main connection.



KR Karkuvel Rajan Shanmugavel Syncfusion Team August 2, 2024 11:37 AM UTC

Hi Mario,


Requirement: How to get the offset when selecting a connector using a mouse click.


Thank you for your clear and concise explanation of your requirement. We have addressed your needs at the sample level by employing some custom logic. We calculated the total length of the connector and determined the distance between the source point of the connector and the mouse position, which allows us to find the offset value. Based on this offset value, you can implement your own logic for selecting the connector according to your criteria. We have attached a sample for your reference below.


Regards,

Karkuvel Rajan S


Attachment: Connector_Offset_Requirement__f072d2cd.zip

Loader.
Up arrow icon