OpenLayers OpenLayers

Ticket #1359 (closed feature: fixed)

Opened 2 years ago

Last modified 1 year ago

HOWTO: Enable zoom out with right-dblclick

Reported by: openlayers Assigned to:
Priority: critical Milestone: 2.8 Release
Component: Events Version: 2.5
Keywords: Cc:
State: Complete

Description

This would be handy for users familiar with Google Maps.

I looked for a way to do it but could not get anything to work.

Wanted for http://wheresthepath.googlepages.com/wheresthepath.htm which uses OS OpenSpace.

Bill Chadwick

Attachments

RightMouse.patch (5.6 kB) - added by openlayers on 04/03/08 01:01:44.
RightMouseV2.patch (5.6 kB) - added by itbeyond on 05/27/08 00:29:08.
This version corrects the return missing for the event generated in the Click.js
rightClicks.patch (7.6 kB) - added by euzuro on 08/26/08 01:32:55.
adding APIProperty 'handleRightClicks' to allow for the turning on/off of this feature. default is off.
propagate.patch (2.3 kB) - added by euzuro on 10/23/08 17:14:58.
fix for typo includes regression tests.

Change History

02/27/08 13:49:17 changed by euzuro

  • milestone set to 2.7 Release.

interesting. did not know about this, but seems like a good idea

04/03/08 01:01:44 changed by openlayers

  • attachment RightMouse.patch added.

(follow-up: ↓ 3 ) 04/03/08 01:11:31 changed by openlayers

  • state set to Review.

Right mouse events patch added. I am not familiar yet with the test suite so there are currently no tests installed with the patch. There is also currently no option to turn on/off the support from the OpenLayers.Map hence this patch overrides the oncontextmenu (default right click) event. Browser events added in OpenLayers.Events are rightclick and dblrightclick. Currently implemented in Controls.Navigation is a new method called defaultRightDblClick which support the zoom out functionality. David Martin

(in reply to: ↑ 2 ) 04/24/08 07:22:04 changed by pvalsecc

Shouldn't you do something like that instead?

    mouseup:  function (evt) { 
      var propagate = true; 
      // Collect right mouse clicks from the mouseup 
      // IE - ignores the second right click in mousedown so using mouseup instead 
      if (this.checkModifiers(evt) && OpenLayers.Event.isRightClick(evt)) { 
         return this.rightclick(evt);             
      } 
      return propagate; 
    },

in order to propagate the "propagate" of the rightclick method...

05/27/08 00:16:16 changed by itbeyond

Yes correct I will modify the patch and upload a new version. Thanks for pointing this out.

05/27/08 00:29:08 changed by itbeyond

  • attachment RightMouseV2.patch added.

This version corrects the return missing for the event generated in the Click.js

(follow-up: ↓ 10 ) 07/26/08 23:36:05 changed by openlayers

Since not all browsers support capturing the right-click event, or perhaps don't recognize the oncontextmenu event, might it be appropriate to allow the ctrl/meta keys to act as surrogates for the right click?

isRightClick: function(event) {
        return (((event.which) && (event.which == 3)) ||
                ((event.button) && (event.button == 2)) || 
                (event.metaKey || event.ctrlKey));
    },

07/28/08 14:16:16 changed by euzuro

  • priority changed from minor to critical.

07/28/08 17:59:45 changed by euzuro

  • status changed from new to assigned.

08/26/08 01:32:55 changed by euzuro

  • attachment rightClicks.patch added.

adding APIProperty 'handleRightClicks' to allow for the turning on/off of this feature. default is off.

08/26/08 01:33:56 changed by euzuro

  • owner deleted.
  • status changed from assigned to new.

tests pass in ff2 and ie7. this is a fun patch. please review.

08/26/08 18:06:56 changed by ahocevar

  • state changed from Review to Commit.

This looks good and does not negatively affect existing functionality. Please commit.

(in reply to: ↑ 5 ) 08/26/08 18:24:21 changed by euzuro

Replying to openlayers:

Since not all browsers support capturing the right-click event, or perhaps don't recognize the oncontextmenu event, might it be appropriate to allow the ctrl/meta keys to act as surrogates for the right click? {{{ isRightClick: function(event) { return (((event.which) && (event.which == 3)) ((event.button) && (event.button == 2))

(event.metaKey event.ctrlKey)); }, }}}

I think this is a good idea, but let's address it separately. See #1703

08/26/08 18:27:04 changed by euzuro

  • keywords deleted.
  • status changed from new to closed.
  • state changed from Commit to Complete.
  • resolution set to fixed.

(In [7872]) Add support in OL for right-click capturing, including dbl-right-clicks (for zooming out in navigation control). Thanks to David Martin for this nice patch and the great 8 foot austrian for his review (Closes #1359)

10/23/08 16:59:44 changed by euzuro

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

as noted by chris r. on the mailing list:

I have noticed the following oddity in a patch attached to ticket #1359, at line 152:

http://trac.openlayers.org/attachment/ticket/1359/rightClicks.patch

       144             var propagate = true;
       145
       146             // Collect right mouse clicks from the mouseup
       147             //  IE - ignores the second right click in mousedown so using
       148             //  mouseup instead
       149             if (this.checkModifiers(evt) &&
       150                 this.control.handleRightClicks &&
       151                 OpenLayers.Event.isRightClick(evt)) {
       152               propogate = this.rightclick(evt);
       153             }
       154
       155             return propagate;

Surely that should be "propagate" rather than "propogate"?

10/23/08 17:14:58 changed by euzuro

  • attachment propagate.patch added.

fix for typo includes regression tests.

10/23/08 17:15:18 changed by euzuro

  • state changed from Complete to Review.
  • milestone changed from 2.7 Release to 2.8 Release.

10/25/08 09:30:34 changed by elemoine

  • state changed from Review to Commit.

i can't run the unit tests now, if they pass please commit. Thanks for the patch Erik.

10/27/08 13:59:20 changed by euzuro

all tests pass ff2, ie7. committing....

10/27/08 14:00:09 changed by euzuro

  • status changed from reopened to closed.
  • state changed from Commit to Complete.
  • resolution set to fixed.

(In [8207]) fix propogate/propagate typo in click handler. thanks to chris r. for finding this, elemoine for the review. (Closes #1359)