hotfix: fix move tool left click behaviour
This commit is contained in:
12
app.js
12
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) {
|
||||
|
||||
Reference in New Issue
Block a user