From 1a5a1ea23a37275c33d3b4a4278c167c1742ede4 Mon Sep 17 00:00:00 2001 From: WovenCoast Date: Mon, 8 Dec 2025 23:40:20 +0500 Subject: [PATCH] hotfix: fix move tool left click behaviour --- app.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index cde1fed..dd39f39 100644 --- a/app.js +++ b/app.js @@ -35,8 +35,10 @@ let isPanning = false; let panStart = null; map.getContainer().addEventListener('mousedown', (e) => { - // Middle mouse button OR right-click in select mode - if (e.button === 1 || (e.button === 2 && currentTool === 'select')) { + // Middle mouse button OR right-click in select/move mode OR left-click in move mode + if (e.button === 1 || + (e.button === 2 && (currentTool === 'select' || currentTool === 'move')) || + (e.button === 0 && currentTool === 'move')) { e.preventDefault(); isPanning = true; panStart = { x: e.clientX, y: e.clientY }; @@ -64,7 +66,7 @@ map.getContainer().addEventListener('mousemove', (e) => { }); map.getContainer().addEventListener('mouseup', (e) => { - if (e.button === 1 || e.button === 2) { + if (e.button === 1 || e.button === 2 || e.button === 0) { isPanning = false; panStart = null; map.getContainer().style.cursor = ''; @@ -226,8 +228,8 @@ map.on('contextmenu', (e) => { L.DomEvent.preventDefault(e); const latlng = e.latlng; - if (currentTool === 'select') { - // Allow map panning with right-click in select mode + if (currentTool === 'select' || currentTool === 'move') { + // Allow map panning with right-click in select and move mode return; } else if (currentTool === 'line') { if (drawingLine) {