[OpenLayers-Users] How to disable <ctrl> drag

Ryan Williams rwilliams at paqinteractive.com
Tue Feb 21 11:16:18 EST 2012


Jan,
  There's a short example on the OpenLayers docs that sounds similar. 
http://dev.openlayers.org/docs/files/OpenLayers/Control-js.html
It doesn't use the map.events.register though.
It shows how to use OpenLayers.Util.extend to create a control that will 
work when the user is holding down the Shift key. It intercepts the 
shift-mouse click, lets the user drag out a box, and then does something 
with the bounds of that box.
It uses the OpenLayers.Handler.MOD_SHIFT keymask. There is also a 
MOD_CTRL keymask you could use as well.
http://dev.openlayers.org/docs/files/OpenLayers/Handler-js.html#OpenLayers.Handler.OpenLayers.Handler.MOD_CTRL

I use the MOD_SHIFT keymask to let users drag out a box over a map and 
it works fine.
- Ryan

On 2/21/2012 9:54 AM, Jan Hartmann wrote:
> Hi all,
>
> I have written a small application to input points with <ctrl><click> 
> from an OpenLayers map using 
> "map.events.register("click",map,function(e) { ...}". Works fine, but 
> when the user moves the mouse when clicking, the default behavior 
> takes over: the map is panned and no input takes place. How can I 
> disable panning when the <ctrl> key is  down?
>
> Jan
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users

-- 
Ryan Williams
GIS Analyst / Programmer
PAQ Interactive Inc.
rwilliams at paqinteractive.com
217-762-7955

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120221/d6d94774/attachment.html


More information about the Users mailing list