getSnappedPosition cannot be used on gridless to calculate the snap point for measured templates
This commit is contained in:
+8
-1
@@ -90,12 +90,19 @@ export function getSnapPointForTokenObj(pos, token) {
|
|||||||
return getSnapPointForToken(pos.x, pos.y, 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);
|
||||||
|
}
|
||||||
|
return canvas.grid.grid.getSnappedPosition(x, y, canvas.templates.gridPosition);
|
||||||
|
}
|
||||||
|
|
||||||
export function getSnapPointForEntity(x, y, entity) {
|
export function getSnapPointForEntity(x, y, entity) {
|
||||||
const isToken = entity instanceof Token;
|
const isToken = entity instanceof Token;
|
||||||
if (isToken)
|
if (isToken)
|
||||||
return getSnapPointForToken(x, y, entity);
|
return getSnapPointForToken(x, y, entity);
|
||||||
else
|
else
|
||||||
return canvas.grid.grid.getSnappedPosition(x, y, canvas.templates.gridPosition);
|
return getSnapPointForMeasuredTemplate(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function highlightTokenShape(position, shape, color, alpha) {
|
export function highlightTokenShape(position, shape, color, alpha) {
|
||||||
|
|||||||
Reference in New Issue
Block a user