diff --git a/CHANGELOG.md b/CHANGELOG.md index d76b31e..aa49637 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.12.5 +### Compatibility +- Drag Ruler is now compatible with DF Template Enhancements + + ## 1.12.4 ### Bugfixes - Fixed a bug that could cause Drag Ruler to override the default ruler color on other player's clients diff --git a/js/util.js b/js/util.js index 3937442..faafaad 100644 --- a/js/util.js +++ b/js/util.js @@ -90,35 +90,12 @@ export function getSnapPointForTokenObj(pos, token) { return getSnapPointForToken(pos.x, pos.y, token); } -export function getSnapPointForMeasuredTemplate(x, y) { - if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS) { - return new PIXI.Point(x, y); - } - let subgridWidth, subgridHeight; - if (canvas.grid.type === CONST.GRID_TYPES.SQUARE) { - subgridWidth = subgridHeight = canvas.dimensions.size / 2; - } - else { - if (canvas.grid.grid.columns) { - subgridWidth = canvas.grid.w / 4; - subgridHeight = canvas.grid.h / 2; - } - else { - subgridWidth = canvas.grid.w / 2; - subgridHeight = canvas.grid.h / 4; - } - } - const snappedX = Math.round(x / subgridWidth) * subgridWidth; - const snappedY = Math.round(y / subgridHeight) * subgridHeight; - return new PIXI.Point(snappedX, snappedY); -} - export function getSnapPointForEntity(x, y, entity) { const isToken = entity instanceof Token; if (isToken) return getSnapPointForToken(x, y, entity); else - return getSnapPointForMeasuredTemplate(x, y); + return canvas.grid.grid.getSnappedPosition(x, y, canvas.templates.gridPosition); } export function highlightTokenShape(position, shape, color, alpha) { diff --git a/module.json b/module.json index 4ee968b..30d48e6 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.4", + "version": "1.12.5", "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.4/drag-ruler-1.12.4.zip", + "download": "https://github.com/manuelVo/foundryvtt-drag-ruler/releases/download/v1.12.5/drag-ruler-1.12.5.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 84b5b45..42c749f 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -26,7 +26,7 @@ dependencies = [ [[package]] name = "gridless-pathfinding" -version = "1.12.4" +version = "1.12.5" dependencies = [ "console_error_panic_hook", "js-sys", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 184f58f..891c0f5 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gridless-pathfinding" -version = "1.12.4" +version = "1.12.5" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html