refboard: route crop drag events through viewport

This commit is contained in:
Hiren Kangad
2026-03-13 11:41:03 +05:30
parent 8e23c3e884
commit e1b97d52f8
+8 -12
View File
@@ -234,22 +234,18 @@ export class CropOverlay extends Container {
this._removeDragListeners(); this._removeDragListeners();
this._boundMove = (ev: FederatedPointerEvent) => this._onMove(ev); this._boundMove = (ev: FederatedPointerEvent) => this._onMove(ev);
this._boundUp = () => this._onUp(); this._boundUp = () => this._onUp();
const stage = this._viewport.parent; this._viewport.on('globalpointermove', this._boundMove);
if (stage) { this._viewport.on('pointerup', this._boundUp);
stage.on('globalpointermove', this._boundMove); this._viewport.on('pointerupoutside', this._boundUp);
stage.on('pointerup', this._boundUp);
stage.on('pointerupoutside', this._boundUp);
}
} }
private _removeDragListeners(): void { private _removeDragListeners(): void {
const stage = this._viewport.parent; if (this._boundMove) {
if (stage) { this._viewport.off('globalpointermove', this._boundMove);
if (this._boundMove) stage.off('globalpointermove', this._boundMove);
if (this._boundUp) {
stage.off('pointerup', this._boundUp);
stage.off('pointerupoutside', this._boundUp);
} }
if (this._boundUp) {
this._viewport.off('pointerup', this._boundUp);
this._viewport.off('pointerupoutside', this._boundUp);
} }
this._boundMove = null; this._boundMove = null;
this._boundUp = null; this._boundUp = null;