Hi All
I'm looking for a way to click on a graphic/icon and drag it around the screen. I have been successful with the following method:
Currently, the code fires inside the onPressAndHold handler and checks to see if a graphic is under the mouseclick/point touched, if yes then it grabs the id of that graphic, and uses in in the onPositionChanged handler to bind the graphic's x,y to the mouse x,y and therefore successfully moves the graphic around until the mouse is released.
My issue is that the onPressAndHold takes a bit long to fire for my liking - my users would be doing this a lot and I think that waiting that extra second each time would soon get annoying.
the onPressAndHold seems to automatically freeze the map while you move the mouse around, but I couldn't find any property of the Map object that explicitly locks or freezes the panning - if there was one then I could use it inside the onPressed handler to temporarily disable the map panning.
Does anyone have any ideas on how I might achieve this using the onPressed instead of onPressAndHold?
Thanks
-Paul
Solved! Go to Solution.
Hi Paul,
To disable map's default pan behavior, mouse.accepted property has to be to set to true in onMousePositionChanged handler. Accepting the mouse event will disable the event propagation.
```
onMousePositionChanged: {
mouse.accepted = true;
}
```
Hi Paul,
To disable map's default pan behavior, mouse.accepted property has to be to set to true in onMousePositionChanged handler. Accepting the mouse event will disable the event propagation.
```
onMousePositionChanged: {
mouse.accepted = true;
}
```
Hi Shobana
Thanks for that! Using 'mouse.accepted = true' I've been able to implement the action I needed.
Cheers,
-Paul