Skip to content

Commit

Permalink
Disable setting of rotation and double click zoom in terra draw adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
hvangeffen authored and wkramer committed May 30, 2024
1 parent 01f2144 commit 906f912
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/map/DrawBoundingBoxControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { onBeforeUnmount, watch, onBeforeMount } from 'vue'
import {
TerraDraw,
TerraDrawMapLibreGLAdapter,
TerraDrawMapboxGLAdapter,
TerraDrawRectangleMode,
} from 'terra-draw'
import { useMap } from 'vue-maplibre-gl'
Expand All @@ -20,7 +20,13 @@ const modelValue = defineModel<BoundingBox | null>({ 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',
Expand Down

0 comments on commit 906f912

Please sign in to comment.