From fb7202d5f0aa1b8052fa679f9bd73f66a7fad4b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lozano?= <97222117+lozanoje@users.noreply.github.com> Date: Mon, 7 Feb 2022 10:07:07 +0100 Subject: [PATCH 1/6] Spanish updated (#155) --- lang/es.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lang/es.json b/lang/es.json index 308aced..c834583 100644 --- a/lang/es.json +++ b/lang/es.json @@ -44,9 +44,17 @@ "moveWithoutAnimation": { "name": "Deshabilitar animación de icono", "hint": "Si al soltar un icono se presiona esta tecla, se deshabilitará la animación del icono al moverse al destino" + }, + "togglePathfinding": { + "name": "Conmutar búsqueda de camino", + "hint": "Cuando se presione al arrastrar un icono, la funcionalidad de búsqueda de camino será temporalmente habilitada/deshabilitada" } }, "settings": { + "allowPathfinding": { + "name": "Permitir búsqueda de camino a los jugadores", + "hint": "Permite a los jugadores usar en este mundo la funcionalidad de búsqueda de camino. Tenga cuidado porque la ruta puede transcurrir por lugares con niebla de guerra o muros invisibles, lo que podrá revelar algunos secretos a los jugadores antes de tiempo" + }, "alwaysShowSpeedForPCs": { "name": "Mostrar velocidad de los PJs a todo el mundo", "hint": "Si se habilita, se mostrará a todo el mundo los códigos de colores de las rutas de los PJs, incluso si no tienen permisos de observador para ese personaje" @@ -55,6 +63,10 @@ "name": "Comenzar a medir automáticamente", "hint": "Si se habilita, Drag Ruler comenzará a medir en cuanto se comience a arrastrar un icono. Si se deshabilita, Drag Ruler permanecerá inactivo y comenzará a medir únicamente cuando se presione el botón configurado para añadir un nuevo punto de ruta" }, + "autoPathfinding": { + "name": "Búsqueda de camino por defecto", + "hint": "Si se habilita, al arrastrar un icono se usará automáticamente la regla de búsqueda de camino" + }, "enableMovementHistory": { "name": "Habilitar historial de movimiento durante el combate", "hint": "Si se habilita, Drag Ruler recordará la ruta que ha seguido un icono en su turno y la mostrará al seleccionarlo de nuevo" From 96cb690431b77203d01db5624b716f0c7295847b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Wed, 9 Feb 2022 08:56:38 +0100 Subject: [PATCH 2/6] Use foundries new, improved way of wainting for animations when moving tokens (fixes #156) --- src/foundry_imports.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/foundry_imports.js b/src/foundry_imports.js index 80ab9ad..fa709c2 100644 --- a/src/foundry_imports.js +++ b/src/foundry_imports.js @@ -91,7 +91,7 @@ async function animateEntities(entities, draggedEntity, draggedRays, wasPaused) }); await draggedEntity.scene.updateEmbeddedDocuments(draggedEntity.constructor.embeddedName, updates, {animate}); if (animate) - await Promise.all(entityPaths.map(({entity, path}) => entity.animateMovement(path))); + await Promise.all(entityPaths.map(({entity}) => CanvasAnimation.getAnimation(entity.movementAnimationName)?.promise)); // This is a flag of the "Monk's Active Tile Triggers" module that signals that the movement should be cancelled early if (this.cancelMovement) { From fb3665d758cc71d3d2b6482deefd605a4c22ba10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Wed, 9 Feb 2022 10:30:17 +0100 Subject: [PATCH 3/6] If no measurement has been performed yet before dropping the token, schedule a measurement on drop (fixes #153) --- src/main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.js b/src/main.js index 0a761aa..125196c 100644 --- a/src/main.js +++ b/src/main.js @@ -97,6 +97,7 @@ async function tokenLayerUndoHistory(wrapped) { function onEntityLeftDragStart(wrapped, event) { wrapped(event); + console.warn("start", Date.now()); const isToken = this instanceof Token; const ruler = canvas.controls.ruler ruler.draggedEntity = this; @@ -127,6 +128,7 @@ function onEntityLeftDragMove(wrapped, event) { function onEntityDragLeftDrop(event) { const ruler = canvas.controls.ruler + console.warn("stop", ruler._state, Date.now()); if (!ruler.isDragRuler) { ruler.draggedEntity = undefined; return false @@ -137,6 +139,9 @@ function onEntityDragLeftDrop(event) { // This can happen if the user presses ESC during drag (maybe there are other ways too) if (selectedTokens.length === 0) selectedTokens.push(ruler.draggedEntity); + // This can happen if the ruler is being dragged so rapidly that the drag move handler hasn't been called before dropping + if (ruler._state === Ruler.STATES.STARTING) + onMouseMove.call(ruler, event); ruler._state = Ruler.STATES.MOVING moveEntities.call(ruler, ruler.draggedEntity, selectedTokens); return true From 443cfd4317b49a0c40a24b521422702f78a02f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Wed, 9 Feb 2022 10:41:01 +0100 Subject: [PATCH 4/6] Don't apply snapping to rulers received from other players (fixes #150) --- src/ruler.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ruler.js b/src/ruler.js index 139fb7b..7e35f9e 100644 --- a/src/ruler.js +++ b/src/ruler.js @@ -61,6 +61,9 @@ export function extendRuler() { measure(destination, options={}) { if (this.isDragRuler) { + // If this is the ruler of a remote user take the waypoints as they were transmitted and don't apply any additional snapping to them + if (this.user !== game.user) + options.snap = false; return measure.call(this, destination, options); } else { From f59b0f9d2d4561b2fcbf6d526b5f4208c4292d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Wed, 9 Feb 2022 10:51:19 +0100 Subject: [PATCH 5/6] When changing the measurement mode via a keybinding send the updated ruler state to other players immediately (fixes #152) --- src/keybindings.js | 2 ++ src/ruler.js | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/keybindings.js b/src/keybindings.js index c2747e2..b3ef09d 100644 --- a/src/keybindings.js +++ b/src/keybindings.js @@ -107,6 +107,7 @@ function handleDisableSnap(event) { return false; ruler.measure(getMeasurePosition(), {snap: !disableSnap}); + ruler.dragRulerSendState(); return false; } @@ -124,5 +125,6 @@ function handleTogglePathfinding(event) { return false; ruler.measure(getMeasurePosition(), {snap: !disableSnap}); + ruler.dragRulerSendState(); return false; } diff --git a/src/ruler.js b/src/ruler.js index 7e35f9e..770914b 100644 --- a/src/ruler.js +++ b/src/ruler.js @@ -202,6 +202,12 @@ export function extendRuler() { if (measureImmediately) ruler.measure(destination, options); } + + dragRulerSendState() { + game.user.broadcastActivity({ + ruler: this.toJSON() + }); + } } Ruler = DragRulerRuler; From 22112ddfd51d8421bfca13039267be483cc18cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Wed, 9 Feb 2022 10:58:02 +0100 Subject: [PATCH 6/6] Release v1.11.4 --- CHANGELOG.md | 11 +++++++++++ module.json | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7c970d..add1184 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## 1.11.4 +### Bugfixes +- When changing the measurement mode via a keybinding (toggle snaping or toggle pathfinding) the updated ruler will now be sent to other players immediately +- Fixed a bug that incorrectly showed a ruler to be snapped to other players despite the ruler not being snapped +- Fixed a bug that could cause a token to move to an incorrect location if the token was being dragged and dropped very rapidly +- Drag Ruler's token movement animations can now be properly waited for (this improves the interaction with modules like sequencer) + +### Translation +- Updated Spanish translation (thanks to Viriato139ac#342) + + ## 1.11.3 ### Bugfixes - The setting to automatically start pathfinding is now visible to players again (this was a regression introduced in 1.11.2) diff --git a/module.json b/module.json index 40db651..be3d4d0 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "name": "drag-ruler", "title": "Drag Ruler", "description": "When dragging a token displays a ruler showing how far you've moved that token.", - "version": "1.11.3", + "version": "1.11.4", "minimumCoreVersion" : "9.245", "compatibleCoreVersion" : "9", "authors": [ @@ -65,7 +65,7 @@ ], "socket": true, "url": "https://github.com/manuelVo/foundryvtt-drag-ruler", - "download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.11.3.zip", + "download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.11.4.zip", "manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-drag-ruler/master/module.json", "readme": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/README.md", "changelog": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/CHANGELOG.md",