Ticket #39 (closed feature: fixed)

Opened 7 years ago

Last modified 4 years ago

Allow pan-dragging while outside map until mouseup

Reported by: crschmidt Owned by: hocevar
Priority: minor Milestone: Future
Component: Events Version: 2.3
Keywords: Cc:
State: Complete

Description

By reassigning the map's 'mouseup' action to the document/window temporarily, it should be possible to allow dragging outside the map. When the user lifts the mouse button up, it should stop panning and un-assign these events from the document/window (and back only to the map).

Attachments

drag.patch Download (6.7 KB) - added by vmx 5 years ago.
Seems to work, but failes some tests
keepdragging.patch Download (11.2 KB) - added by vmx 4 years ago.
Patch for keeping on dragging even outside of the map
openlayers-39.patch Download (7.1 KB) - added by ahocevar 4 years ago.
less invasive, no performance impact
openlayers-39-test.patch Download (1.7 KB) - added by vmx 4 years ago.
Test for documentDrag feature
openlayers-39.2.patch Download (8.8 KB) - added by ahocevar 4 years ago.
combination of the above two: patch with tests
39.patch Download (3.1 KB) - added by tschaub 4 years ago.
documentDrag property on the navigation control

Change History

  Changed 7 years ago by crschmidt

  • milestone set to Dubo River

  Changed 7 years ago by mam@…

I am wondering why this is put off for a couple of releases.

Disclaimer: I have zero knowledge of the code base or other priorities.

I offer this up from a user-perspective: using openlayers.org, dragging out of the map was infuritating to use. It was snappy, and slick, and then I'd drag out and get frustrated.

  Changed 7 years ago by crschmidt

  • milestone changed from Dubo River to Esfahan

  Changed 7 years ago by euzuro

  • milestone 2.1 Release deleted

  Changed 7 years ago by euzuro

  • version set to 2.3
  • milestone set to 2.3 Release

  Changed 7 years ago by crschmidt

Yeah, we should do this.

  Changed 7 years ago by crschmidt

Testing trac list.

  Changed 7 years ago by crschmidt

Testing trac list again.

  Changed 6 years ago by euzuro

  • milestone changed from 2.3 Release to 2.4 Release

  Changed 6 years ago by sderle

  • milestone 2.4 Release deleted

patches to Handler.Drag welcome. until then, this doesn't belong in a milestone.

  Changed 6 years ago by sderle

  • owner changed from crschmidt to sderle
  • milestone set to 2.5 Release

actually, would be willing to do this myself in 2.5.

  Changed 6 years ago by crschmidt

  • milestone changed from 2.5 Release to 2.6 Release

SDE: If you get this done in the next couple weeks, feel free to move back to 2.5, but it's not done now and we're looking at RC1 in 2.5 eweks.

  Changed 6 years ago by crschmidt

  • milestone changed from 2.6 Release to Future

not currently being worked on, afaik.

  Changed 5 years ago by vmx

Getting it work needs a new set of events that are bound to the document instead of to the map. So I introduced map.eventsDocument for events bound to window.document. Functions that should be bound to these events get are suffixed with "Document" (see patch).

Changed 5 years ago by vmx

Seems to work, but failes some tests

  Changed 4 years ago by rdewit

  • keywords foss4g09 added

  Changed 4 years ago by ahocevar

vmx: Thanks for your efforts on this during the sprint. Sorry I wasn't able to provide more help. Please disregard my suggestion to manage this entirely of the level of the control. Of course you will need to make the drag handler aware of the document level event. I assume that the reason for the failing tests is that you replaced the mouseup and mousemove methods of the drag handler with mouseupDocument and mousemoveDocument, instead of adding new methods for these.

I was not able to look into the code in more detail, but if you submit the new patch that you worked on during the sprint I'll try to find some time to do so.

Changed 4 years ago by vmx

Patch for keeping on dragging even outside of the map

  Changed 4 years ago by vmx

  • owner changed from sderle to hocevar
  • state set to Review

ahocevar: I've finally understood what you mean. I've attached a new working patch (including an example) that passes all tests.

  Changed 4 years ago by ahocevar

  • state changed from Review to Needs More Work

