babylonjs-gui 5.21.0 → 5.22.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 +6 -0
- package/babylon.gui.js +53 -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 +12 -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
|
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
|
}
|
|
@@ -12114,6 +12165,7 @@ var Rectangle = /** @class */ (function (_super) {
|
|
|
12114
12165
|
var width = this._currentMeasure.width - offset * 2;
|
|
12115
12166
|
var height = this._currentMeasure.height - offset * 2;
|
|
12116
12167
|
var radius = Math.min(height / 2, Math.min(width / 2, this._cornerRadius));
|
|
12168
|
+
radius = Math.abs(radius);
|
|
12117
12169
|
context.beginPath();
|
|
12118
12170
|
context.moveTo(x + radius, y);
|
|
12119
12171
|
context.lineTo(x + width - radius, y);
|
|
@@ -21562,7 +21614,7 @@ var TouchButton3D = /** @class */ (function (_super) {
|
|
|
21562
21614
|
* @hidden
|
|
21563
21615
|
*/
|
|
21564
21616
|
TouchButton3D.prototype._generatePointerEventType = function (providedType, nearMeshPosition, activeInteractionCount) {
|
|
21565
|
-
if (providedType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERDOWN) {
|
|
21617
|
+
if (providedType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERDOWN || providedType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERMOVE) {
|
|
21566
21618
|
if (!this._isInteractionInFrontOfButton(nearMeshPosition)) {
|
|
21567
21619
|
// Near interaction mesh is behind the button, don't send a pointer down
|
|
21568
21620
|
return core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERMOVE;
|