refboard: route crop drag events through viewport
This commit is contained in:
@@ -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) {
|
if (this._boundUp) {
|
||||||
stage.off('pointerup', this._boundUp);
|
this._viewport.off('pointerup', this._boundUp);
|
||||||
stage.off('pointerupoutside', this._boundUp);
|
this._viewport.off('pointerupoutside', this._boundUp);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this._boundMove = null;
|
this._boundMove = null;
|
||||||
this._boundUp = null;
|
this._boundUp = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user