@vmx: Thanks for your new patch. Based on your ideas, I have created a new one which is less invasive and has no performance impact (except for an inexpensive boolean check in the mousemove callback). If this new patch works for you and you like it, it would be cool if you could create unit tests for it.

  Changed 4 years ago by ahocevar

Also, for some reasons I do not understand, my patch does not work in IE. vmx, do you have an idea? It seems that evt.element never equals window when in the mousemove method of Handler.Drag.

Changed 4 years ago by ahocevar

less invasive, no performance impact

  Changed 4 years ago by ahocevar

@vmx: now also works in IE. Looks like in IE, an Events instance cannot be registered with the window, only with the document.

follow-up: ↓ 22   Changed 4 years ago by vmx

@ahocevar: wow, great work. Wouldn't be the test included in keepdragging.patch be enough? Could I test anything more?

in reply to: ↑ 21   Changed 4 years ago by ahocevar

Replying to vmx:

@ahocevar: wow, great work. Wouldn't be the test included in keepdragging.patch be enough? Could I test anything more?

I think that test would be enough. Thanks!

Changed 4 years ago by vmx

Test for documentDrag feature

Changed 4 years ago by ahocevar

combination of the above two: patch with tests

  Changed 4 years ago by ahocevar

  • state changed from Needs More Work to Review

Tests pass in FF3, IE8 and Chrome. Please review.

  Changed 4 years ago by bartvde

  • state changed from Review to Commit

Hi Andreas, this is looking good. You can commit if you add a short documentation line to the destroyDocumentEvents and adjustXY methods. Thanks.

  Changed 4 years ago by ahocevar

  • keywords foss4g09 removed
  • status changed from new to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [9791]) Added documentDrag option to the DragPan control and Drag handler. When set to true, this allow pan-dragging while outside the map. Thanks vmx for the initial patches. r=vmx, bartvde (closes #39)

  Changed 4 years ago by tschaub

  • status changed from closed to reopened
  • state Complete deleted
  • resolution fixed deleted

Reopening this in hopes of one more feature.

  Changed 4 years ago by tschaub

  • state set to Review

This is a very nice feature. To make it a bit more accessible, how about a documentDrag property on the navigation control?

Extending this a bit more, documentDrag (or something similarly named) could be a map property as well. I like the idea of bringing this a bit closer to the user in hopes of getting it used.

  Changed 4 years ago by ahocevar

  • state changed from Review to Commit

Good call. Please commit.

follow-up: ↓ 31   Changed 4 years ago by vmx

  • state changed from Commit to Needs More Work

I'd like to change the test to reflect the change (it's a one-line). Either someone does it before committing, or I'll attach a patch the next day (or so).

Changed 4 years ago by tschaub

documentDrag property on the navigation control

  Changed 4 years ago by tschaub

  • status changed from reopened to closed
  • state changed from Needs More Work to Complete
  • resolution set to fixed

(In [9805]) Exposing the documentDrag property on the Navigation control. r=ahocevar (closes #39)

in reply to: ↑ 29 ; follow-up: ↓ 32   Changed 4 years ago by tschaub

Replying to vmx:

I'd like to change the test to reflect the change (it's a one-line). Either someone does it before committing, or I'll attach a patch the next day (or so).

I think more tests here would be great. In r9805, I added tests relevant to the lib changes in that same revision. If you've got more tests related to r9791 in mind, I think they'd go in the DragPan or Drag handler tests (doesn't look to me like the functionality added is specifically tested).

Let me know if you were thinking of something else.

in reply to: ↑ 31   Changed 4 years ago by vmx

Replying to tschaub:

I think more tests here would be great. In r9805, I added tests relevant to the lib changes in that same revision. If you've got more tests related to r9791 in mind, I think they'd go in the DragPan or Drag handler tests (doesn't look to me like the functionality added is specifically tested).

I would have updated for the API change only (as you did, thanks). The current test isn't great, but I haven't had a better idea, rather than testing if dragging still works when the documentDrag option is enabled.

Note: See TracTickets for help on using tickets.