OpenLayers OpenLayers

Ticket #39 (closed feature: fixed)

Opened 4 years ago

Last modified 4 months ago

Allow pan-dragging while outside map until mouseup

Reported by: crschmidt Assigned to: 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 (6.7 kB) - added by vmx on 08/02/08 11:16:03.
Seems to work, but failes some tests
keepdragging.patch (11.2 kB) - added by vmx on 10/25/09 23:05:16.
Patch for keeping on dragging even outside of the map
openlayers-39.patch (7.1 kB) - added by ahocevar on 10/27/09 16:12:47.
less invasive, no performance impact
openlayers-39-test.patch (1.7 kB) - added by vmx on 10/28/09 02:58:37.
Test for documentDrag feature
openlayers-39.2.patch (8.8 kB) - added by ahocevar on 10/28/09 08:47:28.
combination of the above two: patch with tests
39.patch (3.1 kB) - added by tschaub on 11/17/09 23:41:23.
documentDrag property on the navigation control

Change History

05/19/06 20:53:41 changed by crschmidt

  • milestone set to Dubo River.

05/20/06 16:57:24 changed by mam@metacarta.com

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.

06/21/06 19:57:12 changed by crschmidt

  • milestone changed from Dubo River to Esfahan.

08/15/06 23:00:53 changed by euzuro

  • milestone deleted.

10/02/06 15:37:23 changed by euzuro

  • version set to 2.3.
  • milestone set to 2.3 Release.

10/06/06 12:56:16 changed by crschmidt

Yeah, we should do this.

10/06/06 12:59:26 changed by crschmidt

Testing trac list.

10/06/06 13:02:29 changed by crschmidt

Testing trac list again.

12/28/06 19:13:10 changed by euzuro

  • milestone changed from 2.3 Release to 2.4 Release.

03/08/07 11:51:56 changed by sderle

  • milestone deleted.

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

03/09/07 16:31:49 changed 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.

08/03/07 11:10:54 changed 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.

10/10/07 00:46:43 changed by crschmidt

  • milestone changed from 2.6 Release to Future.

not currently being worked on, afaik.

08/02/08 11:14:09 changed by vmx

  • state changed.

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).

08/02/08 11:16:03 changed by vmx

  • attachment drag.patch added.

Seems to work, but failes some tests

10/23/09 07:23:52 changed by rdewit

  • keywords set to foss4g09.

10/24/09 21:35:03 changed 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.

10/25/09 23:05:16 changed by vmx

  • attachment keepdragging.patch added.

Patch for keeping on dragging even outside of the map

10/25/09 23:06:56 changed 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.

10/27/09 11:19:25 changed 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.

10/27/09 12:13:31 changed 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.

10/27/09 16:12:47 changed by ahocevar

  • attachment openlayers-39.patch added.

less invasive, no performance impact

10/27/09 16:13:43 changed 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 ) 10/28/09 00:16:19 changed 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 ) 10/28/09 01:37:14 changed 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!

10/28/09 02:58:37 changed by vmx

  • attachment openlayers-39-test.patch added.

Test for documentDrag feature

10/28/09 08:47:28 changed by ahocevar

  • attachment openlayers-39.2.patch added.

combination of the above two: patch with tests

10/28/09 08:48:23 changed by ahocevar

  • state changed from Needs More Work to Review.

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

11/10/09 00:54:36 changed 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.

11/10/09 05:14:28 changed by ahocevar

  • keywords deleted.
  • 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)

11/16/09 16:52:18 changed by tschaub

  • status changed from closed to reopened.
  • state deleted.
  • resolution deleted.

Reopening this in hopes of one more feature.

11/16/09 16:54:51 changed 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.

11/17/09 06:06:10 changed by ahocevar

  • state changed from Review to Commit.

Good call. Please commit.

(follow-up: ↓ 31 ) 11/17/09 13:36:22 changed 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).

11/17/09 23:41:23 changed by tschaub

  • attachment 39.patch added.

documentDrag property on the navigation control

11/17/09 23:42:18 changed 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 ) 11/17/09 23:46:38 changed 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 ) 11/18/09 05:10:19 changed 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.