Calculate the correct snappig for measured templates when placing a waypoint

This commit is contained in:
Manuel Vögele
2021-05-21 14:41:33 +02:00
parent 3cbe41e2be
commit 4d2e4b7715
4 changed files with 15 additions and 8 deletions
+2 -5
View File
@@ -4,7 +4,7 @@ import {Line} from "./geometry.js";
import {getColorForDistance} from "./main.js"
import {trackRays} from "./movement_tracking.js"
import {recalculate} from "./socket.js";
import {applyTokenSizeOffset, getSnapPointForMeasuredTemplate, getSnapPointForToken, getTokenShape, highlightTokenShape, zip} from "./util.js";
import {applyTokenSizeOffset, getSnapPointForEntity, getSnapPointForToken, getTokenShape, highlightTokenShape, zip} from "./util.js";
// This is a modified version of Ruler.moveToken from foundry 0.7.9
export async function moveEntities(draggedEntity, selectedEntities) {
@@ -144,10 +144,7 @@ export function measure(destination, {gridSpaces=true, snap=false} = {}) {
return []
if (snap) {
if (isToken)
destination = getSnapPointForToken(destination.x, destination.y, this.draggedEntity);
else
destination = getSnapPointForMeasuredTemplate(destination.x, destination.y);
destination = getSnapPointForEntity(destination.x, destination.y, this.draggedEntity);
}
const terrainRulerAvailable = isToken && game.modules.get("terrain-ruler")?.active && (!game.modules.get("TerrainLayer")?.active || canvas.grid.type !== CONST.GRID_TYPES.GRIDLESS);