babylonjs-gui 5.0.0-rc.0 → 5.0.0-rc.3
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.js +26 -15
- package/babylon.gui.js.map +1 -1
- package/babylon.gui.min.js +2 -2
- package/babylon.gui.module.d.ts +8 -2
- package/package.json +2 -2
package/babylon.gui.js
CHANGED
|
@@ -1746,32 +1746,41 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1746
1746
|
* @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
|
|
1747
1747
|
* @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
|
|
1748
1748
|
* @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
|
|
1749
|
+
* @param materialSetupCallback defines a custom way of creating and seting up the material on the mesh
|
|
1749
1750
|
* @returns a new AdvancedDynamicTexture
|
|
1750
1751
|
*/
|
|
1751
|
-
AdvancedDynamicTexture.CreateForMesh = function (mesh, width, height, supportPointerMove, onlyAlphaTesting, invertY) {
|
|
1752
|
+
AdvancedDynamicTexture.CreateForMesh = function (mesh, width, height, supportPointerMove, onlyAlphaTesting, invertY, materialSetupCallback) {
|
|
1752
1753
|
if (width === void 0) { width = 1024; }
|
|
1753
1754
|
if (height === void 0) { height = 1024; }
|
|
1754
1755
|
if (supportPointerMove === void 0) { supportPointerMove = true; }
|
|
1755
1756
|
if (onlyAlphaTesting === void 0) { onlyAlphaTesting = false; }
|
|
1757
|
+
if (materialSetupCallback === void 0) { materialSetupCallback = this._CreateMaterial; }
|
|
1756
1758
|
// use a unique ID in name so serialization will work even if you create two ADTs for a single mesh
|
|
1757
1759
|
var uniqueId = Object(babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["RandomGUID"])();
|
|
1758
1760
|
var result = new AdvancedDynamicTexture("AdvancedDynamicTexture for ".concat(mesh.name, " [").concat(uniqueId, "]"), width, height, mesh.getScene(), true, babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Texture"].TRILINEAR_SAMPLINGMODE, invertY);
|
|
1759
|
-
|
|
1761
|
+
materialSetupCallback(mesh, uniqueId, result, onlyAlphaTesting);
|
|
1762
|
+
result.attachToMesh(mesh, supportPointerMove);
|
|
1763
|
+
return result;
|
|
1764
|
+
};
|
|
1765
|
+
AdvancedDynamicTexture._CreateMaterial = function (mesh, uniqueId, texture, onlyAlphaTesting) {
|
|
1766
|
+
var internalClassType = Object(babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["GetClass"])("BABYLON.StandardMaterial");
|
|
1767
|
+
if (!internalClassType) {
|
|
1768
|
+
throw "StandardMaterial needs to be imported before as it contains a side-effect required by your code.";
|
|
1769
|
+
}
|
|
1770
|
+
var material = new internalClassType("AdvancedDynamicTextureMaterial for ".concat(mesh.name, " [").concat(uniqueId, "]"), mesh.getScene());
|
|
1760
1771
|
material.backFaceCulling = false;
|
|
1761
1772
|
material.diffuseColor = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Color3"].Black();
|
|
1762
1773
|
material.specularColor = babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Color3"].Black();
|
|
1763
1774
|
if (onlyAlphaTesting) {
|
|
1764
|
-
material.diffuseTexture =
|
|
1765
|
-
material.emissiveTexture =
|
|
1766
|
-
|
|
1775
|
+
material.diffuseTexture = texture;
|
|
1776
|
+
material.emissiveTexture = texture;
|
|
1777
|
+
texture.hasAlpha = true;
|
|
1767
1778
|
}
|
|
1768
1779
|
else {
|
|
1769
|
-
material.emissiveTexture =
|
|
1770
|
-
material.opacityTexture =
|
|
1780
|
+
material.emissiveTexture = texture;
|
|
1781
|
+
material.opacityTexture = texture;
|
|
1771
1782
|
}
|
|
1772
1783
|
mesh.material = material;
|
|
1773
|
-
result.attachToMesh(mesh, supportPointerMove);
|
|
1774
|
-
return result;
|
|
1775
1784
|
};
|
|
1776
1785
|
/**
|
|
1777
1786
|
* Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh) BUT do not create a new material for the mesh. You will be responsible for connecting the texture
|
|
@@ -19361,6 +19370,9 @@ var Slider3D = /** @class */ (function (_super) {
|
|
|
19361
19370
|
return;
|
|
19362
19371
|
}
|
|
19363
19372
|
this._value = Math.max(Math.min(value, this._maximum), this._minimum);
|
|
19373
|
+
if (this._sliderThumb) {
|
|
19374
|
+
this._sliderThumb.position.x = this._convertToPosition(this.value);
|
|
19375
|
+
}
|
|
19364
19376
|
this.onValueChangedObservable.notifyObservers(this._value);
|
|
19365
19377
|
},
|
|
19366
19378
|
enumerable: false,
|
|
@@ -19481,13 +19493,12 @@ var Slider3D = /** @class */ (function (_super) {
|
|
|
19481
19493
|
var _this = this;
|
|
19482
19494
|
var pointerDragBehavior = new babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["PointerDragBehavior"]({ dragAxis: babylonjs_Misc_observable__WEBPACK_IMPORTED_MODULE_1__["Vector3"].Right() });
|
|
19483
19495
|
pointerDragBehavior.moveAttached = false;
|
|
19484
|
-
pointerDragBehavior.
|
|
19485
|
-
|
|
19486
|
-
_this._sliderThumb.position.x = Math.max(Math.min(newPosition, _this.end), _this.start);
|
|
19487
|
-
_this.value = _this._convertToValue(_this._sliderThumb.position.x);
|
|
19496
|
+
pointerDragBehavior.onDragStartObservable.add(function (event) {
|
|
19497
|
+
_this._draggedPosition = _this._sliderThumb.position.x;
|
|
19488
19498
|
});
|
|
19489
|
-
pointerDragBehavior.
|
|
19490
|
-
_this.
|
|
19499
|
+
pointerDragBehavior.onDragObservable.add(function (event) {
|
|
19500
|
+
_this._draggedPosition += event.dragDistance / _this.scaling.x;
|
|
19501
|
+
_this.value = _this._convertToValue(_this._draggedPosition);
|
|
19491
19502
|
});
|
|
19492
19503
|
return pointerDragBehavior;
|
|
19493
19504
|
};
|