babylonjs-gui 5.25.0 → 5.26.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 +8 -0
- package/babylon.gui.js +23 -8
- 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 +17 -0
- package/package.json +2 -2
package/babylon.gui.d.ts
CHANGED
|
@@ -359,6 +359,14 @@ declare module BABYLON.GUI {
|
|
|
359
359
|
* @internal
|
|
360
360
|
*/
|
|
361
361
|
_cleanControlAfterRemoval(control: Control): void;
|
|
362
|
+
/**
|
|
363
|
+
* This function will run a pointer event on this ADT and will trigger any pointer events on any controls
|
|
364
|
+
* This will work on a fullscreen ADT only. For mesh based ADT, simulate pointer events using the scene directly.
|
|
365
|
+
* @param x pointer X on the canvas for the picking
|
|
366
|
+
* @param y pointer Y on the canvas for the picking
|
|
367
|
+
* @param pi optional pointer information
|
|
368
|
+
*/
|
|
369
|
+
pick(x: number, y: number, pi?: BABYLON.Nullable<BABYLON.PointerInfoPre>): void;
|
|
362
370
|
private _translateToPicking;
|
|
363
371
|
/** Attach to all scene events required to support pointer events */
|
|
364
372
|
attach(): void;
|
package/babylon.gui.js
CHANGED
|
@@ -1308,7 +1308,22 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1308
1308
|
this._cleanControlAfterRemovalFromList(this._lastControlDown, control);
|
|
1309
1309
|
this._cleanControlAfterRemovalFromList(this._lastControlOver, control);
|
|
1310
1310
|
};
|
|
1311
|
-
|
|
1311
|
+
/**
|
|
1312
|
+
* This function will run a pointer event on this ADT and will trigger any pointer events on any controls
|
|
1313
|
+
* This will work on a fullscreen ADT only. For mesh based ADT, simulate pointer events using the scene directly.
|
|
1314
|
+
* @param x pointer X on the canvas for the picking
|
|
1315
|
+
* @param y pointer Y on the canvas for the picking
|
|
1316
|
+
* @param pi optional pointer information
|
|
1317
|
+
*/
|
|
1318
|
+
AdvancedDynamicTexture.prototype.pick = function (x, y, pi) {
|
|
1319
|
+
if (pi === void 0) { pi = null; }
|
|
1320
|
+
if (this._isFullscreen && this._scene) {
|
|
1321
|
+
this._translateToPicking(this._scene, new core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Viewport(0, 0, 0, 0), pi, x, y);
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
AdvancedDynamicTexture.prototype._translateToPicking = function (scene, tempViewport, pi, x, y) {
|
|
1325
|
+
if (x === void 0) { x = scene.pointerX; }
|
|
1326
|
+
if (y === void 0) { y = scene.pointerY; }
|
|
1312
1327
|
var camera = scene.cameraToUseForPointers || scene.activeCamera;
|
|
1313
1328
|
var engine = scene.getEngine();
|
|
1314
1329
|
var originalCameraToUseForPointers = scene.cameraToUseForPointers;
|
|
@@ -1325,10 +1340,10 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1325
1340
|
camera.rigCameras.forEach(function (rigCamera) {
|
|
1326
1341
|
// generate the viewport of this camera
|
|
1327
1342
|
rigCamera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), rigViewport_1);
|
|
1328
|
-
var
|
|
1329
|
-
var
|
|
1343
|
+
var transformedX = x / engine.getHardwareScalingLevel() - rigViewport_1.x;
|
|
1344
|
+
var transformedY = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - rigViewport_1.y - rigViewport_1.height);
|
|
1330
1345
|
// check if the pointer is in the camera's viewport
|
|
1331
|
-
if (
|
|
1346
|
+
if (transformedX < 0 || transformedY < 0 || x > rigViewport_1.width || y > rigViewport_1.height) {
|
|
1332
1347
|
// out of viewport - don't use this camera
|
|
1333
1348
|
return;
|
|
1334
1349
|
}
|
|
@@ -1345,20 +1360,20 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
|
|
|
1345
1360
|
camera.viewport.toGlobalToRef(engine.getRenderWidth(), engine.getRenderHeight(), tempViewport);
|
|
1346
1361
|
}
|
|
1347
1362
|
}
|
|
1348
|
-
var
|
|
1349
|
-
var
|
|
1363
|
+
var transformedX = x / engine.getHardwareScalingLevel() - tempViewport.x;
|
|
1364
|
+
var transformedY = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - tempViewport.y - tempViewport.height);
|
|
1350
1365
|
this._shouldBlockPointer = false;
|
|
1351
1366
|
// Do picking modifies _shouldBlockPointer
|
|
1352
1367
|
if (pi) {
|
|
1353
1368
|
var pointerId = pi.event.pointerId || this._defaultMousePointerId;
|
|
1354
|
-
this._doPicking(
|
|
1369
|
+
this._doPicking(transformedX, transformedY, pi, pi.type, pointerId, pi.event.button, pi.event.deltaX, pi.event.deltaY);
|
|
1355
1370
|
// Avoid overwriting a true skipOnPointerObservable to false
|
|
1356
1371
|
if (this._shouldBlockPointer || this._capturingControl[pointerId]) {
|
|
1357
1372
|
pi.skipOnPointerObservable = true;
|
|
1358
1373
|
}
|
|
1359
1374
|
}
|
|
1360
1375
|
else {
|
|
1361
|
-
this._doPicking(
|
|
1376
|
+
this._doPicking(transformedX, transformedY, null, core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERMOVE, this._defaultMousePointerId, 0);
|
|
1362
1377
|
}
|
|
1363
1378
|
// if overridden by a rig camera - reset back to the original value
|
|
1364
1379
|
scene.cameraToUseForPointers = originalCameraToUseForPointers;
|