<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Times New Roman, Times, serif">This works:<br>
<br>
var control = new OpenLayers.Control();<br>
OpenLayers.Util.extend(control, {<br>
draw: function () {<br>
// this Handler.Box will intercept the ctrl-mousedown<br>
// before Control.MouseDefault gets to see it<br>
this.drag = new OpenLayers.Handler.Drag( control,<br>
{"done": this.notice},<br>
{keyMask: OpenLayers.Handler.MOD_CTRL});<br>
this.drag.activate();<br>
},<br>
<br>
notice: function () {<br>
return(true)<br>
}<br>
map.addControl(control);<br>
<br>
Thanks Ryan,<br>
<br>
Jan</font><br>
<br>
<br>
On 02/21/2012 05:16 PM, Ryan Williams wrote:
<blockquote cite="mid:4F43C352.3010807@paqinteractive.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Jan,<br>
There's a short example on the OpenLayers docs that sounds
similar. <a moz-do-not-send="true"
href="http://dev.openlayers.org/docs/files/OpenLayers/Control-js.html">http://dev.openlayers.org/docs/files/OpenLayers/Control-js.html</a><br>
It doesn't use the map.events.register though. <br>
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. <br>
It uses the OpenLayers.Handler.MOD_SHIFT keymask. There is also a
MOD_CTRL keymask you could use as well. <br>
<a moz-do-not-send="true"
href="http://dev.openlayers.org/docs/files/OpenLayers/Handler-js.html#OpenLayers.Handler.OpenLayers.Handler.MOD_CTRL">http://dev.openlayers.org/docs/files/OpenLayers/Handler-js.html#OpenLayers.Handler.OpenLayers.Handler.MOD_CTRL</a><br>
<br>
I use the MOD_SHIFT keymask to let users drag out a box over a map
and it works fine. <br>
- Ryan<br>
<br>
On 2/21/2012 9:54 AM, Jan Hartmann wrote:
<blockquote cite="mid:4F43BE1A.3080802@uva.nl" type="cite"> <font
face="Times New Roman, Times, serif">Hi all,<br>
<br>
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?<br>
<br>
Jan<br>
</font> <br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ryan Williams
GIS Analyst / Programmer
PAQ Interactive Inc.
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:rwilliams@paqinteractive.com">rwilliams@paqinteractive.com</a>
217-762-7955</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
</blockquote>
</body>
</html>