[OpenLayers-Users] OL 6 DragZoom Control - how to change condition

Momtchil Momtchev momtchil at momtchev.com
Wed Jan 12 17:42:31 PST 2022



There is a DragRotateAndZoom example:
https://openlayers.org/en/latest/examples/drag-rotate-and-zoom.html

Take this and replace DragRotateAndZoom with DragZoom passing 
{condition: () => true} in the constructor:

|defaultInteractions().extend([new DragZoom(||{condition: () => true})])|


condition function gets called to decide if it should process the event 
- in your case it should always return true.

On 12/01/2022 20:13, karsten wrote:
> Hi All,
> in OL 6 I would like to use a button so a user can click activate a 
> change for the dragzoom control
> so it will be available without holding down shift.
> In 
> https://openlayers.org/en/latest/apidoc/module-ol_interaction_DragZoom-DragZoom.html 
> <https://openlayers.org/en/latest/apidoc/module-ol_interaction_DragZoom-DragZoom.html>it 
> lists the option 'condition' to handles this.
> I could not figure out how to change and set that condition . Any 
> examples how to do this?
> Thanks
> Karsten
>
> Terra GIS LTD
> www.terragis.net <http://www.terragis.net>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Cordialement,
Momtchil Momtchev<momtchil at momtchev.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20220113/8f5d5026/attachment.html>


More information about the Users mailing list