babylonjs-gui 5.41.0 → 5.42.1
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/babylon.gui.d.ts +15 -0
- package/babylon.gui.js +121 -43
- package/babylon.gui.js.map +1 -1
- package/babylon.gui.min.js +1 -1
- package/babylon.gui.min.js.map +1 -1
- package/babylon.gui.module.d.ts +30 -0
- package/package.json +2 -2
package/babylon.gui.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ declare module BABYLON.GUI {
|
|
|
72
72
|
private _canvasPointerOutObserver;
|
|
73
73
|
private _canvasBlurObserver;
|
|
74
74
|
private _controlAddedObserver;
|
|
75
|
+
private _controlRemovedObserver;
|
|
75
76
|
private _background;
|
|
76
77
|
/** @internal */
|
|
77
78
|
_rootContainer: Container;
|
|
@@ -107,6 +108,7 @@ declare module BABYLON.GUI {
|
|
|
107
108
|
private _rootElement;
|
|
108
109
|
private _cursorChanged;
|
|
109
110
|
private _defaultMousePointerId;
|
|
111
|
+
private _rootChildrenHaveChanged;
|
|
110
112
|
/** @internal */
|
|
111
113
|
_capturedPointerIds: Set<number>;
|
|
112
114
|
/** @internal */
|
|
@@ -2063,6 +2065,10 @@ declare module BABYLON.GUI {
|
|
|
2063
2065
|
private _populateNinePatchSlicesFromImage;
|
|
2064
2066
|
private _detectPointerOnOpaqueOnly;
|
|
2065
2067
|
private _imageDataCache;
|
|
2068
|
+
static SourceImgCache: Map<string, {
|
|
2069
|
+
img: BABYLON.IImage;
|
|
2070
|
+
timesUsed: number;
|
|
2071
|
+
}>;
|
|
2066
2072
|
/**
|
|
2067
2073
|
* BABYLON.Observable notified when the content is loaded
|
|
2068
2074
|
*/
|
|
@@ -2169,6 +2175,11 @@ declare module BABYLON.GUI {
|
|
|
2169
2175
|
* Gets the image source url
|
|
2170
2176
|
*/
|
|
2171
2177
|
get source(): BABYLON.Nullable<string>;
|
|
2178
|
+
/**
|
|
2179
|
+
* Resets the internal Image Element cache. Can reduce memory usage.
|
|
2180
|
+
*/
|
|
2181
|
+
static ResetImageCache(): void;
|
|
2182
|
+
private _removeCacheUsage;
|
|
2172
2183
|
/**
|
|
2173
2184
|
* Gets or sets image source url
|
|
2174
2185
|
*/
|
|
@@ -2430,6 +2441,10 @@ declare module BABYLON.GUI {
|
|
|
2430
2441
|
_onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
|
|
2431
2442
|
_onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
|
|
2432
2443
|
protected _beforeRenderText(textWrapper: TextWrapper): TextWrapper;
|
|
2444
|
+
/** @internal */
|
|
2445
|
+
private set isTextHighlightOn(value);
|
|
2446
|
+
/** @internal */
|
|
2447
|
+
private get isTextHighlightOn();
|
|
2433
2448
|
dispose(): void;
|
|
2434
2449
|
}
|
|
2435
2450
|
|
package/babylon.gui.js
CHANGED
|
@@ -522,6 +522,7 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
522
522
|
_this._renderScale = 1;
|
|
523
523
|
_this._cursorChanged = false;
|
|
524
524
|
_this._defaultMousePointerId = 0;
|
|
525
|
+
_this._rootChildrenHaveChanged = false;
|
|
525
526
|
/** @internal */
|
|
526
527
|
_this._capturedPointerIds = new Set();
|
|
527
528
|
/** @internal */
|
|
@@ -617,9 +618,15 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
617
618
|
_this.applyYInversionOnUpdate = invertY;
|
|
618
619
|
_this._rootElement = scene.getEngine().getInputElement();
|
|
619
620
|
_this._renderObserver = scene.onBeforeCameraRenderObservable.add(function (camera) { return _this._checkUpdate(camera); });
|
|
621
|
+
/** Whenever a control is added or removed to the root, we have to recheck the camera projection as it can have changed */
|
|
620
622
|
_this._controlAddedObserver = _this._rootContainer.onControlAddedObservable.add(function (control) {
|
|
621
|
-
if (control
|
|
622
|
-
_this.
|
|
623
|
+
if (control) {
|
|
624
|
+
_this._rootChildrenHaveChanged = true;
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
_this._controlRemovedObserver = _this._rootContainer.onControlRemovedObservable.add(function (control) {
|
|
628
|
+
if (control) {
|
|
629
|
+
_this._rootChildrenHaveChanged = true;
|
|
623
630
|
}
|
|
624
631
|
});
|
|
625
632
|
_this._preKeyboardObserver = scene.onPreKeyboardObservable.add(function (info) {
|
|
@@ -1081,6 +1088,9 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1081
1088
|
if (this._controlAddedObserver) {
|
|
1082
1089
|
this._rootContainer.onControlAddedObservable.remove(this._controlAddedObserver);
|
|
1083
1090
|
}
|
|
1091
|
+
if (this._controlRemovedObserver) {
|
|
1092
|
+
this._rootContainer.onControlRemovedObservable.remove(this._controlRemovedObserver);
|
|
1093
|
+
}
|
|
1084
1094
|
if (this._layerToDispose) {
|
|
1085
1095
|
this._layerToDispose.texture = null;
|
|
1086
1096
|
this._layerToDispose.dispose();
|
|
@@ -1161,7 +1171,7 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1161
1171
|
var projectedPosition = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Vector3.Project(position, worldMatrix, scene.getTransformMatrix(), globalViewport);
|
|
1162
1172
|
return new core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Vector3(projectedPosition.x, projectedPosition.y, projectedPosition.z);
|
|
1163
1173
|
};
|
|
1164
|
-
AdvancedDynamicTexture.prototype._checkUpdate = function (camera) {
|
|
1174
|
+
AdvancedDynamicTexture.prototype._checkUpdate = function (camera, skipUpdate) {
|
|
1165
1175
|
if (this._layerToDispose) {
|
|
1166
1176
|
if ((camera.layerMask & this._layerToDispose.layerMask) === 0) {
|
|
1167
1177
|
return;
|
|
@@ -1206,16 +1216,27 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1206
1216
|
return;
|
|
1207
1217
|
}
|
|
1208
1218
|
this._isDirty = false;
|
|
1209
|
-
this._render();
|
|
1210
|
-
|
|
1219
|
+
this._render(skipUpdate);
|
|
1220
|
+
if (!skipUpdate) {
|
|
1221
|
+
this.update(this.applyYInversionOnUpdate, this.premulAlpha, AdvancedDynamicTexture.AllowGPUOptimizations);
|
|
1222
|
+
}
|
|
1211
1223
|
};
|
|
1212
|
-
AdvancedDynamicTexture.prototype._render = function () {
|
|
1224
|
+
AdvancedDynamicTexture.prototype._render = function (skipRender) {
|
|
1225
|
+
var _a;
|
|
1213
1226
|
var textureSize = this.getSize();
|
|
1214
1227
|
var renderWidth = textureSize.width;
|
|
1215
1228
|
var renderHeight = textureSize.height;
|
|
1216
1229
|
var context = this.getContext();
|
|
1217
1230
|
context.font = "18px Arial";
|
|
1218
1231
|
context.strokeStyle = "white";
|
|
1232
|
+
/** We have to recheck the camera projection in the case the root control's children have changed */
|
|
1233
|
+
if (this._rootChildrenHaveChanged) {
|
|
1234
|
+
var camera = (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.activeCamera;
|
|
1235
|
+
if (camera) {
|
|
1236
|
+
this._rootChildrenHaveChanged = false;
|
|
1237
|
+
this._checkUpdate(camera, true);
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1219
1240
|
// Layout
|
|
1220
1241
|
this.onBeginLayoutObservable.notifyObservers(this);
|
|
1221
1242
|
var measure = new _measure__WEBPACK_IMPORTED_MODULE_5__.Measure(0, 0, renderWidth, renderHeight);
|
|
@@ -1223,6 +1244,9 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1223
1244
|
this._rootContainer._layout(measure, context);
|
|
1224
1245
|
this.onEndLayoutObservable.notifyObservers(this);
|
|
1225
1246
|
this._isDirty = false; // Restoring the dirty state that could have been set by controls during layout processing
|
|
1247
|
+
if (skipRender) {
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1226
1250
|
// Clear
|
|
1227
1251
|
if (this._invalidatedRectangle) {
|
|
1228
1252
|
this._clearMeasure.copyFrom(this._invalidatedRectangle);
|
|
@@ -5859,6 +5883,9 @@ var Control = /** @class */ (function () {
|
|
|
5859
5883
|
newTop = oldTop;
|
|
5860
5884
|
}
|
|
5861
5885
|
}
|
|
5886
|
+
if (oldLeft === newLeft && oldTop === newTop) {
|
|
5887
|
+
return;
|
|
5888
|
+
}
|
|
5862
5889
|
this.left = newLeft + "px";
|
|
5863
5890
|
this.top = newTop + "px";
|
|
5864
5891
|
this._left.ignoreAdaptiveScaling = true;
|
|
@@ -8406,6 +8433,7 @@ var Image = /** @class */ (function (_super) {
|
|
|
8406
8433
|
if (this._source === value) {
|
|
8407
8434
|
return;
|
|
8408
8435
|
}
|
|
8436
|
+
this._removeCacheUsage(this._source);
|
|
8409
8437
|
this._loaded = false;
|
|
8410
8438
|
this._source = value;
|
|
8411
8439
|
this._imageDataCache.data = null;
|
|
@@ -8417,7 +8445,17 @@ var Image = /** @class */ (function (_super) {
|
|
|
8417
8445
|
if (!engine) {
|
|
8418
8446
|
throw new Error("Invalid engine. Unable to create a canvas.");
|
|
8419
8447
|
}
|
|
8448
|
+
if (value && Image.SourceImgCache.has(value)) {
|
|
8449
|
+
var cachedData = Image.SourceImgCache.get(value);
|
|
8450
|
+
this._domImage = cachedData.img;
|
|
8451
|
+
cachedData.timesUsed += 1;
|
|
8452
|
+
this._onImageLoaded();
|
|
8453
|
+
return;
|
|
8454
|
+
}
|
|
8420
8455
|
this._domImage = engine.createCanvasImage();
|
|
8456
|
+
if (value) {
|
|
8457
|
+
Image.SourceImgCache.set(value, { img: this._domImage, timesUsed: 1 });
|
|
8458
|
+
}
|
|
8421
8459
|
this._domImage.onload = function () {
|
|
8422
8460
|
_this._onImageLoaded();
|
|
8423
8461
|
};
|
|
@@ -8430,6 +8468,22 @@ var Image = /** @class */ (function (_super) {
|
|
|
8430
8468
|
enumerable: false,
|
|
8431
8469
|
configurable: true
|
|
8432
8470
|
});
|
|
8471
|
+
/**
|
|
8472
|
+
* Resets the internal Image Element cache. Can reduce memory usage.
|
|
8473
|
+
*/
|
|
8474
|
+
Image.ResetImageCache = function () {
|
|
8475
|
+
Image.SourceImgCache.clear();
|
|
8476
|
+
};
|
|
8477
|
+
Image.prototype._removeCacheUsage = function (source) {
|
|
8478
|
+
var value = source && Image.SourceImgCache.get(source);
|
|
8479
|
+
if (value) {
|
|
8480
|
+
value.timesUsed -= 1;
|
|
8481
|
+
// Since the image isn't being used anymore, we can clean it from the cache
|
|
8482
|
+
if (value.timesUsed === 0) {
|
|
8483
|
+
Image.SourceImgCache.delete(source);
|
|
8484
|
+
}
|
|
8485
|
+
}
|
|
8486
|
+
};
|
|
8433
8487
|
/**
|
|
8434
8488
|
* Checks for svg document with icon id present
|
|
8435
8489
|
* @param value
|
|
@@ -8764,7 +8818,9 @@ var Image = /** @class */ (function (_super) {
|
|
|
8764
8818
|
_super.prototype.dispose.call(this);
|
|
8765
8819
|
this.onImageLoadedObservable.clear();
|
|
8766
8820
|
this.onSVGAttributesComputedObservable.clear();
|
|
8821
|
+
this._removeCacheUsage(this._source);
|
|
8767
8822
|
};
|
|
8823
|
+
Image.SourceImgCache = new Map();
|
|
8768
8824
|
// Static
|
|
8769
8825
|
/** STRETCH_NONE */
|
|
8770
8826
|
Image.STRETCH_NONE = 0;
|
|
@@ -9494,10 +9550,10 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9494
9550
|
case 8: // BACKSPACE
|
|
9495
9551
|
if (this._textWrapper.text && this._textWrapper.length > 0) {
|
|
9496
9552
|
//delete the highlighted text
|
|
9497
|
-
if (this.
|
|
9553
|
+
if (this.isTextHighlightOn) {
|
|
9498
9554
|
this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex);
|
|
9499
9555
|
this._textHasChanged();
|
|
9500
|
-
this.
|
|
9556
|
+
this.isTextHighlightOn = false;
|
|
9501
9557
|
this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;
|
|
9502
9558
|
this._blinkIsEven = false;
|
|
9503
9559
|
if (evt) {
|
|
@@ -9522,10 +9578,10 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9522
9578
|
}
|
|
9523
9579
|
return;
|
|
9524
9580
|
case 46: // DELETE
|
|
9525
|
-
if (this.
|
|
9581
|
+
if (this.isTextHighlightOn) {
|
|
9526
9582
|
this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex);
|
|
9527
9583
|
this._textHasChanged();
|
|
9528
|
-
this.
|
|
9584
|
+
this.isTextHighlightOn = false;
|
|
9529
9585
|
this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;
|
|
9530
9586
|
if (evt) {
|
|
9531
9587
|
evt.preventDefault();
|
|
@@ -9544,18 +9600,18 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9544
9600
|
return;
|
|
9545
9601
|
case 13: // RETURN
|
|
9546
9602
|
this._host.focusedControl = null;
|
|
9547
|
-
this.
|
|
9603
|
+
this.isTextHighlightOn = false;
|
|
9548
9604
|
return;
|
|
9549
9605
|
case 35: // END
|
|
9550
9606
|
this._cursorOffset = 0;
|
|
9551
9607
|
this._blinkIsEven = false;
|
|
9552
|
-
this.
|
|
9608
|
+
this.isTextHighlightOn = false;
|
|
9553
9609
|
this._markAsDirty();
|
|
9554
9610
|
return;
|
|
9555
9611
|
case 36: // HOME
|
|
9556
9612
|
this._cursorOffset = this._textWrapper.length;
|
|
9557
9613
|
this._blinkIsEven = false;
|
|
9558
|
-
this.
|
|
9614
|
+
this.isTextHighlightOn = false;
|
|
9559
9615
|
this._markAsDirty();
|
|
9560
9616
|
return;
|
|
9561
9617
|
case 37: // LEFT
|
|
@@ -9568,7 +9624,7 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9568
9624
|
this._blinkIsEven = false;
|
|
9569
9625
|
// shift + ctrl/cmd + <-
|
|
9570
9626
|
if (evt.ctrlKey || evt.metaKey) {
|
|
9571
|
-
if (!this.
|
|
9627
|
+
if (!this.isTextHighlightOn) {
|
|
9572
9628
|
if (this._textWrapper.length === this._cursorOffset) {
|
|
9573
9629
|
return;
|
|
9574
9630
|
}
|
|
@@ -9579,13 +9635,13 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9579
9635
|
this._startHighlightIndex = 0;
|
|
9580
9636
|
this._cursorIndex = this._textWrapper.length - this._endHighlightIndex;
|
|
9581
9637
|
this._cursorOffset = this._textWrapper.length;
|
|
9582
|
-
this.
|
|
9638
|
+
this.isTextHighlightOn = true;
|
|
9583
9639
|
this._markAsDirty();
|
|
9584
9640
|
return;
|
|
9585
9641
|
}
|
|
9586
9642
|
//store the starting point
|
|
9587
|
-
if (!this.
|
|
9588
|
-
this.
|
|
9643
|
+
if (!this.isTextHighlightOn) {
|
|
9644
|
+
this.isTextHighlightOn = true;
|
|
9589
9645
|
this._cursorIndex = this._cursorOffset >= this._textWrapper.length ? this._textWrapper.length : this._cursorOffset - 1;
|
|
9590
9646
|
}
|
|
9591
9647
|
//if text is already highlighted
|
|
@@ -9603,21 +9659,21 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9603
9659
|
this._startHighlightIndex = this._textWrapper.length - this._cursorIndex;
|
|
9604
9660
|
}
|
|
9605
9661
|
else {
|
|
9606
|
-
this.
|
|
9662
|
+
this.isTextHighlightOn = false;
|
|
9607
9663
|
}
|
|
9608
9664
|
this._markAsDirty();
|
|
9609
9665
|
return;
|
|
9610
9666
|
}
|
|
9611
|
-
if (this.
|
|
9667
|
+
if (this.isTextHighlightOn) {
|
|
9612
9668
|
this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;
|
|
9613
|
-
this.
|
|
9669
|
+
this.isTextHighlightOn = false;
|
|
9614
9670
|
}
|
|
9615
9671
|
if (evt && (evt.ctrlKey || evt.metaKey)) {
|
|
9616
9672
|
this._cursorOffset = this._textWrapper.length;
|
|
9617
9673
|
evt.preventDefault();
|
|
9618
9674
|
}
|
|
9619
9675
|
this._blinkIsEven = false;
|
|
9620
|
-
this.
|
|
9676
|
+
this.isTextHighlightOn = false;
|
|
9621
9677
|
this._cursorIndex = -1;
|
|
9622
9678
|
this._markAsDirty();
|
|
9623
9679
|
return;
|
|
@@ -9631,7 +9687,7 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9631
9687
|
this._blinkIsEven = false;
|
|
9632
9688
|
//shift + ctrl/cmd + ->
|
|
9633
9689
|
if (evt.ctrlKey || evt.metaKey) {
|
|
9634
|
-
if (!this.
|
|
9690
|
+
if (!this.isTextHighlightOn) {
|
|
9635
9691
|
if (this._cursorOffset === 0) {
|
|
9636
9692
|
return;
|
|
9637
9693
|
}
|
|
@@ -9640,14 +9696,14 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9640
9696
|
}
|
|
9641
9697
|
}
|
|
9642
9698
|
this._endHighlightIndex = this._textWrapper.length;
|
|
9643
|
-
this.
|
|
9699
|
+
this.isTextHighlightOn = true;
|
|
9644
9700
|
this._cursorIndex = this._textWrapper.length - this._startHighlightIndex;
|
|
9645
9701
|
this._cursorOffset = 0;
|
|
9646
9702
|
this._markAsDirty();
|
|
9647
9703
|
return;
|
|
9648
9704
|
}
|
|
9649
|
-
if (!this.
|
|
9650
|
-
this.
|
|
9705
|
+
if (!this.isTextHighlightOn) {
|
|
9706
|
+
this.isTextHighlightOn = true;
|
|
9651
9707
|
this._cursorIndex = this._cursorOffset <= 0 ? 0 : this._cursorOffset + 1;
|
|
9652
9708
|
}
|
|
9653
9709
|
//if text is already highlighted
|
|
@@ -9665,14 +9721,14 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9665
9721
|
this._startHighlightIndex = this._textWrapper.length - this._cursorIndex;
|
|
9666
9722
|
}
|
|
9667
9723
|
else {
|
|
9668
|
-
this.
|
|
9724
|
+
this.isTextHighlightOn = false;
|
|
9669
9725
|
}
|
|
9670
9726
|
this._markAsDirty();
|
|
9671
9727
|
return;
|
|
9672
9728
|
}
|
|
9673
|
-
if (this.
|
|
9729
|
+
if (this.isTextHighlightOn) {
|
|
9674
9730
|
this._cursorOffset = this._textWrapper.length - this._endHighlightIndex;
|
|
9675
|
-
this.
|
|
9731
|
+
this.isTextHighlightOn = false;
|
|
9676
9732
|
}
|
|
9677
9733
|
//ctr + ->
|
|
9678
9734
|
if (evt && (evt.ctrlKey || evt.metaKey)) {
|
|
@@ -9680,7 +9736,7 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9680
9736
|
evt.preventDefault();
|
|
9681
9737
|
}
|
|
9682
9738
|
this._blinkIsEven = false;
|
|
9683
|
-
this.
|
|
9739
|
+
this.isTextHighlightOn = false;
|
|
9684
9740
|
this._cursorIndex = -1;
|
|
9685
9741
|
this._markAsDirty();
|
|
9686
9742
|
return;
|
|
@@ -9705,11 +9761,11 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9705
9761
|
this.onBeforeKeyAddObservable.notifyObservers(this);
|
|
9706
9762
|
key = this._currentKey;
|
|
9707
9763
|
if (this._addKey && !this._deadKey) {
|
|
9708
|
-
if (this.
|
|
9764
|
+
if (this.isTextHighlightOn) {
|
|
9709
9765
|
this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex, key);
|
|
9710
9766
|
this._textHasChanged();
|
|
9711
9767
|
this._cursorOffset = this._textWrapper.length - (this._startHighlightIndex + 1);
|
|
9712
|
-
this.
|
|
9768
|
+
this.isTextHighlightOn = false;
|
|
9713
9769
|
this._blinkIsEven = false;
|
|
9714
9770
|
this._markAsDirty();
|
|
9715
9771
|
}
|
|
@@ -9743,12 +9799,12 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9743
9799
|
this._startHighlightIndex = this._textWrapper.length - this._cursorIndex;
|
|
9744
9800
|
}
|
|
9745
9801
|
else {
|
|
9746
|
-
this.
|
|
9802
|
+
this.isTextHighlightOn = false;
|
|
9747
9803
|
this._markAsDirty();
|
|
9748
9804
|
return;
|
|
9749
9805
|
}
|
|
9750
9806
|
}
|
|
9751
|
-
this.
|
|
9807
|
+
this.isTextHighlightOn = true;
|
|
9752
9808
|
this._markAsDirty();
|
|
9753
9809
|
};
|
|
9754
9810
|
/**
|
|
@@ -9765,8 +9821,7 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9765
9821
|
moveLeft = this._startHighlightIndex > 0 && this._textWrapper.isWord(this._startHighlightIndex - 1) ? --this._startHighlightIndex : 0;
|
|
9766
9822
|
} while (moveLeft || moveRight);
|
|
9767
9823
|
this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;
|
|
9768
|
-
this.
|
|
9769
|
-
this._isTextHighlightOn = true;
|
|
9824
|
+
this.isTextHighlightOn = true;
|
|
9770
9825
|
this._clickedCoordinate = null;
|
|
9771
9826
|
this._blinkIsEven = true;
|
|
9772
9827
|
this._cursorIndex = -1;
|
|
@@ -9775,7 +9830,7 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9775
9830
|
/** @internal */
|
|
9776
9831
|
InputText.prototype._selectAllText = function () {
|
|
9777
9832
|
this._blinkIsEven = true;
|
|
9778
|
-
this.
|
|
9833
|
+
this.isTextHighlightOn = true;
|
|
9779
9834
|
this._startHighlightIndex = 0;
|
|
9780
9835
|
this._endHighlightIndex = this._textWrapper.length;
|
|
9781
9836
|
this._cursorOffset = this._textWrapper.length;
|
|
@@ -9795,7 +9850,7 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9795
9850
|
* @internal
|
|
9796
9851
|
*/
|
|
9797
9852
|
InputText.prototype._onCopyText = function (ev) {
|
|
9798
|
-
this.
|
|
9853
|
+
this.isTextHighlightOn = false;
|
|
9799
9854
|
//when write permission to clipbaord data is denied
|
|
9800
9855
|
try {
|
|
9801
9856
|
ev.clipboardData && ev.clipboardData.setData("text/plain", this._highlightedText);
|
|
@@ -9812,7 +9867,7 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9812
9867
|
}
|
|
9813
9868
|
this._textWrapper.removePart(this._startHighlightIndex, this._endHighlightIndex);
|
|
9814
9869
|
this._textHasChanged();
|
|
9815
|
-
this.
|
|
9870
|
+
this.isTextHighlightOn = false;
|
|
9816
9871
|
this._cursorOffset = this._textWrapper.length - this._startHighlightIndex;
|
|
9817
9872
|
//when write permission to clipbaord data is denied
|
|
9818
9873
|
try {
|
|
@@ -9940,7 +9995,7 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9940
9995
|
cursorLeft = clipTextLeft + availableWidth;
|
|
9941
9996
|
this._markAsDirty();
|
|
9942
9997
|
}
|
|
9943
|
-
if (!this.
|
|
9998
|
+
if (!this.isTextHighlightOn) {
|
|
9944
9999
|
context.fillRect(cursorLeft, this._currentMeasure.top + (this._currentMeasure.height - this._fontOffset.height) / 2, 2, this._fontOffset.height);
|
|
9945
10000
|
}
|
|
9946
10001
|
}
|
|
@@ -9950,7 +10005,7 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9950
10005
|
_this._markAsDirty();
|
|
9951
10006
|
}, 500);
|
|
9952
10007
|
//show the highlighted text
|
|
9953
|
-
if (this.
|
|
10008
|
+
if (this.isTextHighlightOn) {
|
|
9954
10009
|
clearTimeout(this._blinkTimeout);
|
|
9955
10010
|
var highlightCursorOffsetWidth = context.measureText(text.substring(this._startHighlightIndex)).width;
|
|
9956
10011
|
var highlightCursorLeft = this._scrollLeft + this._textWidth - highlightCursorOffsetWidth;
|
|
@@ -9998,7 +10053,7 @@ var InputText = /** @class */ (function (_super) {
|
|
|
9998
10053
|
return true;
|
|
9999
10054
|
}
|
|
10000
10055
|
this._clickedCoordinate = coordinates.x;
|
|
10001
|
-
this.
|
|
10056
|
+
this.isTextHighlightOn = false;
|
|
10002
10057
|
this._highlightedText = "";
|
|
10003
10058
|
this._cursorIndex = -1;
|
|
10004
10059
|
this._isPointerDown = true;
|
|
@@ -10032,6 +10087,24 @@ var InputText = /** @class */ (function (_super) {
|
|
|
10032
10087
|
InputText.prototype._beforeRenderText = function (textWrapper) {
|
|
10033
10088
|
return textWrapper;
|
|
10034
10089
|
};
|
|
10090
|
+
Object.defineProperty(InputText.prototype, "isTextHighlightOn", {
|
|
10091
|
+
/** @internal */
|
|
10092
|
+
get: function () {
|
|
10093
|
+
return this._isTextHighlightOn;
|
|
10094
|
+
},
|
|
10095
|
+
/** @internal */
|
|
10096
|
+
set: function (value) {
|
|
10097
|
+
if (this._isTextHighlightOn === value) {
|
|
10098
|
+
return;
|
|
10099
|
+
}
|
|
10100
|
+
if (value) {
|
|
10101
|
+
this.onTextHighlightObservable.notifyObservers(this);
|
|
10102
|
+
}
|
|
10103
|
+
this._isTextHighlightOn = value;
|
|
10104
|
+
},
|
|
10105
|
+
enumerable: false,
|
|
10106
|
+
configurable: true
|
|
10107
|
+
});
|
|
10035
10108
|
InputText.prototype.dispose = function () {
|
|
10036
10109
|
_super.prototype.dispose.call(this);
|
|
10037
10110
|
this.onBlurObservable.clear();
|
|
@@ -21961,6 +22034,10 @@ var Slider3D = /** @class */ (function (_super) {
|
|
|
21961
22034
|
sliderBackplate.visibility = 0;
|
|
21962
22035
|
sliderBackplate.scaling = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Vector3(1, 0.5, 0.8);
|
|
21963
22036
|
core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.SceneLoader.ImportMeshAsync(undefined, Slider3D.MODEL_BASE_URL, Slider3D.MODEL_FILENAME, scene).then(function (result) {
|
|
22037
|
+
// make all meshes not pickable. Required meshes' pickable state will be set later.
|
|
22038
|
+
result.meshes.forEach(function (m) {
|
|
22039
|
+
m.isPickable = false;
|
|
22040
|
+
});
|
|
21964
22041
|
var sliderBackplateModel = result.meshes[1];
|
|
21965
22042
|
var sliderBarModel = result.meshes[1].clone("".concat(_this.name, "_sliderbar"), sliderBackplate);
|
|
21966
22043
|
var sliderThumbModel = result.meshes[1].clone("".concat(_this.name, "_sliderthumb"), sliderBackplate);
|
|
@@ -21968,7 +22045,6 @@ var Slider3D = /** @class */ (function (_super) {
|
|
|
21968
22045
|
if (_this._sliderBackplateVisible) {
|
|
21969
22046
|
sliderBackplateModel.visibility = 1;
|
|
21970
22047
|
sliderBackplateModel.name = "".concat(_this.name, "_sliderbackplate");
|
|
21971
|
-
sliderBackplateModel.isPickable = false;
|
|
21972
22048
|
sliderBackplateModel.scaling.x = 1;
|
|
21973
22049
|
sliderBackplateModel.scaling.z = 0.2;
|
|
21974
22050
|
sliderBackplateModel.parent = sliderBackplate;
|
|
@@ -21981,7 +22057,6 @@ var Slider3D = /** @class */ (function (_super) {
|
|
|
21981
22057
|
sliderBarModel.parent = sliderBackplate;
|
|
21982
22058
|
sliderBarModel.position.z = -0.1;
|
|
21983
22059
|
sliderBarModel.scaling = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Vector3(SLIDER_SCALING - SLIDER_MARGIN, 0.04, 0.3);
|
|
21984
|
-
sliderBarModel.isPickable = false;
|
|
21985
22060
|
if (_this._sliderBarMaterial) {
|
|
21986
22061
|
sliderBarModel.material = _this._sliderBarMaterial;
|
|
21987
22062
|
}
|
|
@@ -29036,6 +29111,9 @@ var MRDLSliderThumbMaterial = /** @class */ (function (_super) {
|
|
|
29036
29111
|
_this.alphaMode = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Constants.ALPHA_DISABLE;
|
|
29037
29112
|
_this.backFaceCulling = false;
|
|
29038
29113
|
_this._blueGradientTexture = new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture(MRDLSliderThumbMaterial.BLUE_GRADIENT_TEXTURE_URL, scene, true, false, core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.NEAREST_SAMPLINGMODE);
|
|
29114
|
+
_this._decalTexture = new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture("", _this.getScene());
|
|
29115
|
+
_this._reflectionMapTexture = new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture("", _this.getScene());
|
|
29116
|
+
_this._indirectEnvTexture = new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture("", _this.getScene());
|
|
29039
29117
|
return _this;
|
|
29040
29118
|
}
|
|
29041
29119
|
MRDLSliderThumbMaterial.prototype.needAlphaBlending = function () {
|