@babylonjs/gui 5.0.0-alpha.60 → 5.0.0-alpha.64
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/advancedDynamicTexture.d.ts +153 -135
- package/2D/advancedDynamicTexture.js +258 -157
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/container.js +2 -2
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +66 -32
- package/2D/controls/control.js +180 -76
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/grid.d.ts +5 -3
- package/2D/controls/grid.js +48 -21
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/inputText.js +1 -1
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/stackPanel.d.ts +7 -1
- package/2D/controls/stackPanel.js +29 -7
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/textBlock.js +5 -5
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/math2D.d.ts +5 -0
- package/2D/math2D.js +12 -0
- package/2D/math2D.js.map +1 -1
- package/2D/valueAndUnit.d.ts +21 -6
- package/2D/valueAndUnit.js +57 -13
- package/2D/valueAndUnit.js.map +1 -1
- package/3D/controls/button3D.js +8 -1
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/control3D.d.ts +2 -0
- package/3D/controls/control3D.js +3 -0
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/holographicButton.js +9 -8
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.js +11 -6
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/nearMenu.js +1 -1
- package/3D/controls/nearMenu.js.map +1 -1
- package/3D/controls/touchHolographicButton.js +12 -12
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.js +13 -11
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/3D/gui3DManager.d.ts +10 -0
- package/3D/gui3DManager.js +43 -0
- package/3D/gui3DManager.js.map +1 -1
- package/package.json +2 -2
package/2D/controls/control.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
|
3
3
|
import { Vector2, Vector3, Matrix } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
-
import { PointerEventTypes } from
|
|
4
|
+
import { PointerEventTypes } from "@babylonjs/core/Events/pointerEvents.js";
|
|
5
5
|
import { Logger } from "@babylonjs/core/Misc/logger.js";
|
|
6
6
|
import { Tools } from "@babylonjs/core/Misc/tools.js";
|
|
7
7
|
import { ValueAndUnit } from "../valueAndUnit.js";
|
|
8
8
|
import { Measure } from "../measure.js";
|
|
9
9
|
import { Matrix2D, Vector2WithInfo } from "../math2D.js";
|
|
10
|
-
import { RegisterClass } from
|
|
11
|
-
import { SerializationHelper, serialize } from
|
|
10
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
11
|
+
import { SerializationHelper, serialize } from "@babylonjs/core/Misc/decorators.js";
|
|
12
12
|
import { Engine } from "@babylonjs/core/Engines/engine.js";
|
|
13
13
|
/**
|
|
14
14
|
* Root class used for all 2D controls
|
|
@@ -29,6 +29,8 @@ var Control = /** @class */ (function () {
|
|
|
29
29
|
this._zIndex = 0;
|
|
30
30
|
/** @hidden */
|
|
31
31
|
this._currentMeasure = Measure.Empty();
|
|
32
|
+
/** @hidden */
|
|
33
|
+
this._tempPaddingMeasure = Measure.Empty();
|
|
32
34
|
this._fontFamily = "Arial";
|
|
33
35
|
this._fontStyle = "";
|
|
34
36
|
this._fontWeight = "";
|
|
@@ -53,6 +55,7 @@ var Control = /** @class */ (function () {
|
|
|
53
55
|
this._prevCurrentMeasureTransformedIntoGlobalSpace = Measure.Empty();
|
|
54
56
|
/** @hidden */
|
|
55
57
|
this._cachedParentMeasure = Measure.Empty();
|
|
58
|
+
this._descendantsOnlyPadding = false;
|
|
56
59
|
this._paddingLeft = new ValueAndUnit(0);
|
|
57
60
|
this._paddingRight = new ValueAndUnit(0);
|
|
58
61
|
this._paddingTop = new ValueAndUnit(0);
|
|
@@ -83,6 +86,8 @@ var Control = /** @class */ (function () {
|
|
|
83
86
|
this._enterCount = -1;
|
|
84
87
|
this._doNotRender = false;
|
|
85
88
|
this._downPointerIds = {};
|
|
89
|
+
this._evaluatedMeasure = new Measure(0, 0, 0, 0);
|
|
90
|
+
this._evaluatedParentMeasure = new Measure(0, 0, 0, 0);
|
|
86
91
|
this._isEnabled = true;
|
|
87
92
|
this._disabledColor = "#9a9a9a";
|
|
88
93
|
this._disabledColorItem = "#6a6a6a";
|
|
@@ -123,7 +128,7 @@ var Control = /** @class */ (function () {
|
|
|
123
128
|
this._shadowOffsetY = 0;
|
|
124
129
|
this._shadowBlur = 0;
|
|
125
130
|
this._previousShadowBlur = 0;
|
|
126
|
-
this._shadowColor =
|
|
131
|
+
this._shadowColor = "black";
|
|
127
132
|
/** Gets or sets the cursor to use when the control is hovered */
|
|
128
133
|
this.hoverCursor = "";
|
|
129
134
|
/** @hidden */
|
|
@@ -131,36 +136,36 @@ var Control = /** @class */ (function () {
|
|
|
131
136
|
/** @hidden */
|
|
132
137
|
this._linkOffsetY = new ValueAndUnit(0);
|
|
133
138
|
/**
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
* An event triggered when pointer wheel is scrolled
|
|
140
|
+
*/
|
|
136
141
|
this.onWheelObservable = new Observable();
|
|
137
142
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
* An event triggered when the pointer moves over the control.
|
|
144
|
+
*/
|
|
140
145
|
this.onPointerMoveObservable = new Observable();
|
|
141
146
|
/**
|
|
142
|
-
|
|
143
|
-
|
|
147
|
+
* An event triggered when the pointer moves out of the control.
|
|
148
|
+
*/
|
|
144
149
|
this.onPointerOutObservable = new Observable();
|
|
145
150
|
/**
|
|
146
|
-
|
|
147
|
-
|
|
151
|
+
* An event triggered when the pointer taps the control
|
|
152
|
+
*/
|
|
148
153
|
this.onPointerDownObservable = new Observable();
|
|
149
154
|
/**
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
* An event triggered when pointer up
|
|
156
|
+
*/
|
|
152
157
|
this.onPointerUpObservable = new Observable();
|
|
153
158
|
/**
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
* An event triggered when a control is clicked on
|
|
160
|
+
*/
|
|
156
161
|
this.onPointerClickObservable = new Observable();
|
|
157
162
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
* An event triggered when pointer enters the control
|
|
164
|
+
*/
|
|
160
165
|
this.onPointerEnterObservable = new Observable();
|
|
161
166
|
/**
|
|
162
|
-
|
|
163
|
-
|
|
167
|
+
* An event triggered when the control is marked as dirty
|
|
168
|
+
*/
|
|
164
169
|
this.onDirtyObservable = new Observable();
|
|
165
170
|
/**
|
|
166
171
|
* An event triggered before drawing the control
|
|
@@ -171,8 +176,8 @@ var Control = /** @class */ (function () {
|
|
|
171
176
|
*/
|
|
172
177
|
this.onAfterDrawObservable = new Observable();
|
|
173
178
|
/**
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
* An event triggered when the control has been disposed
|
|
180
|
+
*/
|
|
176
181
|
this.onDisposeObservable = new Observable();
|
|
177
182
|
/**
|
|
178
183
|
* Gets or sets a fixed ratio for this control.
|
|
@@ -198,6 +203,16 @@ var Control = /** @class */ (function () {
|
|
|
198
203
|
enumerable: false,
|
|
199
204
|
configurable: true
|
|
200
205
|
});
|
|
206
|
+
Object.defineProperty(Control.prototype, "transformedMeasure", {
|
|
207
|
+
/**
|
|
208
|
+
* Gets the transformed measure, that is the bounding box of the control after applying all transformations
|
|
209
|
+
*/
|
|
210
|
+
get: function () {
|
|
211
|
+
return this._evaluatedMeasure;
|
|
212
|
+
},
|
|
213
|
+
enumerable: false,
|
|
214
|
+
configurable: true
|
|
215
|
+
});
|
|
201
216
|
Object.defineProperty(Control.prototype, "shadowOffsetX", {
|
|
202
217
|
/** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
|
|
203
218
|
get: function () {
|
|
@@ -366,7 +381,7 @@ var Control = /** @class */ (function () {
|
|
|
366
381
|
Object.defineProperty(Control.prototype, "scaleX", {
|
|
367
382
|
/** Gets or sets a value indicating the scale factor on X axis (1 by default)
|
|
368
383
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
369
|
-
|
|
384
|
+
*/
|
|
370
385
|
get: function () {
|
|
371
386
|
return this._scaleX;
|
|
372
387
|
},
|
|
@@ -384,7 +399,7 @@ var Control = /** @class */ (function () {
|
|
|
384
399
|
Object.defineProperty(Control.prototype, "scaleY", {
|
|
385
400
|
/** Gets or sets a value indicating the scale factor on Y axis (1 by default)
|
|
386
401
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
387
|
-
|
|
402
|
+
*/
|
|
388
403
|
get: function () {
|
|
389
404
|
return this._scaleY;
|
|
390
405
|
},
|
|
@@ -402,7 +417,7 @@ var Control = /** @class */ (function () {
|
|
|
402
417
|
Object.defineProperty(Control.prototype, "rotation", {
|
|
403
418
|
/** Gets or sets the rotation angle (0 by default)
|
|
404
419
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
405
|
-
|
|
420
|
+
*/
|
|
406
421
|
get: function () {
|
|
407
422
|
return this._rotation;
|
|
408
423
|
},
|
|
@@ -420,7 +435,7 @@ var Control = /** @class */ (function () {
|
|
|
420
435
|
Object.defineProperty(Control.prototype, "transformCenterY", {
|
|
421
436
|
/** Gets or sets the transformation center on Y axis (0 by default)
|
|
422
437
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
423
|
-
|
|
438
|
+
*/
|
|
424
439
|
get: function () {
|
|
425
440
|
return this._transformCenterY;
|
|
426
441
|
},
|
|
@@ -438,7 +453,7 @@ var Control = /** @class */ (function () {
|
|
|
438
453
|
Object.defineProperty(Control.prototype, "transformCenterX", {
|
|
439
454
|
/** Gets or sets the transformation center on X axis (0 by default)
|
|
440
455
|
* @see https://doc.babylonjs.com/how_to/gui#rotation-and-scaling
|
|
441
|
-
|
|
456
|
+
*/
|
|
442
457
|
get: function () {
|
|
443
458
|
return this._transformCenterX;
|
|
444
459
|
},
|
|
@@ -760,6 +775,24 @@ var Control = /** @class */ (function () {
|
|
|
760
775
|
enumerable: false,
|
|
761
776
|
configurable: true
|
|
762
777
|
});
|
|
778
|
+
Object.defineProperty(Control.prototype, "descendantsOnlyPadding", {
|
|
779
|
+
/**
|
|
780
|
+
* Gets or sets a value indicating the padding should work like in CSS.
|
|
781
|
+
* Basically, it will add the padding amount on each side of the parent control for its children.
|
|
782
|
+
*/
|
|
783
|
+
get: function () {
|
|
784
|
+
return this._descendantsOnlyPadding;
|
|
785
|
+
},
|
|
786
|
+
set: function (value) {
|
|
787
|
+
if (this._descendantsOnlyPadding === value) {
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
this._descendantsOnlyPadding = value;
|
|
791
|
+
this._markAsDirty();
|
|
792
|
+
},
|
|
793
|
+
enumerable: false,
|
|
794
|
+
configurable: true
|
|
795
|
+
});
|
|
763
796
|
Object.defineProperty(Control.prototype, "paddingLeft", {
|
|
764
797
|
/**
|
|
765
798
|
* Gets or sets a value indicating the padding to use on the left of the control
|
|
@@ -793,6 +826,17 @@ var Control = /** @class */ (function () {
|
|
|
793
826
|
enumerable: false,
|
|
794
827
|
configurable: true
|
|
795
828
|
});
|
|
829
|
+
Object.defineProperty(Control.prototype, "_paddingLeftInPixels", {
|
|
830
|
+
/** @hidden */
|
|
831
|
+
get: function () {
|
|
832
|
+
if (this._descendantsOnlyPadding) {
|
|
833
|
+
return 0;
|
|
834
|
+
}
|
|
835
|
+
return this.paddingLeftInPixels;
|
|
836
|
+
},
|
|
837
|
+
enumerable: false,
|
|
838
|
+
configurable: true
|
|
839
|
+
});
|
|
796
840
|
Object.defineProperty(Control.prototype, "paddingRight", {
|
|
797
841
|
/**
|
|
798
842
|
* Gets or sets a value indicating the padding to use on the right of the control
|
|
@@ -826,6 +870,17 @@ var Control = /** @class */ (function () {
|
|
|
826
870
|
enumerable: false,
|
|
827
871
|
configurable: true
|
|
828
872
|
});
|
|
873
|
+
Object.defineProperty(Control.prototype, "_paddingRightInPixels", {
|
|
874
|
+
/** @hidden */
|
|
875
|
+
get: function () {
|
|
876
|
+
if (this._descendantsOnlyPadding) {
|
|
877
|
+
return 0;
|
|
878
|
+
}
|
|
879
|
+
return this.paddingRightInPixels;
|
|
880
|
+
},
|
|
881
|
+
enumerable: false,
|
|
882
|
+
configurable: true
|
|
883
|
+
});
|
|
829
884
|
Object.defineProperty(Control.prototype, "paddingTop", {
|
|
830
885
|
/**
|
|
831
886
|
* Gets or sets a value indicating the padding to use on the top of the control
|
|
@@ -859,6 +914,17 @@ var Control = /** @class */ (function () {
|
|
|
859
914
|
enumerable: false,
|
|
860
915
|
configurable: true
|
|
861
916
|
});
|
|
917
|
+
Object.defineProperty(Control.prototype, "_paddingTopInPixels", {
|
|
918
|
+
/** @hidden */
|
|
919
|
+
get: function () {
|
|
920
|
+
if (this._descendantsOnlyPadding) {
|
|
921
|
+
return 0;
|
|
922
|
+
}
|
|
923
|
+
return this.paddingTopInPixels;
|
|
924
|
+
},
|
|
925
|
+
enumerable: false,
|
|
926
|
+
configurable: true
|
|
927
|
+
});
|
|
862
928
|
Object.defineProperty(Control.prototype, "paddingBottom", {
|
|
863
929
|
/**
|
|
864
930
|
* Gets or sets a value indicating the padding to use on the bottom of the control
|
|
@@ -892,6 +958,17 @@ var Control = /** @class */ (function () {
|
|
|
892
958
|
enumerable: false,
|
|
893
959
|
configurable: true
|
|
894
960
|
});
|
|
961
|
+
Object.defineProperty(Control.prototype, "_paddingBottomInPixels", {
|
|
962
|
+
/** @hidden */
|
|
963
|
+
get: function () {
|
|
964
|
+
if (this._descendantsOnlyPadding) {
|
|
965
|
+
return 0;
|
|
966
|
+
}
|
|
967
|
+
return this.paddingBottomInPixels;
|
|
968
|
+
},
|
|
969
|
+
enumerable: false,
|
|
970
|
+
configurable: true
|
|
971
|
+
});
|
|
895
972
|
Object.defineProperty(Control.prototype, "left", {
|
|
896
973
|
/**
|
|
897
974
|
* Gets or sets a value indicating the left coordinate of the control
|
|
@@ -1202,7 +1279,7 @@ var Control = /** @class */ (function () {
|
|
|
1202
1279
|
* @see https://doc.babylonjs.com/how_to/gui#tracking-positions
|
|
1203
1280
|
*/
|
|
1204
1281
|
Control.prototype.linkWithMesh = function (mesh) {
|
|
1205
|
-
if (!this._host || this.parent && this.parent !== this._host._rootContainer) {
|
|
1282
|
+
if (!this._host || (this.parent && this.parent !== this._host._rootContainer)) {
|
|
1206
1283
|
if (mesh) {
|
|
1207
1284
|
Tools.Error("Cannot link a control to a mesh if the control is not at root level");
|
|
1208
1285
|
}
|
|
@@ -1225,13 +1302,13 @@ var Control = /** @class */ (function () {
|
|
|
1225
1302
|
this._host._linkedControls.push(this);
|
|
1226
1303
|
};
|
|
1227
1304
|
/**
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1305
|
+
* Shorthand funtion to set the top, right, bottom, and left padding values on the control.
|
|
1306
|
+
* @param { string | number} paddingTop - The value of the top padding.
|
|
1307
|
+
* @param { string | number} paddingRight - The value of the right padding. If omitted, top is used.
|
|
1308
|
+
* @param { string | number} paddingBottom - The value of the bottom padding. If omitted, top is used.
|
|
1309
|
+
* @param { string | number} paddingLeft - The value of the left padding. If omitted, right is used.
|
|
1310
|
+
* @see https://doc.babylonjs.com/how_to/gui#position-and-size
|
|
1311
|
+
*/
|
|
1235
1312
|
Control.prototype.setPadding = function (paddingTop, paddingRight, paddingBottom, paddingLeft) {
|
|
1236
1313
|
var top = paddingTop;
|
|
1237
1314
|
var right = paddingRight !== null && paddingRight !== void 0 ? paddingRight : top;
|
|
@@ -1271,8 +1348,8 @@ var Control = /** @class */ (function () {
|
|
|
1271
1348
|
this._processMeasures(parentMeasure, this._host.getContext());
|
|
1272
1349
|
}
|
|
1273
1350
|
}
|
|
1274
|
-
var newLeft =
|
|
1275
|
-
var newTop =
|
|
1351
|
+
var newLeft = projectedPosition.x + this._linkOffsetX.getValue(this._host) - this._currentMeasure.width / 2;
|
|
1352
|
+
var newTop = projectedPosition.y + this._linkOffsetY.getValue(this._host) - this._currentMeasure.height / 2;
|
|
1276
1353
|
if (this._left.ignoreAdaptiveScaling && this._top.ignoreAdaptiveScaling) {
|
|
1277
1354
|
if (Math.abs(newLeft - oldLeft) < 0.5) {
|
|
1278
1355
|
newLeft = oldLeft;
|
|
@@ -1427,6 +1504,9 @@ var Control = /** @class */ (function () {
|
|
|
1427
1504
|
if (this._isFontSizeInPercentage) {
|
|
1428
1505
|
this._fontSet = true;
|
|
1429
1506
|
}
|
|
1507
|
+
if (this._host && this._host.useSmallestIdeal && !this._font) {
|
|
1508
|
+
this._fontSet = true;
|
|
1509
|
+
}
|
|
1430
1510
|
if (this._fontSet) {
|
|
1431
1511
|
this._prepareFont();
|
|
1432
1512
|
this._fontSet = false;
|
|
@@ -1441,7 +1521,7 @@ var Control = /** @class */ (function () {
|
|
|
1441
1521
|
context.globalAlpha *= this._alpha;
|
|
1442
1522
|
}
|
|
1443
1523
|
else if (this._alphaSet) {
|
|
1444
|
-
context.globalAlpha =
|
|
1524
|
+
context.globalAlpha = this.parent && !this.parent.renderToIntermediateTexture ? this.parent.alpha * this._alpha : this._alpha;
|
|
1445
1525
|
}
|
|
1446
1526
|
};
|
|
1447
1527
|
/** @hidden */
|
|
@@ -1451,7 +1531,7 @@ var Control = /** @class */ (function () {
|
|
|
1451
1531
|
}
|
|
1452
1532
|
if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
|
|
1453
1533
|
this.host._numLayoutCalls++;
|
|
1454
|
-
this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this.
|
|
1534
|
+
this._currentMeasure.addAndTransformToRef(this._transformMatrix, -this._paddingLeftInPixels | 0, -this._paddingTopInPixels | 0, this._paddingRightInPixels | 0, this._paddingBottomInPixels | 0, this._prevCurrentMeasureTransformedIntoGlobalSpace);
|
|
1455
1535
|
context.save();
|
|
1456
1536
|
this._applyStates(context);
|
|
1457
1537
|
var rebuildCount = 0;
|
|
@@ -1473,39 +1553,49 @@ var Control = /** @class */ (function () {
|
|
|
1473
1553
|
};
|
|
1474
1554
|
/** @hidden */
|
|
1475
1555
|
Control.prototype._processMeasures = function (parentMeasure, context) {
|
|
1476
|
-
this.
|
|
1556
|
+
this._tempPaddingMeasure.copyFrom(parentMeasure);
|
|
1557
|
+
// Apply padding if in correct mode
|
|
1558
|
+
if (this.parent && this.parent.descendantsOnlyPadding) {
|
|
1559
|
+
this._tempPaddingMeasure.left += this.parent.paddingLeftInPixels;
|
|
1560
|
+
this._tempPaddingMeasure.top += this.parent.paddingTopInPixels;
|
|
1561
|
+
this._tempPaddingMeasure.width -= this.parent.paddingLeftInPixels + this.parent.paddingRightInPixels;
|
|
1562
|
+
this._tempPaddingMeasure.height -= this.parent.paddingTopInPixels + this.parent.paddingBottomInPixels;
|
|
1563
|
+
}
|
|
1564
|
+
this._currentMeasure.copyFrom(this._tempPaddingMeasure);
|
|
1477
1565
|
// Let children take some pre-measurement actions
|
|
1478
|
-
this._preMeasure(
|
|
1566
|
+
this._preMeasure(this._tempPaddingMeasure, context);
|
|
1479
1567
|
this._measure();
|
|
1480
|
-
this._computeAlignment(
|
|
1568
|
+
this._computeAlignment(this._tempPaddingMeasure, context);
|
|
1481
1569
|
// Convert to int values
|
|
1482
1570
|
this._currentMeasure.left = this._currentMeasure.left | 0;
|
|
1483
1571
|
this._currentMeasure.top = this._currentMeasure.top | 0;
|
|
1484
1572
|
this._currentMeasure.width = this._currentMeasure.width | 0;
|
|
1485
1573
|
this._currentMeasure.height = this._currentMeasure.height | 0;
|
|
1486
1574
|
// Let children add more features
|
|
1487
|
-
this._additionalProcessing(
|
|
1488
|
-
this._cachedParentMeasure.copyFrom(
|
|
1575
|
+
this._additionalProcessing(this._tempPaddingMeasure, context);
|
|
1576
|
+
this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure);
|
|
1577
|
+
this._currentMeasure.transformToRef(this._transformMatrix, this._evaluatedMeasure);
|
|
1489
1578
|
if (this.onDirtyObservable.hasObservers()) {
|
|
1490
1579
|
this.onDirtyObservable.notifyObservers(this);
|
|
1491
1580
|
}
|
|
1492
1581
|
};
|
|
1493
1582
|
Control.prototype._evaluateClippingState = function (parentMeasure) {
|
|
1494
1583
|
if (this.parent && this.parent.clipChildren) {
|
|
1584
|
+
parentMeasure.transformToRef(this.parent._transformMatrix, this._evaluatedParentMeasure);
|
|
1495
1585
|
// Early clip
|
|
1496
|
-
if (this.
|
|
1586
|
+
if (this._evaluatedMeasure.left > this._evaluatedParentMeasure.left + this._evaluatedParentMeasure.width) {
|
|
1497
1587
|
this._isClipped = true;
|
|
1498
1588
|
return;
|
|
1499
1589
|
}
|
|
1500
|
-
if (this.
|
|
1590
|
+
if (this._evaluatedMeasure.left + this._evaluatedMeasure.width < this._evaluatedParentMeasure.left) {
|
|
1501
1591
|
this._isClipped = true;
|
|
1502
1592
|
return;
|
|
1503
1593
|
}
|
|
1504
|
-
if (this.
|
|
1594
|
+
if (this._evaluatedMeasure.top > this._evaluatedParentMeasure.top + this._evaluatedParentMeasure.height) {
|
|
1505
1595
|
this._isClipped = true;
|
|
1506
1596
|
return;
|
|
1507
1597
|
}
|
|
1508
|
-
if (this.
|
|
1598
|
+
if (this._evaluatedMeasure.top + this._evaluatedMeasure.height < this._evaluatedParentMeasure.top) {
|
|
1509
1599
|
this._isClipped = true;
|
|
1510
1600
|
return;
|
|
1511
1601
|
}
|
|
@@ -1567,33 +1657,35 @@ var Control = /** @class */ (function () {
|
|
|
1567
1657
|
y = (parentHeight - height) / 2;
|
|
1568
1658
|
break;
|
|
1569
1659
|
}
|
|
1570
|
-
if (this.
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1660
|
+
if (!this.descendantsOnlyPadding) {
|
|
1661
|
+
if (this._paddingLeft.isPixel) {
|
|
1662
|
+
this._currentMeasure.left += this._paddingLeft.getValue(this._host);
|
|
1663
|
+
this._currentMeasure.width -= this._paddingLeft.getValue(this._host);
|
|
1664
|
+
}
|
|
1665
|
+
else {
|
|
1666
|
+
this._currentMeasure.left += parentWidth * this._paddingLeft.getValue(this._host);
|
|
1667
|
+
this._currentMeasure.width -= parentWidth * this._paddingLeft.getValue(this._host);
|
|
1668
|
+
}
|
|
1669
|
+
if (this._paddingRight.isPixel) {
|
|
1670
|
+
this._currentMeasure.width -= this._paddingRight.getValue(this._host);
|
|
1671
|
+
}
|
|
1672
|
+
else {
|
|
1673
|
+
this._currentMeasure.width -= parentWidth * this._paddingRight.getValue(this._host);
|
|
1674
|
+
}
|
|
1675
|
+
if (this._paddingTop.isPixel) {
|
|
1676
|
+
this._currentMeasure.top += this._paddingTop.getValue(this._host);
|
|
1677
|
+
this._currentMeasure.height -= this._paddingTop.getValue(this._host);
|
|
1678
|
+
}
|
|
1679
|
+
else {
|
|
1680
|
+
this._currentMeasure.top += parentHeight * this._paddingTop.getValue(this._host);
|
|
1681
|
+
this._currentMeasure.height -= parentHeight * this._paddingTop.getValue(this._host);
|
|
1682
|
+
}
|
|
1683
|
+
if (this._paddingBottom.isPixel) {
|
|
1684
|
+
this._currentMeasure.height -= this._paddingBottom.getValue(this._host);
|
|
1685
|
+
}
|
|
1686
|
+
else {
|
|
1687
|
+
this._currentMeasure.height -= parentHeight * this._paddingBottom.getValue(this._host);
|
|
1688
|
+
}
|
|
1597
1689
|
}
|
|
1598
1690
|
if (this._left.isPixel) {
|
|
1599
1691
|
this._currentMeasure.left += this._left.getValue(this._host);
|
|
@@ -1747,7 +1839,8 @@ var Control = /** @class */ (function () {
|
|
|
1747
1839
|
if (this._enterCount > 0) {
|
|
1748
1840
|
return false;
|
|
1749
1841
|
}
|
|
1750
|
-
if (this._enterCount === -1) {
|
|
1842
|
+
if (this._enterCount === -1) {
|
|
1843
|
+
// -1 is for touch input, we are now sure we are with a mouse or pencil
|
|
1751
1844
|
this._enterCount = 0;
|
|
1752
1845
|
}
|
|
1753
1846
|
this._enterCount++;
|
|
@@ -1878,6 +1971,8 @@ var Control = /** @class */ (function () {
|
|
|
1878
1971
|
this._font = this._fontStyle + " " + this._fontWeight + " " + this.fontSizeInPixels + "px " + this._fontFamily;
|
|
1879
1972
|
}
|
|
1880
1973
|
this._fontOffset = Control._GetFontOffset(this._font);
|
|
1974
|
+
//children need to be refreshed
|
|
1975
|
+
this.getDescendants().forEach(function (child) { return child._markAllAsDirty(); });
|
|
1881
1976
|
};
|
|
1882
1977
|
/**
|
|
1883
1978
|
* Serializes the current control
|
|
@@ -2134,6 +2229,9 @@ var Control = /** @class */ (function () {
|
|
|
2134
2229
|
__decorate([
|
|
2135
2230
|
serialize()
|
|
2136
2231
|
], Control.prototype, "isVisible", null);
|
|
2232
|
+
__decorate([
|
|
2233
|
+
serialize()
|
|
2234
|
+
], Control.prototype, "descendantsOnlyPadding", null);
|
|
2137
2235
|
__decorate([
|
|
2138
2236
|
serialize()
|
|
2139
2237
|
], Control.prototype, "paddingLeft", null);
|
|
@@ -2167,6 +2265,12 @@ var Control = /** @class */ (function () {
|
|
|
2167
2265
|
__decorate([
|
|
2168
2266
|
serialize()
|
|
2169
2267
|
], Control.prototype, "disabledColorItem", null);
|
|
2268
|
+
__decorate([
|
|
2269
|
+
serialize()
|
|
2270
|
+
], Control.prototype, "overlapGroup", void 0);
|
|
2271
|
+
__decorate([
|
|
2272
|
+
serialize()
|
|
2273
|
+
], Control.prototype, "overlapDeltaMultiplier", void 0);
|
|
2170
2274
|
return Control;
|
|
2171
2275
|
}());
|
|
2172
2276
|
export { Control };
|