Cancel scheudled measurements then the ruler is being cleared
This commit is contained in:
@@ -134,9 +134,7 @@ function scheduleMeasurement(destination, event) {
|
|||||||
this.measure(destination, {snap: !originalEvent.shiftKey});
|
this.measure(destination, {snap: !originalEvent.shiftKey});
|
||||||
event._measureTime = Date.now();
|
event._measureTime = Date.now();
|
||||||
this._state = Ruler.STATES.MEASURING;
|
this._state = Ruler.STATES.MEASURING;
|
||||||
window.clearTimeout(this.deferredMeasurementTimeout);
|
cancelScheduledMeasurement.call(this);
|
||||||
this.deferredMeasurementTimeout = undefined;
|
|
||||||
this.deferredMeasurementResolve?.();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.deferredMeasurementData = {destination, event};
|
this.deferredMeasurementData = {destination, event};
|
||||||
@@ -147,6 +145,12 @@ function scheduleMeasurement(destination, event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function cancelScheduledMeasurement() {
|
||||||
|
window.clearTimeout(this.deferredMeasurementTimeout);
|
||||||
|
this.deferredMeasurementTimeout = undefined;
|
||||||
|
this.deferredMeasurementResolve?.();
|
||||||
|
}
|
||||||
|
|
||||||
// This is a modified version of Ruler.measure form foundry 0.7.9
|
// This is a modified version of Ruler.measure form foundry 0.7.9
|
||||||
export function measure(destination, options={}) {
|
export function measure(destination, options={}) {
|
||||||
const isToken = this.draggedEntity instanceof Token;
|
const isToken = this.draggedEntity instanceof Token;
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
import {measure} from "./foundry_imports.js"
|
import {cancelScheduledMeasurement, measure} from "./foundry_imports.js"
|
||||||
import {getMovementHistory} from "./movement_tracking.js";
|
import {getMovementHistory} from "./movement_tracking.js";
|
||||||
import {settingsKey} from "./settings.js";
|
import {settingsKey} from "./settings.js";
|
||||||
import {getSnapPointForEntity, setSnapParameterOnOptions} from "./util.js";
|
import {getSnapPointForEntity, setSnapParameterOnOptions} from "./util.js";
|
||||||
@@ -16,6 +16,7 @@ export class DragRulerRuler extends Ruler {
|
|||||||
this.previousWaypoints = [];
|
this.previousWaypoints = [];
|
||||||
this.previousLabels.removeChildren().forEach(c => c.destroy());
|
this.previousLabels.removeChildren().forEach(c => c.destroy());
|
||||||
this.dragRulerRanges = undefined;
|
this.dragRulerRanges = undefined;
|
||||||
|
cancelScheduledMeasurement.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
async moveToken(event) {
|
async moveToken(event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user