Share via

Is it possible to handle a DragHandle's 'dragend' event?

Mark Phillips 156 Reputation points
2022-12-04T05:50:13.53+00:00

There was a question 2 years ago in relation to attaching a handler to a DragHandle's click event. Is it not possible still to attach an event handler to DragHandle's events, specifically when dragend is triggered?

For further clarification, I have 2 capabilities I'd like to implement whilst editing a polygon:

  1. When a user drags a polygon's handle (position A) near to a corner of another polygon (call this position B) and releases within a pre-determined range, I want the handle and subsequent position it represents to snap to position B.
  2. When a user drags a polygon's handle (position A) near to an adjacent handle on the same editing polygon, I want the two handles (and consequently the 2 positions of the shape) to be merged into 1 position.

Both capabilities require me to know the final position a user has dragged the handle to, such that I can determine a course of action and modify the target position (for option 1) or modify the shape entirely (for option 2).

Azure Maps
Azure Maps

An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.

{count} votes

1 answer

Sort by: Most helpful
  1. rbrundritt 21,781 Reputation points
    2022-12-05T23:14:13.037+00:00

    There is no events for the drag handles. You can monitor the drawing start/end/change events and monitor the coordinate arrays to determine which vertex changed. That said, it sounds like you want to snap the coordinate, in which case, it is best to use the built-in snapping capability that does this already and is highly optimized for performance.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.