diff --git a/js/main.js b/js/main.js index db65583..bd963de 100644 --- a/js/main.js +++ b/js/main.js @@ -7,7 +7,7 @@ import {disableSnap, registerKeybindings} from "./keybindings.js"; import {libWrapper} from "./libwrapper_shim.js"; import {performMigrations} from "./migration.js" import {removeLastHistoryEntryIfAt, resetMovementHistory} from "./movement_tracking.js"; -import {wipeGridlessPathfindingCache} from "./pathfinding.js"; +import {wipePathfindingCache} from "./pathfinding.js"; import {extendRuler} from "./ruler.js"; import {registerSettings, RightClickAction, settingsKey} from "./settings.js" import {recalculate} from "./socket.js"; @@ -20,11 +20,11 @@ CONFIG.debug.dragRuler = false; export let debugGraphics = undefined; initGridlessPathfinding().then(() => { - Hooks.on("canvasInit", wipeGridlessPathfindingCache); - Hooks.on("canvasReady", wipeGridlessPathfindingCache); - Hooks.on("createWall", wipeGridlessPathfindingCache); - Hooks.on("updateWall", wipeGridlessPathfindingCache); - Hooks.on("deleteWall", wipeGridlessPathfindingCache); + Hooks.on("canvasInit", wipePathfindingCache); + Hooks.on("canvasReady", wipePathfindingCache); + Hooks.on("createWall", wipePathfindingCache); + Hooks.on("updateWall", wipePathfindingCache); + Hooks.on("deleteWall", wipePathfindingCache); }); Hooks.once("init", () => { diff --git a/js/pathfinding.js b/js/pathfinding.js index af42785..fba9e6e 100644 --- a/js/pathfinding.js +++ b/js/pathfinding.js @@ -47,11 +47,8 @@ export function findPath(from, to, token, previousWaypoints) { } } -export function wipeGriddedPathfindingCache() { +export function wipePathfindingCache() { cachedNodes = undefined; -} - -export function wipeGridlessPathfindingCache() { if (gridlessPathfinder) { GridlessPathfinding.free(gridlessPathfinder); gridlessPathfinder = undefined; diff --git a/js/ruler.js b/js/ruler.js index d08bd55..9bc2e93 100644 --- a/js/ruler.js +++ b/js/ruler.js @@ -2,7 +2,6 @@ import {currentSpeedProvider, getColorForDistanceAndToken, getRangesFromSpeedPro import {getHexSizeSupportTokenGridCenter} from "./compatibility.js"; import {cancelScheduledMeasurement, measure} from "./foundry_imports.js" import {getMovementHistory} from "./movement_tracking.js"; -import {wipeGriddedPathfindingCache} from "./pathfinding.js"; import {settingsKey} from "./settings.js"; import {getSnapPointForEntity} from "./util.js"; @@ -187,7 +186,6 @@ export function extendRuler() { return; const ruler = canvas.controls.ruler; ruler.clear(); - wipeGriddedPathfindingCache(); ruler._state = Ruler.STATES.STARTING; let entityCenter; if (isToken && canvas.grid.isHex && game.modules.get("hex-size-support")?.active && CONFIG.hexSizeSupport.getAltSnappingFlag(entity))