Send the info whether the dragged entity is a token or a template to the other players (fixes a snapping issue in other players clients)

This commit is contained in:
Manuel Vögele
2021-05-26 16:17:23 +02:00
parent eef05553c0
commit 1328d52f94
+7 -1
View File
@@ -33,8 +33,11 @@ export class DragRulerRuler extends Ruler {
toJSON() {
const json = super.toJSON();
if (this.draggedEntity)
if (this.draggedEntity) {
const isToken = this.draggedEntity instanceof Token;
json["draggedEntityIsToken"] = isToken;
json["draggedEntity"] = this.draggedEntity.id;
}
return json;
}
@@ -44,7 +47,10 @@ export class DragRulerRuler extends Ruler {
return;
if (data.draggedEntity) {
if (data.draggedEntityIsToken)
this.draggedEntity = canvas.tokens.get(data.draggedEntity);
else
this.draggedEntity = canvas.templates.get(data.draggedEntity);
}
super.update(data);
}