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/js/foundry_imports.js b/js/foundry_imports.js index fa709c2..79a90b2 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) { @@ -341,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); @@ -355,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); 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