Add a context menu entry that the gm can use to reset the movement history

This commit is contained in:
Manuel Vögele
2021-04-26 11:09:56 +02:00
parent 908600bfa3
commit 70b166d844
5 changed files with 24 additions and 2 deletions
+10 -1
View File
@@ -5,7 +5,7 @@ import {checkDependencies, getHexSizeSupportTokenGridCenter} from "./compatibili
import {moveTokens, onMouseMove} from "./foundry_imports.js"
import {performMigrations} from "./migration.js"
import {DragRulerRuler} from "./ruler.js";
import {getMovementHistory} from "./movement_tracking.js";
import {getMovementHistory, resetMovementHistory} from "./movement_tracking.js";
import {registerSettings, settingsKey} from "./settings.js"
import {SpeedProvider} from "./speed_provider.js"
@@ -42,6 +42,15 @@ Hooks.on("canvasReady", () => {
})
})
Hooks.on("getCombatTrackerEntryContext", function (html, menu) {
const entry = {
name: "drag-ruler.resetMovementHistory",
icon: '<i class="fas fa-undo-alt"></i>',
callback: li => resetMovementHistory(ui.combat.combat, li.data('combatant-id')),
};
menu.splice(1, 0, entry);
});
function hookTokenDragHandlers() {
const originalDragLeftStartHandler = Token.prototype._onDragLeftStart
Token.prototype._onDragLeftStart = function(event) {