@babylonjs/gui 5.45.2 → 5.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2D/adtInstrumentation.js +21 -21
- package/2D/adtInstrumentation.js.map +1 -1
- package/2D/advancedDynamicTexture.d.ts +1 -1
- package/2D/advancedDynamicTexture.js +159 -159
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.js +12 -12
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/checkbox.js +17 -17
- package/2D/controls/checkbox.js.map +1 -1
- package/2D/controls/colorpicker.js +28 -28
- package/2D/controls/colorpicker.js.map +1 -1
- package/2D/controls/container.js +40 -40
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.js +191 -191
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/displayGrid.js +18 -18
- package/2D/controls/displayGrid.js.map +1 -1
- package/2D/controls/ellipse.js +9 -9
- package/2D/controls/ellipse.js.map +1 -1
- package/2D/controls/gradient/BaseGradient.d.ts +1 -1
- package/2D/controls/grid.js +14 -14
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.js +33 -33
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputText.js +57 -57
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js +34 -34
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/line.js +22 -22
- package/2D/controls/line.js.map +1 -1
- package/2D/controls/radioButton.js +17 -17
- package/2D/controls/radioButton.js.map +1 -1
- package/2D/controls/rectangle.js +10 -10
- package/2D/controls/rectangle.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.js +70 -70
- package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewerWindow.js +11 -11
- package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
- package/2D/controls/sliders/baseSlider.js +25 -25
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.js +9 -9
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.js +15 -15
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.js +13 -13
- package/2D/controls/sliders/scrollBar.js.map +1 -1
- package/2D/controls/sliders/slider.js +14 -14
- package/2D/controls/sliders/slider.js.map +1 -1
- package/2D/controls/stackPanel.js +17 -17
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/textBlock.js +35 -35
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/toggleButton.js +49 -49
- package/2D/controls/toggleButton.js.map +1 -1
- package/3D/controls/MRTK3/touchHolographicButton.js +127 -127
- package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
- package/3D/controls/container3D.js +12 -12
- package/3D/controls/container3D.js.map +1 -1
- package/3D/controls/control3D.js +41 -41
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/handMenu.js +11 -11
- package/3D/controls/handMenu.js.map +1 -1
- package/3D/controls/holographicBackplate.js +9 -9
- package/3D/controls/holographicBackplate.js.map +1 -1
- package/3D/controls/holographicButton.js +23 -23
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.js +34 -34
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/nearMenu.js +13 -13
- package/3D/controls/nearMenu.js.map +1 -1
- package/3D/controls/stackPanel3D.js +13 -13
- package/3D/controls/stackPanel3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.js +52 -52
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.js +8 -8
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/3D/controls/volumeBasedPanel.js +15 -15
- package/3D/controls/volumeBasedPanel.js.map +1 -1
- package/3D/gizmos/gizmoHandle.js +15 -15
- package/3D/gizmos/gizmoHandle.js.map +1 -1
- package/3D/gizmos/slateGizmo.js +29 -29
- package/3D/gizmos/slateGizmo.js.map +1 -1
- package/3D/gui3DManager.js +33 -33
- package/3D/gui3DManager.js.map +1 -1
- package/3D/materials/handle/handleMaterial.js +20 -20
- package/3D/materials/handle/handleMaterial.js.map +1 -1
- package/package.json +2 -2
package/2D/adtInstrumentation.js
CHANGED
@@ -3,27 +3,6 @@ import { PerfCounter } from "@babylonjs/core/Misc/perfCounter.js";
|
|
3
3
|
* This class can be used to get instrumentation data from a AdvancedDynamicTexture object
|
4
4
|
*/
|
5
5
|
export class AdvancedDynamicTextureInstrumentation {
|
6
|
-
/**
|
7
|
-
* Instantiates a new advanced dynamic texture instrumentation.
|
8
|
-
* This class can be used to get instrumentation data from an AdvancedDynamicTexture object
|
9
|
-
* @param texture Defines the AdvancedDynamicTexture to instrument
|
10
|
-
*/
|
11
|
-
constructor(
|
12
|
-
/**
|
13
|
-
* Define the instrumented AdvancedDynamicTexture.
|
14
|
-
*/
|
15
|
-
texture) {
|
16
|
-
this.texture = texture;
|
17
|
-
this._captureRenderTime = false;
|
18
|
-
this._renderTime = new PerfCounter();
|
19
|
-
this._captureLayoutTime = false;
|
20
|
-
this._layoutTime = new PerfCounter();
|
21
|
-
// Observers
|
22
|
-
this._onBeginRenderObserver = null;
|
23
|
-
this._onEndRenderObserver = null;
|
24
|
-
this._onBeginLayoutObserver = null;
|
25
|
-
this._onEndLayoutObserver = null;
|
26
|
-
}
|
27
6
|
// Properties
|
28
7
|
/**
|
29
8
|
* Gets the perf counter used to capture render time
|
@@ -89,6 +68,27 @@ export class AdvancedDynamicTextureInstrumentation {
|
|
89
68
|
this._onEndLayoutObserver = null;
|
90
69
|
}
|
91
70
|
}
|
71
|
+
/**
|
72
|
+
* Instantiates a new advanced dynamic texture instrumentation.
|
73
|
+
* This class can be used to get instrumentation data from an AdvancedDynamicTexture object
|
74
|
+
* @param texture Defines the AdvancedDynamicTexture to instrument
|
75
|
+
*/
|
76
|
+
constructor(
|
77
|
+
/**
|
78
|
+
* Define the instrumented AdvancedDynamicTexture.
|
79
|
+
*/
|
80
|
+
texture) {
|
81
|
+
this.texture = texture;
|
82
|
+
this._captureRenderTime = false;
|
83
|
+
this._renderTime = new PerfCounter();
|
84
|
+
this._captureLayoutTime = false;
|
85
|
+
this._layoutTime = new PerfCounter();
|
86
|
+
// Observers
|
87
|
+
this._onBeginRenderObserver = null;
|
88
|
+
this._onEndRenderObserver = null;
|
89
|
+
this._onBeginLayoutObserver = null;
|
90
|
+
this._onEndLayoutObserver = null;
|
91
|
+
}
|
92
92
|
/**
|
93
93
|
* Dispose and release associated resources.
|
94
94
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"adtInstrumentation.js","sourceRoot":"","sources":["../../../../lts/gui/generated/2D/adtInstrumentation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4CAA8B;AAKpD;;GAEG;AACH,MAAM,OAAO,qCAAqC;
|
1
|
+
{"version":3,"file":"adtInstrumentation.js","sourceRoot":"","sources":["../../../../lts/gui/generated/2D/adtInstrumentation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4CAA8B;AAKpD;;GAEG;AACH,MAAM,OAAO,qCAAqC;IAa9C,aAAa;IAEb;;OAEG;IACH,IAAW,iBAAiB;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAW,iBAAiB;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAW,iBAAiB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED,IAAW,iBAAiB,CAAC,KAAc;QACvC,IAAI,KAAK,KAAK,IAAI,CAAC,kBAAkB,EAAE;YACnC,OAAO;SACV;QAED,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAEhC,IAAI,KAAK,EAAE;YACP,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,G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/B,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { PerfCounter } from \"core/Misc/perfCounter\";\r\nimport type { IDisposable } from \"core/scene\";\r\n\r\nimport type { AdvancedDynamicTexture } from \"./advancedDynamicTexture\";\r\n\r\n/**\r\n * This class can be used to get instrumentation data from a AdvancedDynamicTexture object\r\n */\r\nexport class AdvancedDynamicTextureInstrumentation implements IDisposable {\r\n private _captureRenderTime = false;\r\n private _renderTime = new PerfCounter();\r\n\r\n private _captureLayoutTime = false;\r\n private _layoutTime = new PerfCounter();\r\n\r\n // Observers\r\n private _onBeginRenderObserver: Nullable<Observer<AdvancedDynamicTexture>> = null;\r\n private _onEndRenderObserver: Nullable<Observer<AdvancedDynamicTexture>> = null;\r\n private _onBeginLayoutObserver: Nullable<Observer<AdvancedDynamicTexture>> = null;\r\n private _onEndLayoutObserver: Nullable<Observer<AdvancedDynamicTexture>> = null;\r\n\r\n // Properties\r\n\r\n /**\r\n * Gets the perf counter used to capture render time\r\n */\r\n public get renderTimeCounter(): PerfCounter {\r\n return this._renderTime;\r\n }\r\n\r\n /**\r\n * Gets the perf counter used to capture layout time\r\n */\r\n public get layoutTimeCounter(): PerfCounter {\r\n return this._layoutTime;\r\n }\r\n\r\n /**\r\n * Enable or disable the render time capture\r\n */\r\n public get captureRenderTime(): boolean {\r\n return this._captureRenderTime;\r\n }\r\n\r\n public set captureRenderTime(value: boolean) {\r\n if (value === this._captureRenderTime) {\r\n return;\r\n }\r\n\r\n this._captureRenderTime = value;\r\n\r\n if (value) {\r\n this._onBeginRenderObserver = this.texture.onBeginRenderObservable.add(() => {\r\n this._renderTime.beginMonitoring();\r\n });\r\n\r\n this._onEndRenderObserver = this.texture.onEndRenderObservable.add(() => {\r\n this._renderTime.endMonitoring(true);\r\n });\r\n } else {\r\n this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver);\r\n this._onBeginRenderObserver = null;\r\n this.texture.onEndRenderObservable.remove(this._onEndRenderObserver);\r\n this._onEndRenderObserver = null;\r\n }\r\n }\r\n\r\n /**\r\n * Enable or disable the layout time capture\r\n */\r\n public get captureLayoutTime(): boolean {\r\n return this._captureLayoutTime;\r\n }\r\n\r\n public set captureLayoutTime(value: boolean) {\r\n if (value === this._captureLayoutTime) {\r\n return;\r\n }\r\n\r\n this._captureLayoutTime = value;\r\n\r\n if (value) {\r\n this._onBeginLayoutObserver = this.texture.onBeginLayoutObservable.add(() => {\r\n this._layoutTime.beginMonitoring();\r\n });\r\n\r\n this._onEndLayoutObserver = this.texture.onEndLayoutObservable.add(() => {\r\n this._layoutTime.endMonitoring(true);\r\n });\r\n } else {\r\n this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver);\r\n this._onBeginLayoutObserver = null;\r\n this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver);\r\n this._onEndLayoutObserver = null;\r\n }\r\n }\r\n /**\r\n * Instantiates a new advanced dynamic texture instrumentation.\r\n * This class can be used to get instrumentation data from an AdvancedDynamicTexture object\r\n * @param texture Defines the AdvancedDynamicTexture to instrument\r\n */\r\n public constructor(\r\n /**\r\n * Define the instrumented AdvancedDynamicTexture.\r\n */\r\n public texture: AdvancedDynamicTexture\r\n ) {}\r\n\r\n /**\r\n * Dispose and release associated resources.\r\n */\r\n public dispose() {\r\n this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver);\r\n this._onBeginRenderObserver = null;\r\n this.texture.onEndRenderObservable.remove(this._onEndRenderObserver);\r\n this._onEndRenderObserver = null;\r\n this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver);\r\n this._onBeginLayoutObserver = null;\r\n this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver);\r\n this._onEndLayoutObserver = null;\r\n\r\n (<any>this.texture) = null;\r\n }\r\n}\r\n"]}
|
@@ -401,7 +401,7 @@ export declare class AdvancedDynamicTexture extends DynamicTexture {
|
|
401
401
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
402
402
|
* @deprecated Please use parseSerializedObject instead
|
403
403
|
*/
|
404
|
-
parseContent: (serializedObject: any, scaleToSize?: boolean
|
404
|
+
parseContent: (serializedObject: any, scaleToSize?: boolean) => void;
|
405
405
|
/**
|
406
406
|
* Recreate the content of the ADT from a snippet saved by the GUI editor
|
407
407
|
* @param snippetId defines the snippet to load
|
@@ -23,165 +23,6 @@ import { DecodeBase64ToBinary } from "@babylonjs/core/Misc/stringTools.js";
|
|
23
23
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui
|
24
24
|
*/
|
25
25
|
export class AdvancedDynamicTexture extends DynamicTexture {
|
26
|
-
/**
|
27
|
-
* Creates a new AdvancedDynamicTexture
|
28
|
-
* @param name defines the name of the texture
|
29
|
-
* @param width defines the width of the texture
|
30
|
-
* @param height defines the height of the texture
|
31
|
-
* @param scene defines the hosting scene
|
32
|
-
* @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
|
33
|
-
* @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
|
34
|
-
* @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
|
35
|
-
*/
|
36
|
-
constructor(name, width = 0, height = 0, scene, generateMipMaps = false, samplingMode = Texture.NEAREST_SAMPLINGMODE, invertY = true) {
|
37
|
-
super(name, { width: width, height: height }, scene, generateMipMaps, samplingMode, Constants.TEXTUREFORMAT_RGBA, invertY);
|
38
|
-
/** Observable that fires when the GUI is ready */
|
39
|
-
this.onGuiReadyObservable = new Observable();
|
40
|
-
this._isDirty = false;
|
41
|
-
/** @internal */
|
42
|
-
this._rootContainer = new Container("root");
|
43
|
-
/** @internal */
|
44
|
-
this._lastControlOver = {};
|
45
|
-
/** @internal */
|
46
|
-
this._lastControlDown = {};
|
47
|
-
/** @internal */
|
48
|
-
this._capturingControl = {};
|
49
|
-
/** @internal */
|
50
|
-
this._linkedControls = new Array();
|
51
|
-
this._isFullscreen = false;
|
52
|
-
this._fullscreenViewport = new Viewport(0, 0, 1, 1);
|
53
|
-
this._idealWidth = 0;
|
54
|
-
this._idealHeight = 0;
|
55
|
-
this._useSmallestIdeal = false;
|
56
|
-
this._renderAtIdealSize = false;
|
57
|
-
this._blockNextFocusCheck = false;
|
58
|
-
this._renderScale = 1;
|
59
|
-
this._cursorChanged = false;
|
60
|
-
this._defaultMousePointerId = 0;
|
61
|
-
this._rootChildrenHaveChanged = false;
|
62
|
-
/** @internal */
|
63
|
-
this._capturedPointerIds = new Set();
|
64
|
-
/** @internal */
|
65
|
-
this._numLayoutCalls = 0;
|
66
|
-
/** @internal */
|
67
|
-
this._numRenderCalls = 0;
|
68
|
-
/**
|
69
|
-
* Define type to string to ensure compatibility across browsers
|
70
|
-
* Safari doesn't support DataTransfer constructor
|
71
|
-
*/
|
72
|
-
this._clipboardData = "";
|
73
|
-
/**
|
74
|
-
* Observable event triggered each time an clipboard event is received from the rendering canvas
|
75
|
-
*/
|
76
|
-
this.onClipboardObservable = new Observable();
|
77
|
-
/**
|
78
|
-
* Observable event triggered each time a pointer down is intercepted by a control
|
79
|
-
*/
|
80
|
-
this.onControlPickedObservable = new Observable();
|
81
|
-
/**
|
82
|
-
* Observable event triggered before layout is evaluated
|
83
|
-
*/
|
84
|
-
this.onBeginLayoutObservable = new Observable();
|
85
|
-
/**
|
86
|
-
* Observable event triggered after the layout was evaluated
|
87
|
-
*/
|
88
|
-
this.onEndLayoutObservable = new Observable();
|
89
|
-
/**
|
90
|
-
* Observable event triggered before the texture is rendered
|
91
|
-
*/
|
92
|
-
this.onBeginRenderObservable = new Observable();
|
93
|
-
/**
|
94
|
-
* Observable event triggered after the texture was rendered
|
95
|
-
*/
|
96
|
-
this.onEndRenderObservable = new Observable();
|
97
|
-
/**
|
98
|
-
* Gets or sets a boolean defining if alpha is stored as premultiplied
|
99
|
-
*/
|
100
|
-
this.premulAlpha = false;
|
101
|
-
/**
|
102
|
-
* Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture
|
103
|
-
*/
|
104
|
-
this.applyYInversionOnUpdate = true;
|
105
|
-
/**
|
106
|
-
* If set to true, every scene render will trigger a pointer event for the GUI
|
107
|
-
* if it is linked to a mesh or has controls linked to a mesh. This will allow
|
108
|
-
* you to catch the pointer moving around the GUI due to camera or mesh movements,
|
109
|
-
* but it has a performance cost.
|
110
|
-
*/
|
111
|
-
this.checkPointerEveryFrame = false;
|
112
|
-
this._useInvalidateRectOptimization = true;
|
113
|
-
// Invalidated rectangle which is the combination of all invalidated controls after they have been rotated into absolute position
|
114
|
-
this._invalidatedRectangle = null;
|
115
|
-
this._clearMeasure = new Measure(0, 0, 0, 0);
|
116
|
-
/**
|
117
|
-
* @internal
|
118
|
-
*/
|
119
|
-
this._onClipboardCopy = (rawEvt) => {
|
120
|
-
const evt = rawEvt;
|
121
|
-
const ev = new ClipboardInfo(ClipboardEventTypes.COPY, evt);
|
122
|
-
this.onClipboardObservable.notifyObservers(ev);
|
123
|
-
evt.preventDefault();
|
124
|
-
};
|
125
|
-
/**
|
126
|
-
* @internal
|
127
|
-
*/
|
128
|
-
this._onClipboardCut = (rawEvt) => {
|
129
|
-
const evt = rawEvt;
|
130
|
-
const ev = new ClipboardInfo(ClipboardEventTypes.CUT, evt);
|
131
|
-
this.onClipboardObservable.notifyObservers(ev);
|
132
|
-
evt.preventDefault();
|
133
|
-
};
|
134
|
-
/**
|
135
|
-
* @internal
|
136
|
-
*/
|
137
|
-
this._onClipboardPaste = (rawEvt) => {
|
138
|
-
const evt = rawEvt;
|
139
|
-
const ev = new ClipboardInfo(ClipboardEventTypes.PASTE, evt);
|
140
|
-
this.onClipboardObservable.notifyObservers(ev);
|
141
|
-
evt.preventDefault();
|
142
|
-
};
|
143
|
-
/**
|
144
|
-
* Recreate the content of the ADT from a JSON object
|
145
|
-
* @param serializedObject define the JSON serialized object to restore from
|
146
|
-
* @param scaleToSize defines whether to scale to texture to the saved size
|
147
|
-
* @deprecated Please use parseSerializedObject instead
|
148
|
-
*/
|
149
|
-
this.parseContent = this.parseSerializedObject;
|
150
|
-
scene = this.getScene();
|
151
|
-
if (!scene || !this._texture) {
|
152
|
-
return;
|
153
|
-
}
|
154
|
-
this.applyYInversionOnUpdate = invertY;
|
155
|
-
this._rootElement = scene.getEngine().getInputElement();
|
156
|
-
this._renderObserver = scene.onBeforeCameraRenderObservable.add((camera) => this._checkUpdate(camera));
|
157
|
-
/** Whenever a control is added or removed to the root, we have to recheck the camera projection as it can have changed */
|
158
|
-
this._controlAddedObserver = this._rootContainer.onControlAddedObservable.add((control) => {
|
159
|
-
if (control) {
|
160
|
-
this._rootChildrenHaveChanged = true;
|
161
|
-
}
|
162
|
-
});
|
163
|
-
this._controlRemovedObserver = this._rootContainer.onControlRemovedObservable.add((control) => {
|
164
|
-
if (control) {
|
165
|
-
this._rootChildrenHaveChanged = true;
|
166
|
-
}
|
167
|
-
});
|
168
|
-
this._preKeyboardObserver = scene.onPreKeyboardObservable.add((info) => {
|
169
|
-
if (!this._focusedControl) {
|
170
|
-
return;
|
171
|
-
}
|
172
|
-
if (info.type === KeyboardEventTypes.KEYDOWN) {
|
173
|
-
this._focusedControl.processKeyboard(info.event);
|
174
|
-
}
|
175
|
-
info.skipOnPointerObservable = true;
|
176
|
-
});
|
177
|
-
this._rootContainer._link(this);
|
178
|
-
this.hasAlpha = true;
|
179
|
-
if (!width || !height) {
|
180
|
-
this._resizeObserver = scene.getEngine().onResizeObservable.add(() => this._onResize());
|
181
|
-
this._onResize();
|
182
|
-
}
|
183
|
-
this._texture.isReady = true;
|
184
|
-
}
|
185
26
|
/** Gets the number of layout calls made the last time the ADT has been rendered */
|
186
27
|
get numLayoutCalls() {
|
187
28
|
return this._numLayoutCalls;
|
@@ -395,6 +236,165 @@ export class AdvancedDynamicTexture extends DynamicTexture {
|
|
395
236
|
set clipboardData(value) {
|
396
237
|
this._clipboardData = value;
|
397
238
|
}
|
239
|
+
/**
|
240
|
+
* Creates a new AdvancedDynamicTexture
|
241
|
+
* @param name defines the name of the texture
|
242
|
+
* @param width defines the width of the texture
|
243
|
+
* @param height defines the height of the texture
|
244
|
+
* @param scene defines the hosting scene
|
245
|
+
* @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
|
246
|
+
* @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
|
247
|
+
* @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
|
248
|
+
*/
|
249
|
+
constructor(name, width = 0, height = 0, scene, generateMipMaps = false, samplingMode = Texture.NEAREST_SAMPLINGMODE, invertY = true) {
|
250
|
+
super(name, { width: width, height: height }, scene, generateMipMaps, samplingMode, Constants.TEXTUREFORMAT_RGBA, invertY);
|
251
|
+
/** Observable that fires when the GUI is ready */
|
252
|
+
this.onGuiReadyObservable = new Observable();
|
253
|
+
this._isDirty = false;
|
254
|
+
/** @internal */
|
255
|
+
this._rootContainer = new Container("root");
|
256
|
+
/** @internal */
|
257
|
+
this._lastControlOver = {};
|
258
|
+
/** @internal */
|
259
|
+
this._lastControlDown = {};
|
260
|
+
/** @internal */
|
261
|
+
this._capturingControl = {};
|
262
|
+
/** @internal */
|
263
|
+
this._linkedControls = new Array();
|
264
|
+
this._isFullscreen = false;
|
265
|
+
this._fullscreenViewport = new Viewport(0, 0, 1, 1);
|
266
|
+
this._idealWidth = 0;
|
267
|
+
this._idealHeight = 0;
|
268
|
+
this._useSmallestIdeal = false;
|
269
|
+
this._renderAtIdealSize = false;
|
270
|
+
this._blockNextFocusCheck = false;
|
271
|
+
this._renderScale = 1;
|
272
|
+
this._cursorChanged = false;
|
273
|
+
this._defaultMousePointerId = 0;
|
274
|
+
this._rootChildrenHaveChanged = false;
|
275
|
+
/** @internal */
|
276
|
+
this._capturedPointerIds = new Set();
|
277
|
+
/** @internal */
|
278
|
+
this._numLayoutCalls = 0;
|
279
|
+
/** @internal */
|
280
|
+
this._numRenderCalls = 0;
|
281
|
+
/**
|
282
|
+
* Define type to string to ensure compatibility across browsers
|
283
|
+
* Safari doesn't support DataTransfer constructor
|
284
|
+
*/
|
285
|
+
this._clipboardData = "";
|
286
|
+
/**
|
287
|
+
* Observable event triggered each time an clipboard event is received from the rendering canvas
|
288
|
+
*/
|
289
|
+
this.onClipboardObservable = new Observable();
|
290
|
+
/**
|
291
|
+
* Observable event triggered each time a pointer down is intercepted by a control
|
292
|
+
*/
|
293
|
+
this.onControlPickedObservable = new Observable();
|
294
|
+
/**
|
295
|
+
* Observable event triggered before layout is evaluated
|
296
|
+
*/
|
297
|
+
this.onBeginLayoutObservable = new Observable();
|
298
|
+
/**
|
299
|
+
* Observable event triggered after the layout was evaluated
|
300
|
+
*/
|
301
|
+
this.onEndLayoutObservable = new Observable();
|
302
|
+
/**
|
303
|
+
* Observable event triggered before the texture is rendered
|
304
|
+
*/
|
305
|
+
this.onBeginRenderObservable = new Observable();
|
306
|
+
/**
|
307
|
+
* Observable event triggered after the texture was rendered
|
308
|
+
*/
|
309
|
+
this.onEndRenderObservable = new Observable();
|
310
|
+
/**
|
311
|
+
* Gets or sets a boolean defining if alpha is stored as premultiplied
|
312
|
+
*/
|
313
|
+
this.premulAlpha = false;
|
314
|
+
/**
|
315
|
+
* Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture
|
316
|
+
*/
|
317
|
+
this.applyYInversionOnUpdate = true;
|
318
|
+
/**
|
319
|
+
* If set to true, every scene render will trigger a pointer event for the GUI
|
320
|
+
* if it is linked to a mesh or has controls linked to a mesh. This will allow
|
321
|
+
* you to catch the pointer moving around the GUI due to camera or mesh movements,
|
322
|
+
* but it has a performance cost.
|
323
|
+
*/
|
324
|
+
this.checkPointerEveryFrame = false;
|
325
|
+
this._useInvalidateRectOptimization = true;
|
326
|
+
// Invalidated rectangle which is the combination of all invalidated controls after they have been rotated into absolute position
|
327
|
+
this._invalidatedRectangle = null;
|
328
|
+
this._clearMeasure = new Measure(0, 0, 0, 0);
|
329
|
+
/**
|
330
|
+
* @internal
|
331
|
+
*/
|
332
|
+
this._onClipboardCopy = (rawEvt) => {
|
333
|
+
const evt = rawEvt;
|
334
|
+
const ev = new ClipboardInfo(ClipboardEventTypes.COPY, evt);
|
335
|
+
this.onClipboardObservable.notifyObservers(ev);
|
336
|
+
evt.preventDefault();
|
337
|
+
};
|
338
|
+
/**
|
339
|
+
* @internal
|
340
|
+
*/
|
341
|
+
this._onClipboardCut = (rawEvt) => {
|
342
|
+
const evt = rawEvt;
|
343
|
+
const ev = new ClipboardInfo(ClipboardEventTypes.CUT, evt);
|
344
|
+
this.onClipboardObservable.notifyObservers(ev);
|
345
|
+
evt.preventDefault();
|
346
|
+
};
|
347
|
+
/**
|
348
|
+
* @internal
|
349
|
+
*/
|
350
|
+
this._onClipboardPaste = (rawEvt) => {
|
351
|
+
const evt = rawEvt;
|
352
|
+
const ev = new ClipboardInfo(ClipboardEventTypes.PASTE, evt);
|
353
|
+
this.onClipboardObservable.notifyObservers(ev);
|
354
|
+
evt.preventDefault();
|
355
|
+
};
|
356
|
+
/**
|
357
|
+
* Recreate the content of the ADT from a JSON object
|
358
|
+
* @param serializedObject define the JSON serialized object to restore from
|
359
|
+
* @param scaleToSize defines whether to scale to texture to the saved size
|
360
|
+
* @deprecated Please use parseSerializedObject instead
|
361
|
+
*/
|
362
|
+
this.parseContent = this.parseSerializedObject;
|
363
|
+
scene = this.getScene();
|
364
|
+
if (!scene || !this._texture) {
|
365
|
+
return;
|
366
|
+
}
|
367
|
+
this.applyYInversionOnUpdate = invertY;
|
368
|
+
this._rootElement = scene.getEngine().getInputElement();
|
369
|
+
this._renderObserver = scene.onBeforeCameraRenderObservable.add((camera) => this._checkUpdate(camera));
|
370
|
+
/** Whenever a control is added or removed to the root, we have to recheck the camera projection as it can have changed */
|
371
|
+
this._controlAddedObserver = this._rootContainer.onControlAddedObservable.add((control) => {
|
372
|
+
if (control) {
|
373
|
+
this._rootChildrenHaveChanged = true;
|
374
|
+
}
|
375
|
+
});
|
376
|
+
this._controlRemovedObserver = this._rootContainer.onControlRemovedObservable.add((control) => {
|
377
|
+
if (control) {
|
378
|
+
this._rootChildrenHaveChanged = true;
|
379
|
+
}
|
380
|
+
});
|
381
|
+
this._preKeyboardObserver = scene.onPreKeyboardObservable.add((info) => {
|
382
|
+
if (!this._focusedControl) {
|
383
|
+
return;
|
384
|
+
}
|
385
|
+
if (info.type === KeyboardEventTypes.KEYDOWN) {
|
386
|
+
this._focusedControl.processKeyboard(info.event);
|
387
|
+
}
|
388
|
+
info.skipOnPointerObservable = true;
|
389
|
+
});
|
390
|
+
this._rootContainer._link(this);
|
391
|
+
this.hasAlpha = true;
|
392
|
+
if (!width || !height) {
|
393
|
+
this._resizeObserver = scene.getEngine().onResizeObservable.add(() => this._onResize());
|
394
|
+
this._onResize();
|
395
|
+
}
|
396
|
+
this._texture.isReady = true;
|
397
|
+
}
|
398
398
|
/**
|
399
399
|
* Get the current class name of the texture useful for serialization or dynamic coding.
|
400
400
|
* @returns "AdvancedDynamicTexture"
|