|
@@ -56,6 +56,7 @@ export class AdvancedDynamicTexture extends DynamicTexture {
|
|
|
private _pointerMoveObserver: Nullable<Observer<PointerInfoPre>>;
|
|
|
private _pointerObserver: Nullable<Observer<PointerInfo>>;
|
|
|
private _canvasPointerOutObserver: Nullable<Observer<PointerEvent>>;
|
|
|
+ private _canvasBlurObserver: Nullable<Observer<Engine>>;
|
|
|
private _background: string;
|
|
|
/** @hidden */
|
|
|
public _rootContainer = new Container("root");
|
|
@@ -480,6 +481,9 @@ export class AdvancedDynamicTexture extends DynamicTexture {
|
|
|
if (this._canvasPointerOutObserver) {
|
|
|
scene.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver);
|
|
|
}
|
|
|
+ if (this._canvasBlurObserver) {
|
|
|
+ scene.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver);
|
|
|
+ }
|
|
|
if (this._layerToDispose) {
|
|
|
this._layerToDispose.texture = null;
|
|
|
this._layerToDispose.dispose();
|
|
@@ -741,6 +745,7 @@ export class AdvancedDynamicTexture extends DynamicTexture {
|
|
|
}
|
|
|
});
|
|
|
this._attachToOnPointerOut(scene);
|
|
|
+ this._attachToOnBlur(scene);
|
|
|
}
|
|
|
/** @hidden */
|
|
|
private onClipboardCopy = (rawEvt: Event) => {
|
|
@@ -838,6 +843,7 @@ export class AdvancedDynamicTexture extends DynamicTexture {
|
|
|
});
|
|
|
mesh.enablePointerMoveEvents = supportPointerMove;
|
|
|
this._attachToOnPointerOut(scene);
|
|
|
+ this._attachToOnBlur(scene);
|
|
|
}
|
|
|
/**
|
|
|
* Move the focus to a specific control
|
|
@@ -876,6 +882,14 @@ export class AdvancedDynamicTexture extends DynamicTexture {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ private _attachToOnBlur(scene: Scene): void {
|
|
|
+ this._canvasBlurObserver = scene.getEngine().onCanvasBlurObservable.add((pointerEvent) => {
|
|
|
+ Object.entries(this._lastControlDown).forEach(([key, value]) => {
|
|
|
+ value._onCanvasBlur();
|
|
|
+ });
|
|
|
+ this._lastControlDown = {};
|
|
|
+ });
|
|
|
+ }
|
|
|
// Statics
|
|
|
/**
|
|
|
* Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
|