babylonjs-gui 5.21.0 → 5.23.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/babylon.gui.d.ts +12 -0
- package/babylon.gui.js +68 -1
- 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 +24 -0
- package/package.json +2 -2
package/babylon.gui.d.ts
CHANGED
|
@@ -391,6 +391,12 @@ declare module BABYLON.GUI {
|
|
|
391
391
|
* Unregister the clipboard Events from the canvas
|
|
392
392
|
*/
|
|
393
393
|
unRegisterClipboardEvents(): void;
|
|
394
|
+
/**
|
|
395
|
+
* Transform uvs from mesh space to texture space, taking the texture into account
|
|
396
|
+
* @param uv the uvs in mesh space
|
|
397
|
+
* @returns the uvs in texture space
|
|
398
|
+
*/
|
|
399
|
+
private _transformUvs;
|
|
394
400
|
/**
|
|
395
401
|
* Connect the texture to a hosting mesh to enable interactions
|
|
396
402
|
* @param mesh defines the mesh to attach to
|
|
@@ -417,6 +423,12 @@ declare module BABYLON.GUI {
|
|
|
417
423
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
|
418
424
|
*/
|
|
419
425
|
parseSerializedObject(serializedObject: any, scaleToSize?: boolean): void;
|
|
426
|
+
/**
|
|
427
|
+
* Clones the ADT
|
|
428
|
+
* @param newName defines the name of the new ADT
|
|
429
|
+
* @returns the clone of the ADT
|
|
430
|
+
*/
|
|
431
|
+
clone(newName?: string): AdvancedDynamicTexture;
|
|
420
432
|
/**
|
|
421
433
|
* Recreate the content of the ADT from a JSON object
|
|
422
434
|
* @param serializedObject define the JSON serialized object to restore from
|
package/babylon.gui.js
CHANGED
|
@@ -1423,6 +1423,55 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1423
1423
|
self.removeEventListener("cut", this._onClipboardCut);
|
|
1424
1424
|
self.removeEventListener("paste", this._onClipboardPaste);
|
|
1425
1425
|
};
|
|
1426
|
+
/**
|
|
1427
|
+
* Transform uvs from mesh space to texture space, taking the texture into account
|
|
1428
|
+
* @param uv the uvs in mesh space
|
|
1429
|
+
* @returns the uvs in texture space
|
|
1430
|
+
*/
|
|
1431
|
+
AdvancedDynamicTexture.prototype._transformUvs = function (uv) {
|
|
1432
|
+
var textureMatrix = this.getTextureMatrix();
|
|
1433
|
+
var result;
|
|
1434
|
+
if (textureMatrix.isIdentityAs3x2()) {
|
|
1435
|
+
result = uv;
|
|
1436
|
+
}
|
|
1437
|
+
else {
|
|
1438
|
+
var homogeneousTextureMatrix = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Matrix[0];
|
|
1439
|
+
textureMatrix.getRowToRef(0, core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector4[0]);
|
|
1440
|
+
textureMatrix.getRowToRef(1, core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector4[1]);
|
|
1441
|
+
textureMatrix.getRowToRef(2, core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector4[2]);
|
|
1442
|
+
var r0 = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector4[0];
|
|
1443
|
+
var r1 = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector4[1];
|
|
1444
|
+
var r2 = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector4[2];
|
|
1445
|
+
homogeneousTextureMatrix.setRowFromFloats(0, r0.x, r0.y, 0, 0);
|
|
1446
|
+
homogeneousTextureMatrix.setRowFromFloats(1, r1.x, r1.y, 0, 0);
|
|
1447
|
+
homogeneousTextureMatrix.setRowFromFloats(2, 0, 0, 1, 0);
|
|
1448
|
+
homogeneousTextureMatrix.setRowFromFloats(3, r2.x, r2.y, 0, 1);
|
|
1449
|
+
result = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Vector2[0];
|
|
1450
|
+
core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Vector2.TransformToRef(uv, homogeneousTextureMatrix, result);
|
|
1451
|
+
}
|
|
1452
|
+
// In wrap and mirror mode, the texture coordinate for coordinates more than 1 is the fractional part of the coordinate
|
|
1453
|
+
if (this.wrapU === core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Texture.WRAP_ADDRESSMODE || this.wrapU === core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Texture.MIRROR_ADDRESSMODE) {
|
|
1454
|
+
if (result.x > 1) {
|
|
1455
|
+
var fX = result.x - Math.trunc(result.x);
|
|
1456
|
+
// In mirror mode, the sign of the texture coordinate depends on the integer part -
|
|
1457
|
+
// odd integers means it is mirrored from the original coordinate
|
|
1458
|
+
if (this.wrapU === core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Texture.MIRROR_ADDRESSMODE && Math.trunc(result.x) % 2 === 1) {
|
|
1459
|
+
fX = 1 - fX;
|
|
1460
|
+
}
|
|
1461
|
+
result.x = fX;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
if (this.wrapV === core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Texture.WRAP_ADDRESSMODE || this.wrapV === core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Texture.MIRROR_ADDRESSMODE) {
|
|
1465
|
+
if (result.y > 1) {
|
|
1466
|
+
var fY = result.y - Math.trunc(result.y);
|
|
1467
|
+
if (this.wrapV === core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Texture.MIRROR_ADDRESSMODE && Math.trunc(result.x) % 2 === 1) {
|
|
1468
|
+
fY = 1 - fY;
|
|
1469
|
+
}
|
|
1470
|
+
result.y = fY;
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
return result;
|
|
1474
|
+
};
|
|
1426
1475
|
/**
|
|
1427
1476
|
* Connect the texture to a hosting mesh to enable interactions
|
|
1428
1477
|
* @param mesh defines the mesh to attach to
|
|
@@ -1449,6 +1498,7 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1449
1498
|
if (pi.pickInfo && pi.pickInfo.hit && pi.pickInfo.pickedMesh === mesh) {
|
|
1450
1499
|
var uv = pi.pickInfo.getTextureCoordinates();
|
|
1451
1500
|
if (uv) {
|
|
1501
|
+
uv = _this._transformUvs(uv);
|
|
1452
1502
|
var size = _this.getSize();
|
|
1453
1503
|
_this._doPicking(uv.x * size.width, (_this.applyYInversionOnUpdate ? 1.0 - uv.y : uv.y) * size.height, pi, pi.type, pointerId, pi.event.button, pi.event.deltaX, pi.event.deltaY);
|
|
1454
1504
|
}
|
|
@@ -1495,6 +1545,7 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1495
1545
|
if (pick && pick.hit && pick.pickedMesh === mesh) {
|
|
1496
1546
|
var uv = pick.getTextureCoordinates();
|
|
1497
1547
|
if (uv) {
|
|
1548
|
+
uv = _this._transformUvs(uv);
|
|
1498
1549
|
var size = _this.getSize();
|
|
1499
1550
|
_this._doPicking(uv.x * size.width, (_this.applyYInversionOnUpdate ? 1.0 - uv.y : uv.y) * size.height, null, core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERMOVE, pointerId, 0);
|
|
1500
1551
|
}
|
|
@@ -1602,6 +1653,21 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1602
1653
|
}
|
|
1603
1654
|
}
|
|
1604
1655
|
};
|
|
1656
|
+
/**
|
|
1657
|
+
* Clones the ADT
|
|
1658
|
+
* @param newName defines the name of the new ADT
|
|
1659
|
+
* @returns the clone of the ADT
|
|
1660
|
+
*/
|
|
1661
|
+
AdvancedDynamicTexture.prototype.clone = function (newName) {
|
|
1662
|
+
var scene = this.getScene();
|
|
1663
|
+
if (!scene) {
|
|
1664
|
+
return this;
|
|
1665
|
+
}
|
|
1666
|
+
var data = this.serializeContent();
|
|
1667
|
+
var clone = AdvancedDynamicTexture.CreateFullscreenUI(newName || "Clone of " + this.name, this.isForeground, scene, this.samplingMode);
|
|
1668
|
+
clone.parseSerializedObject(data);
|
|
1669
|
+
return clone;
|
|
1670
|
+
};
|
|
1605
1671
|
/**
|
|
1606
1672
|
* Recreate the content of the ADT from a snippet saved by the GUI editor
|
|
1607
1673
|
* @param snippetId defines the snippet to load
|
|
@@ -12114,6 +12180,7 @@ var Rectangle = /** @class */ (function (_super) {
|
|
|
12114
12180
|
var width = this._currentMeasure.width - offset * 2;
|
|
12115
12181
|
var height = this._currentMeasure.height - offset * 2;
|
|
12116
12182
|
var radius = Math.min(height / 2, Math.min(width / 2, this._cornerRadius));
|
|
12183
|
+
radius = Math.abs(radius);
|
|
12117
12184
|
context.beginPath();
|
|
12118
12185
|
context.moveTo(x + radius, y);
|
|
12119
12186
|
context.lineTo(x + width - radius, y);
|
|
@@ -21562,7 +21629,7 @@ var TouchButton3D = /** @class */ (function (_super) {
|
|
|
21562
21629
|
* @hidden
|
|
21563
21630
|
*/
|
|
21564
21631
|
TouchButton3D.prototype._generatePointerEventType = function (providedType, nearMeshPosition, activeInteractionCount) {
|
|
21565
|
-
if (providedType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERDOWN) {
|
|
21632
|
+
if (providedType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERDOWN || providedType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERMOVE) {
|
|
21566
21633
|
if (!this._isInteractionInFrontOfButton(nearMeshPosition)) {
|
|
21567
21634
|
// Near interaction mesh is behind the button, don't send a pointer down
|
|
21568
21635
|
return core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERMOVE;
|