From 654f8e3111b05667e34ec8856d10434171535b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Fri, 1 Apr 2022 18:03:50 +0200 Subject: [PATCH 1/5] Fix a typo that caused measurement template snapping to be broken (fixes #185) --- js/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/util.js b/js/util.js index c2406e2..28eeb1a 100644 --- a/js/util.js +++ b/js/util.js @@ -94,7 +94,7 @@ export function getSnapPointForMeasuredTemplate(x, y) { if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS) { return new PIXI.Point(x, y); } - return canvas.grid.grid.getSnappedPosition(x, y, canvas.templates.gridPosition); + return canvas.grid.grid.getSnappedPosition(x, y, canvas.templates.gridPrecision); } export function getSnapPointForEntity(x, y, entity) { From 3afb1f30b73bea9748c602518ce51fed773379e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Fri, 1 Apr 2022 18:06:46 +0200 Subject: [PATCH 2/5] Release v1.12.7 --- CHANGELOG.md | 5 +++++ module.json | 4 ++-- rust/Cargo.lock | 2 +- rust/Cargo.toml | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dffd08b..5cb3117 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.12.7 +### Bugfixes +- Fixed a bug that caused measurement templates to only snap to the corners of the grid (this was a regression introduced in 1.12.5) + + ## 1.12.6 ### Bugfixes - Measured templates no longer snap to a virtual grid on gridless scenes (this was a regression introduced in 1.12.5) diff --git a/module.json b/module.json index 0d2ad89..fd5e372 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.12.6", + "version": "1.12.7", "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/releases/download/v1.12.6/drag-ruler-1.12.6.zip", + "download": "https://github.com/manuelVo/foundryvtt-drag-ruler/releases/download/v1.12.7/drag-ruler-1.12.7.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", diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 6de4ba4..5251d1e 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -26,7 +26,7 @@ dependencies = [ [[package]] name = "gridless-pathfinding" -version = "1.12.6" +version = "1.12.7" dependencies = [ "console_error_panic_hook", "js-sys", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 77cbeb5..da59dc2 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gridless-pathfinding" -version = "1.12.6" +version = "1.12.7" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From a3d942c287eda0e7c328cf9b67573eb30a728469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Tue, 12 Apr 2022 00:09:02 +0200 Subject: [PATCH 3/5] Apply wall height's bounds to the rays before doing colission checks (fixes #190) --- js/foundry_imports.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/foundry_imports.js b/js/foundry_imports.js index fa709c2..e443104 100644 --- a/js/foundry_imports.js +++ b/js/foundry_imports.js @@ -28,6 +28,9 @@ export async function moveEntities(draggedEntity, selectedEntities) { const hasCollision = selectedEntities.some(token => { const offset = calculateEntityOffset(token, draggedEntity); const offsetRays = rays.filter(ray => !ray.isPrevious).map(ray => applyOffsetToRay(ray, offset)) + if (window.WallHeight) { + window.WallHeight.addBoundsToRays(offsetRays, draggedEntity); + } return offsetRays.some(r => canvas.walls.checkCollision(r)); }) if (hasCollision) { From 9d227efcd14c33f18ca8ce746894edfadf510e12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Tue, 12 Apr 2022 00:10:43 +0200 Subject: [PATCH 4/5] Enusre that measurements to determine the highlight color are always done center to center (fixes #189) --- js/foundry_imports.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/foundry_imports.js b/js/foundry_imports.js index e443104..79a90b2 100644 --- a/js/foundry_imports.js +++ b/js/foundry_imports.js @@ -344,7 +344,8 @@ export function highlightMeasurementNative(ray, previousSegments, tokenShape=[{x if ( x0 === x1 && y0 === y1 ) continue; // Highlight the grid position - let [xg, yg] = canvas.grid.grid.getPixelsFromGridPosition(x1, y1); + let [xgtl, ygtl] = canvas.grid.grid.getPixelsFromGridPosition(x1, y1); + let [xg, yg] = canvas.grid.grid.getCenter(xgtl, ygtl); const pathUntilSpace = previousSegments.concat([{ray: new Ray(ray.A, {x: xg, y: yg})}]); const distance = sum(canvas.grid.measureDistances(pathUntilSpace, {gridSpaces: true})); const color = this.dragRulerGetColorForDistance(distance); @@ -358,7 +359,8 @@ export function highlightMeasurementNative(ray, previousSegments, tokenShape=[{x let th = tMax[i - 1] - (0.5 / nMax); let {x, y} = ray.project(th); let [x1h, y1h] = canvas.grid.grid.getGridPositionFromPixels(x, y); - let [xgh, ygh] = canvas.grid.grid.getPixelsFromGridPosition(x1h, y1h); + let [xghtl, yghtl] = canvas.grid.grid.getPixelsFromGridPosition(x1h, y1h); + let [xgh, ygh] = canvas.grid.grid.getCenter(xghtl, yghtl); const pathUntilSpace = previousSegments.concat([{ray: new Ray(ray.A, {x: xgh, y: ygh})}]); const distance = sum(canvas.grid.measureDistances(pathUntilSpace, {gridSpaces: true})); const color = this.dragRulerGetColorForDistance(distance); From c1b0e9d7fb7a0c508d6fd45b3defc737b47ef8d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Tue, 12 Apr 2022 00:13:34 +0200 Subject: [PATCH 5/5] Release v1.12.8 --- CHANGELOG.md | 8 ++++++++ module.json | 4 ++-- rust/Cargo.lock | 2 +- rust/Cargo.toml | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cb3117..27aba04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.12.8 +### Bugfixes +- Fixed a bug that could cause grid cells to be highlighted in the wrong color + +### Compatibility +- Fixed an interaction with the Wall Height module that could allow players to walk through walls + + ## 1.12.7 ### Bugfixes - Fixed a bug that caused measurement templates to only snap to the corners of the grid (this was a regression introduced in 1.12.5) diff --git a/module.json b/module.json index fd5e372..690c6cb 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.12.7", + "version": "1.12.8", "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/releases/download/v1.12.7/drag-ruler-1.12.7.zip", + "download": "https://github.com/manuelVo/foundryvtt-drag-ruler/releases/download/v1.12.8/drag-ruler-1.12.8.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", diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 5251d1e..c0676ea 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -26,7 +26,7 @@ dependencies = [ [[package]] name = "gridless-pathfinding" -version = "1.12.7" +version = "1.12.8" dependencies = [ "console_error_panic_hook", "js-sys", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index da59dc2..226a9b6 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gridless-pathfinding" -version = "1.12.7" +version = "1.12.8" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html