Author Topic: How to abort drag operation in map panel?  (Read 237 times)

lbo

  • Sr. Member
  • **
  • Posts: 339
How to abort drag operation in map panel?
« on: May 03, 2021, 10:29:07 AM »
Hi,

when I start dragging a location marker in the map panel, how can I abort the drag operation?

In other applications, I can hit ESC to stop the operation. Dropping the object to an illegal position works also.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 28570
Re: How to abort drag operation in map panel?
« Reply #1 on: May 03, 2021, 01:41:15 PM »
Does undo not work?
What is an illegal position? Which map provider do you use?

lbo

  • Sr. Member
  • **
  • Posts: 339
Re: How to abort drag operation in map panel?
« Reply #2 on: May 03, 2021, 01:52:04 PM »
Undo might work, but it would be cleaner to be able to cancel the operation instead of reverting it afterwards.

An illegal position is for example outside the map panel window. Try a drag/drop operation in the Windows Explorer: Moving the cursor over a place where you can't drop the file results a prohibition sign (most times).

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 28570
Re: How to abort drag operation in map panel?
« Reply #3 on: May 03, 2021, 02:27:31 PM »
Quote
Moving the cursor over a place where you can't drop the file results a prohibition sign (most times).

This is how it should be, when I'm not mistaken. What happens when you drag a marker onto Windows Explorer? I have never tried this, because it makes not much sense.

Drag & Drop in the map panel is an operation handled by the app running and various between the map providers (which also provide the code to deal with the map).
Hence my questions above, which you did not answer yet.

lbo

  • Sr. Member
  • **
  • Posts: 339
Re: How to abort drag operation in map panel?
« Reply #4 on: May 03, 2021, 03:55:52 PM »
This is how it should be, when I'm not mistaken. What happens when you drag a marker onto Windows Explorer? I have never tried this, because it makes not much sense.

Running IMatch usually in full screen mode, I didn't reach other windows. But I tried now: Dragging outside the IMatch window doesn't bring up the undo button in the map panel.

The map provider doesn't matter that much: Google starts to pan as soon as you drag the cursor out of the map panel. OSM/Bing etc. don't pan but if you release the mouse button, some location outside the map area shown is set. Neither of them accepts ESC or cancels the drag/drop operation when dropping outside the window.

As it seems to be not easy to get the "Windows behavior" in Chromium (?) and using external code, we shouldn't spend more time on this. Undo is viable.

I tried other browser based stuff and it also didn't cancel drag operations by a keystroke or by dropping outside the browser window.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 28570
Re: How to abort drag operation in map panel?
« Reply #5 on: May 03, 2021, 08:54:14 PM »
Quote
Dragging outside the IMatch window doesn't bring up the undo button in the map panel.

Because the marker remains unchanged.

All the drag marker stuff is pretty much handled by the OpenLayers code (which I use for Bing/HERE/OSM) or Google Code (Google Maps).
My code handles the "drag completed" in order to adjust the file coordinates when the user has moved the marker. Which also enables the Undo.

Not sure if I should spend time to learn how to intercept the drag handling of OpenLayers and Google to support ESC or other means to abort the drag.
If the map vendors think that this was something needed, they would have added it to their drag handling code, I'm sure.

lbo

  • Sr. Member
  • **
  • Posts: 339
Re: How to abort drag operation in map panel?
« Reply #6 on: May 03, 2021, 09:44:37 PM »
Quote
Dragging outside the IMatch window doesn't bring up the undo button in the map panel.
Because the marker remains unchanged.

no, the marker is changed even if dragged outside the IMatch window.

Nevertheless I was wrong: The undo button appears briefly, but disappears after a second (only when using the Google map). And this happens also if I drag the marker inside the map panel.

All the drag marker stuff is pretty much handled by the OpenLayers code (which I use for Bing/HERE/OSM) or Google Code (Google Maps).
My code handles the "drag completed" in order to adjust the file coordinates when the user has moved the marker. Which also enables the Undo.

Not sure if I should spend time to learn how to intercept the drag handling of OpenLayers and Google to support ESC or other means to abort the drag.

I wouldn't do so.

But the vanishing undo button should be fixed.

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 28570
Re: How to abort drag operation in map panel?
« Reply #7 on: May 04, 2021, 11:17:17 AM »
I have fixed the vanishing update button for Google Maps.
This was only a problem with this button, the Undo itself (via the Edit menu in IMatch) works.

lbo

  • Sr. Member
  • **
  • Posts: 339
Re: How to abort drag operation in map panel?
« Reply #8 on: May 04, 2021, 01:28:08 PM »
great, thanks!