From 906f9124960d8061bdb6d35277270a9474c1cd2d Mon Sep 17 00:00:00 2001 From: hvangeffen Date: Thu, 30 May 2024 09:03:47 +0200 Subject: [PATCH] Disable setting of rotation and double click zoom in terra draw adapter --- src/components/map/DrawBoundingBoxControl.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/map/DrawBoundingBoxControl.vue b/src/components/map/DrawBoundingBoxControl.vue index 2533a903..7db6d7f7 100644 --- a/src/components/map/DrawBoundingBoxControl.vue +++ b/src/components/map/DrawBoundingBoxControl.vue @@ -4,7 +4,7 @@ import { onBeforeUnmount, watch, onBeforeMount } from 'vue' import { TerraDraw, - TerraDrawMapLibreGLAdapter, + TerraDrawMapboxGLAdapter, TerraDrawRectangleMode, } from 'terra-draw' import { useMap } from 'vue-maplibre-gl' @@ -20,7 +20,13 @@ const modelValue = defineModel({ default: null }) const { map } = useMap() if (!map) throw new Error('Map is not available to draw rectangle on.') -const mapLibreAdapter = new TerraDrawMapLibreGLAdapter({ map }) +// Disable setting of double click zoom and dragRotate in adapter +class TerraDrawMGLAdapter extends TerraDrawMapboxGLAdapter { + setDoubleClickToZoom() {} + setDraggability() {} +} + +const mapLibreAdapter = new TerraDrawMGLAdapter({ map }) const rectangleMode = new TerraDrawRectangleMode({ styles: { fillColor: '#c2bebe',