[OpenLayers-Users] double clicks on button control
Dave Rafkind
drafkind at traversetechnologies.com
Thu Jun 17 13:10:07 EDT 2010
I would like to add an extra button control to the map, in addition to
the standard nav buttons. This additional button will do something when
clicked. This works fine as normal.
However when the users double-click the button that i have added, the
underlying map picks it up and tries to do the "zoom-in-and-center"
action at the point on the map
that the button control happens to be over. I believe this is because my
Button control is not consuming "Double-Click" actions and is instead
passing them to the underlying div(s). So I'd like to see if consuming
and destroying the double-click function from my Button will solve this.
If there is a different/better way, I'm open to that as well.
On 6/17/2010 1:01 PM, Vito Tafuni wrote:
> may be I misunderstand the terms "consume and ignore"
>
> however if you need standard mouse controls try adding the Navigation
> control to the map
>
> and if your Button doesn't work try strip off
> defaultControl: controls[0]
>
> or simply use the OpenLayers. Control. ZoomToMaxExtent
>
>
> all you need is docs
> http://dev.openlayers.org/docs/files/OpenLayers-js.html
>
>
> -Vito-
>
>
>
>
> --
> -----------
> Tafuni Vito
> vito at vitotafuni.com <mailto:vito at vitotafuni.com>
> ---------------------------------------------
> "Verba volant, scripta manent... data corrupted"
>
>
> 2010/6/17 Dave Rafkind <drafkind at traversetechnologies.com
> <mailto:drafkind at traversetechnologies.com>>
>
> Hello list, anyone know how to get a Button control added to the
> map to consume and ignore double click events? I want to let the
> normal handling of double click events (ie the zooming) work if
> the user double clicks on the map normally. Also I would prefer
> not to have to patch OpenLayers if at all possible. Here's my code:
>
> var extentControl =new OpenLayers.Control.Button({
> displayClass:'olControlZoomToMaxExtent',
> title:"Zoom to extent of site",
> trigger:function () {
> map.zoomToExtent(sitesLayer.getDataExtent());
> }
> });
>
>
> var controls = [
> // other controls also added to this list
>
> extentControl
>
> ];
>
> var panel =new OpenLayers.Control.Panel({
> 'displayClass':'olCustom',
> defaultControl: controls[0]
> });
>
> panel.addControls(controls);
> map.addControl(panel);
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org <mailto:Users at openlayers.org>
> http://openlayers.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100617/cecc689b/attachment.html
More information about the Users
mailing list