From e2cb7663b00803b133943bd19729a8f3b8ea2e62 Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Mon, 21 Apr 2025 15:56:26 +0200 Subject: [PATCH] fix move mode as the current graph has now the most recent version of the modified entities, each individual change only needs to take into account the delta of the mouse movement between the current position and the previous one (instead of the original mouse position when the operation was started) --- modules/modes/move.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/modes/move.js b/modules/modes/move.js index a03728783..7a10961fe 100644 --- a/modules/modes/move.js +++ b/modules/modes/move.js @@ -47,7 +47,7 @@ export function modeMove(context, entityIDs, baseGraph) { var _prevGraph; var _cache; - var _origin; + var _prevMouse; var _nudgeInterval; // use pointer events on supported platforms; fallback to mouse events @@ -57,18 +57,18 @@ export function modeMove(context, entityIDs, baseGraph) { function doMove(nudge) { nudge = nudge || [0, 0]; - var fn; + let fn; if (_prevGraph !== context.graph()) { _cache = {}; - _origin = context.map().mouseCoordinates(); + _prevMouse = context.map().mouse(); fn = context.perform; } else { fn = context.overwrite; } - var currMouse = context.map().mouse(); - var origMouse = context.projection(_origin); - var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge); + const currMouse = context.map().mouse(); + const delta = geoVecSubtract(geoVecSubtract(currMouse, _prevMouse), nudge); + _prevMouse = currMouse; fn(actionMove(entityIDs, delta, context.projection, _cache)); _prevGraph = context.graph(); @@ -129,7 +129,7 @@ export function modeMove(context, entityIDs, baseGraph) { mode.enter = function() { - _origin = context.map().mouseCoordinates(); + _prevMouse = context.map().mouse(); _prevGraph = null; _cache = {};