@crystaldesign/real-time-viewer 25.9.0-beta.4 → 25.9.0-beta.41
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/build/esm/index.js +551 -321
- package/build/types/real-time-viewer/src/CustomMaterial/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/context.d.ts +1 -1
- package/build/types/real-time-viewer/src/context.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/controls/index.d.ts +6 -3
- package/build/types/real-time-viewer/src/controls/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/grids/index.d.ts +6 -2
- package/build/types/real-time-viewer/src/grids/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/index.d.ts +1 -120
- package/build/types/real-time-viewer/src/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/parser/buildScene/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/parser/findAssets/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/parser/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/store/GridStore.d.ts +13 -3
- package/build/types/real-time-viewer/src/store/GridStore.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/store/SceneStore.d.ts +1 -2
- package/build/types/real-time-viewer/src/store/SceneStore.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/store/UIStore.d.ts +6 -4
- package/build/types/real-time-viewer/src/store/UIStore.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/store/UtilStore.d.ts +3 -3
- package/build/types/real-time-viewer/src/store/UtilStore.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/types.d.ts +240 -0
- package/build/types/real-time-viewer/src/types.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/useRealTimeRenderData.d.ts +1 -1
- package/build/types/real-time-viewer/src/useRealTimeRenderData.d.ts.map +1 -1
- package/build/umd/1020.real-time-viewer.umd.min.js +1 -1
- package/build/umd/2371.real-time-viewer.umd.min.js +1 -1
- package/build/umd/2528.real-time-viewer.umd.min.js +1 -1
- package/build/umd/4049.real-time-viewer.umd.min.js +1 -1
- package/build/umd/4486.real-time-viewer.umd.min.js +1 -1
- package/build/umd/4560.real-time-viewer.umd.min.js +1 -1
- package/build/umd/4623.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4623.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/6030.real-time-viewer.umd.min.js +1 -1
- package/build/umd/6656.real-time-viewer.umd.min.js +1 -1
- package/build/umd/7501.real-time-viewer.umd.min.js +1 -1
- package/build/umd/8645.real-time-viewer.umd.min.js +1 -1
- package/build/umd/8954.real-time-viewer.umd.min.js +1 -1
- package/build/umd/real-time-viewer.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +13 -13
- package/build/umd/7069.real-time-viewer.umd.min.js +0 -2
- package/build/umd/7069.real-time-viewer.umd.min.js.LICENSE.txt +0 -1
package/build/esm/index.js
CHANGED
|
@@ -7,9 +7,9 @@ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
|
7
7
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
8
8
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
9
9
|
import { Tags } from '@babylonjs/core/Misc/tags';
|
|
10
|
+
import { MeshBuilder } from '@babylonjs/core/Meshes/meshBuilder';
|
|
10
11
|
import { Vector3, Matrix, Vector2 } from '@babylonjs/core/Maths/math.vector';
|
|
11
12
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
12
|
-
import { MeshBuilder } from '@babylonjs/core/Meshes/meshBuilder';
|
|
13
13
|
import { ActionManager } from '@babylonjs/core/Actions/actionManager';
|
|
14
14
|
import { ExecuteCodeAction } from '@babylonjs/core/Actions/directActions';
|
|
15
15
|
import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial';
|
|
@@ -46,7 +46,7 @@ import { Matrix as Matrix$1, Vector3 as Vector3$1 } from '@babylonjs/core/Maths/
|
|
|
46
46
|
import { EngineFactory } from '@babylonjs/core/Engines/engineFactory';
|
|
47
47
|
import { Scene } from '@babylonjs/core/scene';
|
|
48
48
|
import { DracoCompression } from '@babylonjs/core/Meshes/Compression/dracoCompression';
|
|
49
|
-
import { LoadAssetContainerAsync } from '@babylonjs/core/Loading/';
|
|
49
|
+
import { LoadAssetContainerAsync } from '@babylonjs/core/Loading/index';
|
|
50
50
|
import '@babylonjs/loaders/glTF/2.0/';
|
|
51
51
|
import { UniversalCamera } from '@babylonjs/core/Cameras/universalCamera';
|
|
52
52
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -179,7 +179,7 @@ function GetCameraControls(camera) {
|
|
|
179
179
|
alpha = _calculateAngles.alpha,
|
|
180
180
|
beta = _calculateAngles.beta,
|
|
181
181
|
distance = _calculateAngles.distance;
|
|
182
|
-
alpha = alpha + deltaX *
|
|
182
|
+
alpha = alpha + deltaX * 0.003;
|
|
183
183
|
beta = clamp(beta + deltaY * -0.003, 0.1, Math.PI / 2);
|
|
184
184
|
var x = sceneStore.cameraTargetPosition.x + distance * Math.sin(beta) * Math.cos(alpha);
|
|
185
185
|
var y = sceneStore.cameraTargetPosition.y + distance * Math.cos(beta);
|
|
@@ -303,16 +303,22 @@ function getGridControls(scene, element, selected, elements, selectMesh) {
|
|
|
303
303
|
var utilStore = useUtilStoreContext();
|
|
304
304
|
var _curGrid = selected;
|
|
305
305
|
var onGridMove = function onGridMove(ev) {
|
|
306
|
-
var _scene$activeCamera, _scene$getMeshById
|
|
306
|
+
var _scene$activeCamera, _scene$getMeshById$me, _scene$getMeshById, _Tags$GetTags;
|
|
307
307
|
(_scene$activeCamera = scene.activeCamera) === null || _scene$activeCamera === void 0 || _scene$activeCamera.detachControl();
|
|
308
|
-
var metadata = (_scene$getMeshById = scene.getMeshById(selected.id)) === null || _scene$getMeshById === void 0 ? void 0 : _scene$getMeshById.metadata;
|
|
308
|
+
var metadata = (_scene$getMeshById$me = (_scene$getMeshById = scene.getMeshById(selected.id)) === null || _scene$getMeshById === void 0 ? void 0 : _scene$getMeshById.metadata) !== null && _scene$getMeshById$me !== void 0 ? _scene$getMeshById$me : selected.metadata;
|
|
309
309
|
if (!metadata) return;
|
|
310
|
-
var
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
310
|
+
var actualHQRObj = undefined;
|
|
311
|
+
if (metadata.type == 'GRID') {
|
|
312
|
+
var _elements$find$bbn$na, _elements$find;
|
|
313
|
+
var _ref = gridStore.getDataFromGridName(selected.name, metadata.elementId),
|
|
314
|
+
startShelfIdx = _ref.shelfIdx,
|
|
315
|
+
startGridIdx = _ref.gridIdx;
|
|
316
|
+
actualHQRObj = scene.getTransformNodeByName((_elements$find$bbn$na = (_elements$find = elements.find(function (el) {
|
|
317
|
+
return el === null || el === void 0 ? void 0 : el.bbn.name.endsWith(metadata.elementId + '.' + startGridIdx + '.' + startShelfIdx);
|
|
318
|
+
})) === null || _elements$find === void 0 ? void 0 : _elements$find.bbn.name) !== null && _elements$find$bbn$na !== void 0 ? _elements$find$bbn$na : '');
|
|
319
|
+
} else if (metadata.type == 'BOX') {
|
|
320
|
+
actualHQRObj = selected;
|
|
321
|
+
}
|
|
316
322
|
if (!actualHQRObj) return;
|
|
317
323
|
var mouseX = ev.clientX;
|
|
318
324
|
var mouseY = ev.clientY;
|
|
@@ -325,20 +331,27 @@ function getGridControls(scene, element, selected, elements, selectMesh) {
|
|
|
325
331
|
if (!pickResult.pickedMesh || !((_Tags$GetTags = Tags.GetTags(pickResult.pickedMesh)) !== null && _Tags$GetTags !== void 0 && _Tags$GetTags.includes('free')) && pickResult.pickedMesh.name != selected.name) return;
|
|
326
332
|
var closestGrid = pickResult.pickedMesh;
|
|
327
333
|
if (closestGrid) {
|
|
334
|
+
var _closestGrid$metadata, _closestGrid$metadata2;
|
|
328
335
|
scene.getMeshesByTags('free').forEach(function (mesh) {
|
|
329
336
|
return mesh.material.alpha = 0.2;
|
|
330
337
|
});
|
|
331
338
|
actualHQRObj.setAbsolutePosition(new Vector3(closestGrid.absolutePosition.x, closestGrid.absolutePosition.y, closestGrid.absolutePosition.z));
|
|
332
|
-
actualHQRObj.position = actualHQRObj.position.addInPlace(closestGrid.metadata.geoPos);
|
|
339
|
+
actualHQRObj.position = actualHQRObj.position.addInPlace((_closestGrid$metadata = (_closestGrid$metadata2 = closestGrid.metadata) === null || _closestGrid$metadata2 === void 0 ? void 0 : _closestGrid$metadata2.geoPos) !== null && _closestGrid$metadata !== void 0 ? _closestGrid$metadata : Vector3.Zero());
|
|
333
340
|
actualHQRObj.rotation = new Vector3(closestGrid.rotation.x, closestGrid.rotation.y, closestGrid.rotation.z);
|
|
334
341
|
var size = closestGrid.getBoundingInfo().maximum.subtract(closestGrid.getBoundingInfo().minimum);
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
342
|
+
var moveValue = new Vector3(-size.x / 2, -size.y / 2, size.z / 2);
|
|
343
|
+
if (metadata.type == 'GRID') {
|
|
344
|
+
moveValue.x += closestGrid.metadata.rulePos.x;
|
|
345
|
+
moveValue.y += closestGrid.metadata.rulePos.y;
|
|
346
|
+
moveValue.z += closestGrid.metadata.rulePos.z;
|
|
347
|
+
}
|
|
348
|
+
utilStore.moveObjectInDirection(actualHQRObj, Vector3.Right(), moveValue.x);
|
|
349
|
+
utilStore.moveObjectInDirection(actualHQRObj, Vector3.Up(), moveValue.y);
|
|
350
|
+
utilStore.moveObjectInDirection(actualHQRObj, Vector3.Forward(), moveValue.z);
|
|
338
351
|
_curGrid = closestGrid;
|
|
339
352
|
}
|
|
340
353
|
};
|
|
341
|
-
var
|
|
354
|
+
var registerGrid = function registerGrid(basketId, gridIdx, shelfIdx, accessoireBasketId) {
|
|
342
355
|
var _onGridMoveOut = function onGridMoveOut() {
|
|
343
356
|
var _curGrid2, _curGrid3, _scene$activeCamera2;
|
|
344
357
|
element === null || element === void 0 || element.removeEventListener('pointermove', onGridMove, false);
|
|
@@ -356,21 +369,38 @@ function getGridControls(scene, element, selected, elements, selectMesh) {
|
|
|
356
369
|
var _utilStore$viewHandle;
|
|
357
370
|
(_utilStore$viewHandle = utilStore.viewHandler) === null || _utilStore$viewHandle === void 0 || _utilStore$viewHandle.divaWebPlanner.moveShelfItemToGrid(accessoireBasketId, curBasketId, gridName, curShelfIdx);
|
|
358
371
|
}
|
|
359
|
-
|
|
360
|
-
selectMesh(_curGrid, curGridIdx, curShelfIdx, curBasketId, tags.includes('disableDelete'), tags.includes('disableMove'));
|
|
372
|
+
Tags.GetTags(_curGrid);
|
|
373
|
+
//selectMesh(_curGrid, curGridIdx, curShelfIdx, curBasketId, tags.includes('disableDelete'), tags.includes('disableMove'));
|
|
361
374
|
(_scene$activeCamera2 = scene.activeCamera) === null || _scene$activeCamera2 === void 0 || _scene$activeCamera2.attachControl();
|
|
362
375
|
};
|
|
363
376
|
element === null || element === void 0 || element.addEventListener('pointermove', onGridMove, false);
|
|
364
377
|
element === null || element === void 0 || element.addEventListener('pointerup', _onGridMoveOut, false);
|
|
365
378
|
};
|
|
379
|
+
var registerBox = function registerBox() {
|
|
380
|
+
var _onGridMoveOut2 = function onGridMoveOut() {
|
|
381
|
+
var _scene$activeCamera3, _curGrid4;
|
|
382
|
+
element === null || element === void 0 || element.removeEventListener('pointermove', onGridMove, false);
|
|
383
|
+
element === null || element === void 0 || element.removeEventListener('pointerup', _onGridMoveOut2, false);
|
|
384
|
+
(_scene$activeCamera3 = scene.activeCamera) === null || _scene$activeCamera3 === void 0 || _scene$activeCamera3.attachControl();
|
|
385
|
+
_curGrid = scene.getMeshByName((_curGrid4 = _curGrid) === null || _curGrid4 === void 0 ? void 0 : _curGrid4.name);
|
|
386
|
+
if (!_curGrid) return;
|
|
387
|
+
/* Wait for dedicated function this only works when moved to nearby grid where copy works
|
|
388
|
+
utilStore.onElementDeleted(_curGrid.metadata.setId, _curGrid.metadata.elementId)
|
|
389
|
+
utilStore.viewHandler?.viewPlannerHandler.onElementCopy(_curGrid.metadata.setId, _curGrid.metadata.elementId, _curGrid.metadata.direction);
|
|
390
|
+
*/
|
|
391
|
+
};
|
|
392
|
+
element === null || element === void 0 || element.addEventListener('pointermove', onGridMove, false);
|
|
393
|
+
element === null || element === void 0 || element.addEventListener('pointerup', _onGridMoveOut2, false);
|
|
394
|
+
};
|
|
366
395
|
return {
|
|
367
|
-
|
|
396
|
+
registerGrid: registerGrid,
|
|
397
|
+
registerBox: registerBox
|
|
368
398
|
};
|
|
369
399
|
}
|
|
370
400
|
|
|
371
|
-
function _createForOfIteratorHelper$
|
|
372
|
-
function _unsupportedIterableToArray$
|
|
373
|
-
function _arrayLikeToArray$
|
|
401
|
+
function _createForOfIteratorHelper$9(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$9(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
402
|
+
function _unsupportedIterableToArray$9(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$9(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$9(r, a) : void 0; } }
|
|
403
|
+
function _arrayLikeToArray$9(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
374
404
|
function Grids () {
|
|
375
405
|
var utilStore = useUtilStoreContext();
|
|
376
406
|
var sceneStore = useSceneStoreContext();
|
|
@@ -380,6 +410,41 @@ function Grids () {
|
|
|
380
410
|
sceneStore.scene.getMeshesByTags('grid').forEach(function (m) {
|
|
381
411
|
return m.dispose();
|
|
382
412
|
});
|
|
413
|
+
sceneStore.scene.getMeshesByTags('box').forEach(function (m) {
|
|
414
|
+
return m.dispose();
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
function setupPreviewBoxs(generalPlanningState) {
|
|
418
|
+
var entries = Object.entries(generalPlanningState);
|
|
419
|
+
entries.forEach(function (_ref) {
|
|
420
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
421
|
+
key = _ref2[0],
|
|
422
|
+
gp = _ref2[1];
|
|
423
|
+
gp.grids.forEach(function (grid) {
|
|
424
|
+
grid.matrix.forEach(function (c) {
|
|
425
|
+
c.forEach(function (cell) {
|
|
426
|
+
var _cell$plannedElement$, _cell$plannedElement, _cell$plannedElement$2, _cell$plannedElement2, _gp$selectedElement;
|
|
427
|
+
if (!gp.selectedElement && !cell.plannedElement) return; // no selection=no planning; can only delete existing
|
|
428
|
+
var name = 'box_' + cell.index.x + '_' + cell.index.y;
|
|
429
|
+
var size = (_cell$plannedElement$ = (_cell$plannedElement = cell.plannedElement) === null || _cell$plannedElement === void 0 ? void 0 : _cell$plannedElement.size) !== null && _cell$plannedElement$ !== void 0 ? _cell$plannedElement$ : gp.selectedElement.size;
|
|
430
|
+
var pos = new Vector3(-(size.width * cell.index.x) / 100, (size.height * cell.index.y + size.height / 2) / 100, (-size.depth + size.depth / 2) / 100);
|
|
431
|
+
createPreviewBox('box', name, {
|
|
432
|
+
width: size.width / 100,
|
|
433
|
+
height: size.height / 100,
|
|
434
|
+
depth: size.depth / 100
|
|
435
|
+
}, pos, 0, true, true, undefined, {
|
|
436
|
+
elementId: (_cell$plannedElement$2 = (_cell$plannedElement2 = cell.plannedElement) === null || _cell$plannedElement2 === void 0 ? void 0 : _cell$plannedElement2.elementId) !== null && _cell$plannedElement$2 !== void 0 ? _cell$plannedElement$2 : (_gp$selectedElement = gp.selectedElement) === null || _gp$selectedElement === void 0 ? void 0 : _gp$selectedElement.elementId,
|
|
437
|
+
setId: key,
|
|
438
|
+
direction: 'LEFT',
|
|
439
|
+
type: 'BOX'
|
|
440
|
+
});
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
if (grid.overlapping) {
|
|
444
|
+
console.warn("overlapping logic is not yet implemented");
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
});
|
|
383
448
|
}
|
|
384
449
|
function setupPreviewGrids(allGrids, plannedPlacesOnGrids, freePlacesOnGrids) {
|
|
385
450
|
deleteAllGrids();
|
|
@@ -439,7 +504,7 @@ function Grids () {
|
|
|
439
504
|
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
440
505
|
gridName = _Object$entries2$_i[0];
|
|
441
506
|
_Object$entries2$_i[1];
|
|
442
|
-
var _iterator = _createForOfIteratorHelper$
|
|
507
|
+
var _iterator = _createForOfIteratorHelper$9(plannedPlaceOnGrid.grids[gridName].accessories),
|
|
443
508
|
_step;
|
|
444
509
|
try {
|
|
445
510
|
var _loop4 = function _loop4() {
|
|
@@ -491,7 +556,7 @@ function Grids () {
|
|
|
491
556
|
}
|
|
492
557
|
}
|
|
493
558
|
function createGrid(data, elementId, shelfIdx, gridIdx, isFree, noDelete, noMove, articleCodex) {
|
|
494
|
-
var _sceneStore$elements
|
|
559
|
+
var _sceneStore$elements;
|
|
495
560
|
var grid = data.grid;
|
|
496
561
|
var elementName = (_sceneStore$elements = sceneStore.elements) === null || _sceneStore$elements === void 0 || (_sceneStore$elements = _sceneStore$elements.find(function (el) {
|
|
497
562
|
return el.bbn.name.endsWith(elementId);
|
|
@@ -499,28 +564,42 @@ function Grids () {
|
|
|
499
564
|
if (!elementName) return;
|
|
500
565
|
var element = sceneStore.scene.getTransformNodeByName(elementName);
|
|
501
566
|
if (!element) return;
|
|
502
|
-
var box =
|
|
567
|
+
var box = createPreviewBox('grid', elementId + '.' + gridIdx + '.' + shelfIdx + '.' + grid.gridName, {
|
|
503
568
|
width: data.bboxSize.x / 100,
|
|
504
569
|
height: data.bboxSize.y / 100,
|
|
505
570
|
depth: data.bboxSize.z / 100
|
|
506
|
-
},
|
|
507
|
-
box.parent = element;
|
|
508
|
-
box.isPickable = true;
|
|
509
|
-
box.position = new Vector3(-grid.originPosition.x / 100, grid.originPosition.y / 100, -grid.originPosition.z / 100);
|
|
510
|
-
if (grid.rotation) box.rotation.y = grid.rotation * Math.PI / 180;
|
|
511
|
-
box.metadata = {
|
|
571
|
+
}, new Vector3(-grid.originPosition.x / 100, grid.originPosition.y / 100, -grid.originPosition.z / 100), grid.rotation, isFree, noMove, element, {
|
|
512
572
|
elementId: elementId,
|
|
513
573
|
rulePos: {
|
|
514
574
|
x: data.rulePosition.x / 100,
|
|
515
575
|
y: data.rulePosition.y / 100,
|
|
516
576
|
z: data.rulePosition.z / 100
|
|
517
577
|
},
|
|
518
|
-
geoPos: new Vector3(data.geoPosition.x / 100, data.geoPosition.y / 100, data.geoPosition.z / 100)
|
|
519
|
-
|
|
578
|
+
geoPos: new Vector3(data.geoPosition.x / 100, data.geoPosition.y / 100, data.geoPosition.z / 100),
|
|
579
|
+
type: 'GRID'
|
|
580
|
+
});
|
|
520
581
|
var bboxDiff = data.bboxSize.subtract(data.geoSize);
|
|
521
582
|
utilStore.moveObjectInDirection(box, new Vector3(1, 0, 0), (shelfIdx * -grid.deltaGrid.x - data.geoPosition.x) / 100 + (data.geoSize.x + bboxDiff.x) / 200 - box.metadata.rulePos.x);
|
|
522
583
|
utilStore.moveObjectInDirection(box, new Vector3(0, 1, 0), (shelfIdx * grid.deltaGrid.y + data.geoPosition.y) / 100 + (data.geoSize.y + bboxDiff.y) / 200 - box.metadata.rulePos.y);
|
|
523
584
|
utilStore.moveObjectInDirection(box, new Vector3(0, 0, 1), (shelfIdx * grid.deltaGrid.z - data.geoPosition.z) / 100 - (data.geoSize.z + bboxDiff.z) / 200 - box.metadata.rulePos.z);
|
|
585
|
+
Tags.AddTagsTo(box, noDelete ? 'disableDelete' : 'allowDelete');
|
|
586
|
+
Tags.AddTagsTo(box, 'ac:' + articleCodex);
|
|
587
|
+
if (gridStore.selectedGrid && box.name == gridStore.selectedGrid.name && utilStore.viewHandler && Tags.GetTags(gridStore.selectedGrid).includes('ac:' + articleCodex)) {
|
|
588
|
+
var _gridStore$plannedPla;
|
|
589
|
+
var basketId = (_gridStore$plannedPla = gridStore.plannedPlacesOnGrids) === null || _gridStore$plannedPla === void 0 || (_gridStore$plannedPla = _gridStore$plannedPla.find(function (plannedPlacesOnGrid) {
|
|
590
|
+
return plannedPlacesOnGrid.elementId == elementId;
|
|
591
|
+
})) === null || _gridStore$plannedPla === void 0 ? void 0 : _gridStore$plannedPla.basketId;
|
|
592
|
+
if (basketId) gridStore.selectGrid(box, gridIdx, shelfIdx, basketId, noDelete, noMove);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
function createPreviewBox(type, name, size, position, rotationY, isFree, noMove, parent, metadata) {
|
|
596
|
+
var _sceneStore$scene$get, _sceneStore$scene$get3;
|
|
597
|
+
var box = MeshBuilder.CreateBox(name, size, sceneStore.scene);
|
|
598
|
+
box.parent = parent;
|
|
599
|
+
box.isPickable = true;
|
|
600
|
+
box.position = position;
|
|
601
|
+
if (rotationY) box.rotation.y = rotationY * Math.PI / 180;
|
|
602
|
+
box.metadata = metadata;
|
|
524
603
|
box.material = (_sceneStore$scene$get = sceneStore.scene.getMaterialByName('grid_visible')) !== null && _sceneStore$scene$get !== void 0 ? _sceneStore$scene$get : new PBRMaterial('grid_visible', sceneStore.scene);
|
|
525
604
|
box.material.alpha = 0.6;
|
|
526
605
|
if (!isFree) {
|
|
@@ -533,26 +612,21 @@ function Grids () {
|
|
|
533
612
|
box.edgesColor = new Color4(0.15, 0.15, 0.3, 1);
|
|
534
613
|
box.material.environmentIntensity = 0;
|
|
535
614
|
box.material.emissiveColor = new Color3(0.5, 0.5, 0.5);
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
615
|
+
box.material = (_sceneStore$scene$get3 = sceneStore.scene.getMaterialByName('grid_visible')) !== null && _sceneStore$scene$get3 !== void 0 ? _sceneStore$scene$get3 : new PBRMaterial('grid_visible', sceneStore.scene);
|
|
616
|
+
box.material.alpha = 0.6;
|
|
617
|
+
if (!isFree) {
|
|
618
|
+
var _sceneStore$scene$get4;
|
|
619
|
+
box.material = (_sceneStore$scene$get4 = sceneStore.scene.getMaterialByName('grid_invisible')) !== null && _sceneStore$scene$get4 !== void 0 ? _sceneStore$scene$get4 : new PBRMaterial('grid_invisible', sceneStore.scene);
|
|
620
|
+
box.material.alpha = 0;
|
|
621
|
+
}
|
|
622
|
+
|
|
541
623
|
// the actionmanager can't use the bbox, therefore need to fake it https://forum.babylonjs.com/t/action-manager-pointer-trigger-with-bounding-box/43891
|
|
542
624
|
var fakeBBox = MeshBuilder.CreateBox('binfo_' + box.name, {
|
|
543
|
-
width:
|
|
544
|
-
height:
|
|
545
|
-
depth:
|
|
625
|
+
width: size.width * 1.01,
|
|
626
|
+
height: size.height * 1.01,
|
|
627
|
+
depth: size.depth * 1.01
|
|
546
628
|
}, sceneStore.scene);
|
|
547
|
-
fakeBBox.metadata =
|
|
548
|
-
elementId: elementId,
|
|
549
|
-
rulePos: {
|
|
550
|
-
x: data.rulePosition.x / 100,
|
|
551
|
-
y: data.rulePosition.y / 100,
|
|
552
|
-
z: data.rulePosition.z / 100
|
|
553
|
-
},
|
|
554
|
-
geoPos: new Vector3(data.geoPosition.x / 100, data.geoPosition.y / 100, data.geoPosition.z / 100)
|
|
555
|
-
};
|
|
629
|
+
fakeBBox.metadata = metadata;
|
|
556
630
|
fakeBBox.parent = box;
|
|
557
631
|
fakeBBox.position = Vector3.Zero();
|
|
558
632
|
fakeBBox.isPickable = true;
|
|
@@ -565,7 +639,7 @@ function Grids () {
|
|
|
565
639
|
return box.edgesWidth = 0.5;
|
|
566
640
|
}));
|
|
567
641
|
fakeBBox.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPickTrigger, function () {
|
|
568
|
-
return
|
|
642
|
+
return onPreviewClick(gridStore.getSelectedGrid());
|
|
569
643
|
}));
|
|
570
644
|
fakeBBox.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPickDownTrigger, function () {
|
|
571
645
|
return gridStore.selectedGrid == gridStore.getSelectedGrid() && noMove == false && gridStore.onGridMove(gridStore.getSelectedGrid());
|
|
@@ -573,29 +647,33 @@ function Grids () {
|
|
|
573
647
|
fakeBBox.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function () {
|
|
574
648
|
return box.edgesWidth = 0.2;
|
|
575
649
|
}));
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
650
|
+
Tags.AddTagsTo(box, type);
|
|
651
|
+
Tags.AddTagsTo(box, isFree ? 'free' : 'planned');
|
|
652
|
+
Tags.AddTagsTo(box, noMove ? 'disableMove' : 'allowMove');
|
|
653
|
+
return box;
|
|
654
|
+
}
|
|
655
|
+
function onPreviewClick(mesh) {
|
|
656
|
+
var tag = Tags.GetTags(mesh);
|
|
657
|
+
if (tag.includes('grid')) onGridClick(tag, mesh);else if (tag.includes('box')) onBoxClick(tag, mesh);
|
|
583
658
|
}
|
|
584
|
-
function
|
|
659
|
+
function onBoxClick(tag, mesh) {
|
|
660
|
+
var _utilStore$viewHandle;
|
|
661
|
+
(_utilStore$viewHandle = utilStore.viewHandler) === null || _utilStore$viewHandle === void 0 || _utilStore$viewHandle.viewPlannerHandler.onElementCopy(mesh.metadata.setId, mesh.metadata.elementId, mesh.metadata.direction);
|
|
662
|
+
}
|
|
663
|
+
function onGridClick(tag, mesh) {
|
|
585
664
|
var _gridStore$selectedGr;
|
|
586
665
|
if (!utilStore.viewHandler) return;
|
|
587
|
-
var
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
shelfIdx = _ref.shelfIdx;
|
|
666
|
+
var _ref3 = gridStore.getDataFromGridName(mesh.name, mesh.metadata.elementId),
|
|
667
|
+
basketId = _ref3.parentBasketId,
|
|
668
|
+
gridIdx = _ref3.gridIdx,
|
|
669
|
+
shelfIdx = _ref3.shelfIdx;
|
|
592
670
|
var plannedPlace = _plannedPlaceOnGrids.find(function (plannedPlace) {
|
|
593
671
|
return plannedPlace.elementId == mesh.metadata.elementId;
|
|
594
672
|
});
|
|
595
|
-
var grid = Object.entries(plannedPlace.grids).find(function (
|
|
596
|
-
var
|
|
597
|
-
|
|
598
|
-
var grid =
|
|
673
|
+
var grid = Object.entries(plannedPlace.grids).find(function (_ref4) {
|
|
674
|
+
var _ref5 = _slicedToArray(_ref4, 2);
|
|
675
|
+
_ref5[0];
|
|
676
|
+
var grid = _ref5[1];
|
|
599
677
|
return grid.idx == gridIdx;
|
|
600
678
|
})[1];
|
|
601
679
|
var accessorie = grid.accessories.find(function (accessorie) {
|
|
@@ -608,21 +686,25 @@ function Grids () {
|
|
|
608
686
|
utilStore.viewHandler.paletteViewHandler.selectShelfAccessorie(accessorie === null || accessorie === void 0 ? void 0 : accessorie.articleCodex, accessorie === null || accessorie === void 0 ? void 0 : accessorie.basketId);
|
|
609
687
|
gridStore.selectGrid(mesh, gridIdx, shelfIdx, basketId, tag.includes('disableDelete'), tag.includes('disableMove'));
|
|
610
688
|
}
|
|
611
|
-
return;
|
|
612
689
|
}
|
|
613
690
|
return {
|
|
691
|
+
setupPreviewBoxs: setupPreviewBoxs,
|
|
614
692
|
setupPreviewGrids: setupPreviewGrids,
|
|
615
|
-
|
|
693
|
+
onPreviewClick: onPreviewClick,
|
|
616
694
|
deleteAllGrids: deleteAllGrids
|
|
617
695
|
};
|
|
618
696
|
}
|
|
619
697
|
|
|
698
|
+
function _createForOfIteratorHelper$8(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$8(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
699
|
+
function _unsupportedIterableToArray$8(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$8(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$8(r, a) : void 0; } }
|
|
700
|
+
function _arrayLikeToArray$8(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
701
|
+
|
|
620
702
|
/*
|
|
621
703
|
SceneStore
|
|
622
704
|
Wraps the scene with additional data and methods
|
|
623
705
|
*/
|
|
624
706
|
var GridStore = /*#__PURE__*/function () {
|
|
625
|
-
function GridStore(sceneStore, uiStore, viewHandler) {
|
|
707
|
+
function GridStore(sceneStore, uiStore, type, viewHandler) {
|
|
626
708
|
_classCallCheck(this, GridStore);
|
|
627
709
|
_defineProperty(this, "_gridControls", undefined);
|
|
628
710
|
_defineProperty(this, "_allGrids", void 0);
|
|
@@ -634,9 +716,14 @@ var GridStore = /*#__PURE__*/function () {
|
|
|
634
716
|
_defineProperty(this, "_viewHandler", void 0);
|
|
635
717
|
_defineProperty(this, "_selectedGrid", void 0);
|
|
636
718
|
_defineProperty(this, "_uiStore", void 0);
|
|
719
|
+
_defineProperty(this, "_type", void 0);
|
|
720
|
+
_defineProperty(this, "_plannerInteractionInformation", void 0);
|
|
721
|
+
_defineProperty(this, "_generalPlanningState", void 0);
|
|
722
|
+
_defineProperty(this, "_elementsInfos", void 0);
|
|
637
723
|
this._sceneStore = sceneStore;
|
|
638
724
|
this._viewHandler = viewHandler;
|
|
639
725
|
this._uiStore = uiStore;
|
|
726
|
+
this._type = type !== null && type !== void 0 ? type : '3DCOMB';
|
|
640
727
|
}
|
|
641
728
|
return _createClass(GridStore, [{
|
|
642
729
|
key: "plannedPlacesOnGrids",
|
|
@@ -656,25 +743,33 @@ var GridStore = /*#__PURE__*/function () {
|
|
|
656
743
|
}, {
|
|
657
744
|
key: "getSelectedGrid",
|
|
658
745
|
value: function getSelectedGrid() {
|
|
659
|
-
var
|
|
746
|
+
var _this$_sceneStore$sce;
|
|
747
|
+
var pickInfo = (_this$_sceneStore$sce = this._sceneStore.scene.multiPick(this._sceneStore.scene.pointerX, this._sceneStore.scene.pointerY)) === null || _this$_sceneStore$sce === void 0 ? void 0 : _this$_sceneStore$sce.filter(function (p) {
|
|
748
|
+
return p !== undefined;
|
|
749
|
+
});
|
|
660
750
|
var pickedGrids = pickInfo === null || pickInfo === void 0 ? void 0 : pickInfo.filter(function (pick) {
|
|
661
|
-
var _Tags$GetTags;
|
|
662
|
-
return (_Tags$GetTags = Tags.GetTags(pick.pickedMesh)) === null || _Tags$GetTags === void 0 ? void 0 : _Tags$GetTags.includes('grid');
|
|
751
|
+
var _Tags$GetTags, _Tags$GetTags2;
|
|
752
|
+
return ((_Tags$GetTags = Tags.GetTags(pick.pickedMesh)) === null || _Tags$GetTags === void 0 ? void 0 : _Tags$GetTags.includes('grid')) || ((_Tags$GetTags2 = Tags.GetTags(pick.pickedMesh)) === null || _Tags$GetTags2 === void 0 ? void 0 : _Tags$GetTags2.includes('box'));
|
|
663
753
|
});
|
|
664
754
|
return pickedGrids[pickedGrids.length - 1].pickedMesh;
|
|
665
755
|
}
|
|
666
756
|
}, {
|
|
667
757
|
key: "onGridMove",
|
|
668
758
|
value: function onGridMove(box) {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
759
|
+
if (this._type == 'RTViewer') {
|
|
760
|
+
var _ref = this.getDataFromGridName(box.name, box.metadata.elementId),
|
|
761
|
+
accessoireBasketId = _ref.accessoireBasketId,
|
|
762
|
+
parentBasketId = _ref.parentBasketId,
|
|
763
|
+
gridIdx = _ref.gridIdx,
|
|
764
|
+
shelfIdx = _ref.shelfIdx,
|
|
765
|
+
gridName = _ref.gridName;
|
|
766
|
+
this.getMoveGrids(gridName, accessoireBasketId);
|
|
767
|
+
this._gridControls = getGridControls(this._sceneStore.scene, this._sceneStore.scene.getEngine().getRenderingCanvas(), this._sceneStore.scene.getMeshByName(box.name), this._sceneStore.elements, this.selectGrid.bind(this));
|
|
768
|
+
this._gridControls.registerGrid(parentBasketId, gridIdx, shelfIdx, accessoireBasketId);
|
|
769
|
+
} else if (this._type == 'BoxPlanner') {
|
|
770
|
+
this._gridControls = getGridControls(this._sceneStore.scene, this._sceneStore.scene.getEngine().getRenderingCanvas(), this._sceneStore.scene.getTransformNodeByName(box.name), this._sceneStore.elements, this.selectGrid.bind(this));
|
|
771
|
+
this._gridControls.registerBox();
|
|
772
|
+
}
|
|
678
773
|
}
|
|
679
774
|
}, {
|
|
680
775
|
key: "selectGrid",
|
|
@@ -696,20 +791,22 @@ var GridStore = /*#__PURE__*/function () {
|
|
|
696
791
|
key: "getMoveGrids",
|
|
697
792
|
value: function () {
|
|
698
793
|
var _getMoveGrids = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(gridName, basketId) {
|
|
699
|
-
var _this$_viewHandler;
|
|
700
|
-
var fp;
|
|
794
|
+
var freePlaces, _this$_viewHandler;
|
|
701
795
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
702
796
|
while (1) switch (_context.prev = _context.next) {
|
|
703
797
|
case 0:
|
|
704
|
-
|
|
705
|
-
if (
|
|
706
|
-
|
|
798
|
+
freePlaces = [];
|
|
799
|
+
if (this._type == 'RTViewer') {
|
|
800
|
+
freePlaces = (_this$_viewHandler = this._viewHandler) === null || _this$_viewHandler === void 0 ? void 0 : _this$_viewHandler.divaWebPlanner.getFreeToMovePlacesOnGrids(gridName, basketId);
|
|
801
|
+
}
|
|
802
|
+
if (!(!freePlaces || !this._plannedPlacesOnGrids)) {
|
|
803
|
+
_context.next = 4;
|
|
707
804
|
break;
|
|
708
805
|
}
|
|
709
806
|
return _context.abrupt("return");
|
|
710
|
-
case 3:
|
|
711
|
-
this.getGrids(fp, this._plannedPlacesOnGrids, true, true);
|
|
712
807
|
case 4:
|
|
808
|
+
this.getGrids(freePlaces, this._plannedPlacesOnGrids, true, true);
|
|
809
|
+
case 5:
|
|
713
810
|
case "end":
|
|
714
811
|
return _context.stop();
|
|
715
812
|
}
|
|
@@ -755,33 +852,56 @@ var GridStore = /*#__PURE__*/function () {
|
|
|
755
852
|
});
|
|
756
853
|
return res;
|
|
757
854
|
}
|
|
855
|
+
}, {
|
|
856
|
+
key: "getGrids1",
|
|
857
|
+
value: function () {
|
|
858
|
+
var _getGrids = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(generalPlanningState, callback) {
|
|
859
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
860
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
861
|
+
case 0:
|
|
862
|
+
this._generalPlanningState = generalPlanningState;
|
|
863
|
+
if (!this._grid) this._grid = Grids();
|
|
864
|
+
this._grid.deleteAllGrids();
|
|
865
|
+
this._grid.setupPreviewBoxs(generalPlanningState);
|
|
866
|
+
callback();
|
|
867
|
+
case 5:
|
|
868
|
+
case "end":
|
|
869
|
+
return _context2.stop();
|
|
870
|
+
}
|
|
871
|
+
}, _callee2, this);
|
|
872
|
+
}));
|
|
873
|
+
function getGrids1(_x3, _x4) {
|
|
874
|
+
return _getGrids.apply(this, arguments);
|
|
875
|
+
}
|
|
876
|
+
return getGrids1;
|
|
877
|
+
}()
|
|
758
878
|
}, {
|
|
759
879
|
key: "getGrids",
|
|
760
880
|
value: function () {
|
|
761
|
-
var
|
|
881
|
+
var _getGrids2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(freePlacesOnGrids, plannedPlacesOnGrids, doNotRelod, doNotOverwrite) {
|
|
762
882
|
var _this$_viewHandler3, _this$_viewHandler4;
|
|
763
883
|
var _this$_sceneStore$api, res;
|
|
764
|
-
return _regeneratorRuntime.wrap(function
|
|
765
|
-
while (1) switch (
|
|
884
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
885
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
766
886
|
case 0:
|
|
767
887
|
if (!this._grid) this._grid = Grids();
|
|
768
888
|
if (!(!((_this$_viewHandler3 = this._viewHandler) !== null && _this$_viewHandler3 !== void 0 && _this$_viewHandler3.tabgroupTypeActive('SHELFPLANNER')) || !freePlacesOnGrids && !plannedPlacesOnGrids)) {
|
|
769
|
-
|
|
889
|
+
_context3.next = 5;
|
|
770
890
|
break;
|
|
771
891
|
}
|
|
772
892
|
this._grid.deleteAllGrids();
|
|
773
893
|
this._uiStore.removeGridGui();
|
|
774
|
-
return
|
|
894
|
+
return _context3.abrupt("return");
|
|
775
895
|
case 5:
|
|
776
896
|
if (!(!doNotRelod && plannedPlacesOnGrids && JSON.stringify(plannedPlacesOnGrids[0].plannedOptions) != JSON.stringify(this._plannedOptions))) {
|
|
777
|
-
|
|
897
|
+
_context3.next = 15;
|
|
778
898
|
break;
|
|
779
899
|
}
|
|
780
900
|
this._plannedOptions = this._buildPlannedOptions(plannedPlacesOnGrids);
|
|
781
901
|
plannedPlacesOnGrids.forEach(function (pP) {
|
|
782
902
|
return pP.shelf3DName;
|
|
783
903
|
});
|
|
784
|
-
|
|
904
|
+
_context3.next = 10;
|
|
785
905
|
return fetch(((_this$_sceneStore$api = this._sceneStore.apiConfig) === null || _this$_sceneStore$api === void 0 ? void 0 : _this$_sceneStore$api.constructorService) + '/articles/grids/all?catalogCodex=' + plannedPlacesOnGrids[0].catalogCodex + '&catalogILN=' + plannedPlacesOnGrids[0].iln + '&debug=' + !!this._sceneStore.apiConfig.useDebugUrl, {
|
|
786
906
|
headers: {
|
|
787
907
|
Authorization: "Bearer ".concat(this._sceneStore.jwt),
|
|
@@ -794,40 +914,40 @@ var GridStore = /*#__PURE__*/function () {
|
|
|
794
914
|
})
|
|
795
915
|
});
|
|
796
916
|
case 10:
|
|
797
|
-
res =
|
|
917
|
+
res = _context3.sent;
|
|
798
918
|
this._plannedOptions = this._buildPlannedOptions(plannedPlacesOnGrids);
|
|
799
|
-
|
|
919
|
+
_context3.next = 14;
|
|
800
920
|
return res.json();
|
|
801
921
|
case 14:
|
|
802
|
-
this._allGrids =
|
|
922
|
+
this._allGrids = _context3.sent;
|
|
803
923
|
case 15:
|
|
804
924
|
if (this._allGrids) {
|
|
805
|
-
|
|
925
|
+
_context3.next = 17;
|
|
806
926
|
break;
|
|
807
927
|
}
|
|
808
|
-
return
|
|
928
|
+
return _context3.abrupt("return");
|
|
809
929
|
case 17:
|
|
810
930
|
if (!(!((_this$_viewHandler4 = this._viewHandler) !== null && _this$_viewHandler4 !== void 0 && _this$_viewHandler4.tabgroupTypeActive('SHELFPLANNER')) || !freePlacesOnGrids && !plannedPlacesOnGrids)) {
|
|
811
|
-
|
|
931
|
+
_context3.next = 21;
|
|
812
932
|
break;
|
|
813
933
|
}
|
|
814
934
|
this._grid.deleteAllGrids();
|
|
815
935
|
this._uiStore.removeGridGui();
|
|
816
|
-
return
|
|
936
|
+
return _context3.abrupt("return");
|
|
817
937
|
case 21:
|
|
818
|
-
this._grid.setupPreviewGrids(this._allGrids, plannedPlacesOnGrids, freePlacesOnGrids);
|
|
938
|
+
if (plannedPlacesOnGrids) this._grid.setupPreviewGrids(this._allGrids, plannedPlacesOnGrids, freePlacesOnGrids);
|
|
819
939
|
if (!doNotOverwrite) {
|
|
820
940
|
this._freePlacesOnGrids = freePlacesOnGrids;
|
|
821
941
|
this._plannedPlacesOnGrids = plannedPlacesOnGrids;
|
|
822
942
|
}
|
|
823
943
|
case 23:
|
|
824
944
|
case "end":
|
|
825
|
-
return
|
|
945
|
+
return _context3.stop();
|
|
826
946
|
}
|
|
827
|
-
},
|
|
947
|
+
}, _callee3, this);
|
|
828
948
|
}));
|
|
829
|
-
function getGrids(
|
|
830
|
-
return
|
|
949
|
+
function getGrids(_x5, _x6, _x7, _x8) {
|
|
950
|
+
return _getGrids2.apply(this, arguments);
|
|
831
951
|
}
|
|
832
952
|
return getGrids;
|
|
833
953
|
}()
|
|
@@ -858,6 +978,58 @@ var GridStore = /*#__PURE__*/function () {
|
|
|
858
978
|
gridName: gridName
|
|
859
979
|
};
|
|
860
980
|
}
|
|
981
|
+
}, {
|
|
982
|
+
key: "setupElementMove",
|
|
983
|
+
value: function setupElementMove(elementNames, moveObjectInDirection) {
|
|
984
|
+
var _this2 = this;
|
|
985
|
+
if (this._type != 'BoxPlanner') return;
|
|
986
|
+
var _iterator = _createForOfIteratorHelper$8(elementNames),
|
|
987
|
+
_step;
|
|
988
|
+
try {
|
|
989
|
+
var _loop = function _loop() {
|
|
990
|
+
var element = _step.value;
|
|
991
|
+
var node = _this2._sceneStore.scene.getTransformNodeByName(element);
|
|
992
|
+
if (!node) return 1; // continue
|
|
993
|
+
var bbox = node.getHierarchyBoundingVectors();
|
|
994
|
+
var width = bbox.max.x - bbox.min.x;
|
|
995
|
+
var height = bbox.max.y - bbox.min.y;
|
|
996
|
+
var depth = bbox.max.y - bbox.min.y;
|
|
997
|
+
var fakeBBox = MeshBuilder.CreateBox('element_bbox_' + node.name, {
|
|
998
|
+
width: width * 1.01,
|
|
999
|
+
height: height * 1.01,
|
|
1000
|
+
depth: depth * 1.01
|
|
1001
|
+
}, _this2._sceneStore.scene);
|
|
1002
|
+
fakeBBox.parent = node;
|
|
1003
|
+
fakeBBox.position = Vector3.Zero();
|
|
1004
|
+
fakeBBox.isPickable = true;
|
|
1005
|
+
fakeBBox.setEnabled(true);
|
|
1006
|
+
fakeBBox.isVisible = false;
|
|
1007
|
+
fakeBBox.enablePointerMoveEvents = true;
|
|
1008
|
+
fakeBBox.actionManager = new ActionManager(_this2._sceneStore.scene);
|
|
1009
|
+
fakeBBox.actionManager.hoverCursor = 'pointer';
|
|
1010
|
+
fakeBBox.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPickDownTrigger, function () {
|
|
1011
|
+
return _this2.onGridMove(node);
|
|
1012
|
+
}));
|
|
1013
|
+
Tags.AddTagsTo(node, 'grid');
|
|
1014
|
+
Tags.AddTagsTo(node, 'free');
|
|
1015
|
+
Tags.AddTagsTo(node, 'allowMove');
|
|
1016
|
+
node.metadata = {
|
|
1017
|
+
elementId: node.name,
|
|
1018
|
+
type: 'BOX'
|
|
1019
|
+
};
|
|
1020
|
+
moveObjectInDirection(fakeBBox, Vector3.Right(), width / 2);
|
|
1021
|
+
moveObjectInDirection(fakeBBox, Vector3.Up(), height / 2);
|
|
1022
|
+
moveObjectInDirection(fakeBBox, Vector3.Forward(), -depth / 2);
|
|
1023
|
+
};
|
|
1024
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1025
|
+
if (_loop()) continue;
|
|
1026
|
+
}
|
|
1027
|
+
} catch (err) {
|
|
1028
|
+
_iterator.e(err);
|
|
1029
|
+
} finally {
|
|
1030
|
+
_iterator.f();
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
861
1033
|
}]);
|
|
862
1034
|
}();
|
|
863
1035
|
|
|
@@ -902,9 +1074,9 @@ function shadow() {
|
|
|
902
1074
|
var lightl = new DirectionalLight('dirb', new Vector3(0, 0, 1), scene);
|
|
903
1075
|
var topLight = new DirectionalLight('dirt', new Vector3(0, -1, 0), scene);
|
|
904
1076
|
lightl.intensity = .5;
|
|
905
|
-
lightf.intensity =
|
|
1077
|
+
lightf.intensity = 1;
|
|
906
1078
|
light.intensity = 1;
|
|
907
|
-
topLight.intensity = 1
|
|
1079
|
+
topLight.intensity = 1;
|
|
908
1080
|
lightl.range = 5;
|
|
909
1081
|
lightl.falloffType = 1;
|
|
910
1082
|
topLight.range = 5;
|
|
@@ -1354,7 +1526,7 @@ var SceneStore = /*#__PURE__*/function () {
|
|
|
1354
1526
|
key: "runRenderLoop",
|
|
1355
1527
|
value: function runRenderLoop() {
|
|
1356
1528
|
var engine = this._scene.getEngine();
|
|
1357
|
-
if (this
|
|
1529
|
+
if (!this._scene || !this._scene.activeCamera || engine.activeRenderLoops.length != 0) return;
|
|
1358
1530
|
engine.runRenderLoop(this.renderLoop.bind(this));
|
|
1359
1531
|
}
|
|
1360
1532
|
}, {
|
|
@@ -1509,42 +1681,52 @@ var SceneStore = /*#__PURE__*/function () {
|
|
|
1509
1681
|
}, {
|
|
1510
1682
|
key: "exportScene",
|
|
1511
1683
|
value: function () {
|
|
1512
|
-
var _exportScene = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1513
|
-
var
|
|
1514
|
-
return _regeneratorRuntime.wrap(function
|
|
1515
|
-
while (1) switch (
|
|
1684
|
+
var _exportScene = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(setGlb) {
|
|
1685
|
+
var _this3 = this;
|
|
1686
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
1687
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1516
1688
|
case 0:
|
|
1517
1689
|
if (!this._cancelSceneExport) {
|
|
1518
|
-
|
|
1690
|
+
_context2.next = 2;
|
|
1519
1691
|
break;
|
|
1520
1692
|
}
|
|
1521
|
-
return
|
|
1522
|
-
return undefined;
|
|
1523
|
-
}));
|
|
1693
|
+
return _context2.abrupt("return");
|
|
1524
1694
|
case 2:
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1695
|
+
this._scene.render();
|
|
1696
|
+
this._scene.executeWhenReady(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
1697
|
+
var res;
|
|
1698
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1699
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1700
|
+
case 0:
|
|
1701
|
+
_context.next = 2;
|
|
1702
|
+
return GLTF2Export.GLBAsync(_this3._scene, 'fileName', {
|
|
1703
|
+
shouldExportNode: _this3.shouldExport.bind(_this3),
|
|
1704
|
+
exportUnusedUVs: false,
|
|
1705
|
+
exportWithoutWaitingForScene: false,
|
|
1706
|
+
removeNoopRootNodes: false,
|
|
1707
|
+
shouldExportAnimation: function shouldExportAnimation() {
|
|
1708
|
+
return false;
|
|
1709
|
+
},
|
|
1710
|
+
metadataSelector: function metadataSelector() {
|
|
1711
|
+
return false;
|
|
1712
|
+
}
|
|
1713
|
+
});
|
|
1714
|
+
case 2:
|
|
1715
|
+
res = _context.sent;
|
|
1716
|
+
setGlb(res.files['fileName.glb']);
|
|
1717
|
+
case 4:
|
|
1718
|
+
case "end":
|
|
1719
|
+
return _context.stop();
|
|
1720
|
+
}
|
|
1721
|
+
}, _callee);
|
|
1722
|
+
})));
|
|
1538
1723
|
case 4:
|
|
1539
|
-
res = _context.sent;
|
|
1540
|
-
return _context.abrupt("return", res);
|
|
1541
|
-
case 6:
|
|
1542
1724
|
case "end":
|
|
1543
|
-
return
|
|
1725
|
+
return _context2.stop();
|
|
1544
1726
|
}
|
|
1545
|
-
},
|
|
1727
|
+
}, _callee2, this);
|
|
1546
1728
|
}));
|
|
1547
|
-
function exportScene() {
|
|
1729
|
+
function exportScene(_x) {
|
|
1548
1730
|
return _exportScene.apply(this, arguments);
|
|
1549
1731
|
}
|
|
1550
1732
|
return exportScene;
|
|
@@ -1719,7 +1901,7 @@ function _arrayLikeToArray$5(r, a) { (null == a || a > r.length) && (a = r.lengt
|
|
|
1719
1901
|
*/
|
|
1720
1902
|
|
|
1721
1903
|
var UIStore = /*#__PURE__*/function () {
|
|
1722
|
-
function UIStore(scene, enableSSAO, _utilStore, uiConfig, requestNewOverlayImage, _overlayImage, onElementCopy, runRenderLoopForTime, tabgroupTypeActive, isMobile) {
|
|
1904
|
+
function UIStore(scene, enableSSAO, _utilStore, uiConfig, requestNewOverlayImage, _overlayImage, onElementCopy, runRenderLoopForTime, tabgroupTypeActive, isMobile, getPlannerInteractionInformation) {
|
|
1723
1905
|
var _this = this,
|
|
1724
1906
|
_overlayImage$base;
|
|
1725
1907
|
_classCallCheck(this, UIStore);
|
|
@@ -1754,6 +1936,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1754
1936
|
_defineProperty(this, "_tabgroupTypeActive", void 0);
|
|
1755
1937
|
_defineProperty(this, "_isMobile", void 0);
|
|
1756
1938
|
_defineProperty(this, "_guiIsPicked", void 0);
|
|
1939
|
+
_defineProperty(this, "_getPlannerInteractionInformation", void 0);
|
|
1757
1940
|
_defineProperty(this, "updateOverlayImage", function (overlayImage) {
|
|
1758
1941
|
var _this$_diffuseTexture;
|
|
1759
1942
|
if (!overlayImage || !_this._scene || ((_this$_diffuseTexture = _this._diffuseTexture) === null || _this$_diffuseTexture === void 0 ? void 0 : _this$_diffuseTexture.url) == overlayImage.base64) return;
|
|
@@ -1764,9 +1947,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1764
1947
|
// no highlightlayer on static room bg
|
|
1765
1948
|
_this.deactivateHighlightLayer();
|
|
1766
1949
|
_this._plane.setEnabled(true);
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
_this._plane.setEnabled(false);
|
|
1950
|
+
} // never switch to rtv when in room
|
|
1951
|
+
else _this._plane.setEnabled(false);
|
|
1770
1952
|
_this.resize();
|
|
1771
1953
|
_this._diffuseTexture.updateURL(overlayImage.base64, undefined, function () {
|
|
1772
1954
|
return _this.fadeInOverlayImage(_this._plane.visibility == 1 || !!_this._isStaticBg);
|
|
@@ -1776,23 +1958,24 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1776
1958
|
this._tabgroupTypeActive = tabgroupTypeActive;
|
|
1777
1959
|
this._isMobile = window.innerWidth < 768; // == is phone for now
|
|
1778
1960
|
this._guiIsPicked = false;
|
|
1961
|
+
this._getPlannerInteractionInformation = getPlannerInteractionInformation;
|
|
1779
1962
|
|
|
1780
1963
|
// Define shader
|
|
1781
|
-
Effect.ShadersStore[
|
|
1782
|
-
Effect.ShadersStore[
|
|
1964
|
+
Effect.ShadersStore['customVertexShader'] = "\n precision highp float;\n\n attribute vec3 position;\n attribute vec2 uv;\n\n uniform mat4 worldViewProjection;\n\n varying vec2 vUV;\n\n void main(void) {\n gl_Position = worldViewProjection * vec4(position, 1.0);\n vUV = uv;\n }\n ";
|
|
1965
|
+
Effect.ShadersStore['customFragmentShader'] = "\n precision highp float;\n\n varying vec2 vUV;\n\n uniform sampler2D textureSampler;\n uniform vec2 scale;\n uniform float visibility;\n\n void main(void) {\n vec2 center = vec2(0.5, 0.5);\n vec2 halfScale = scale * 0.5;\n vec2 minUV = center - halfScale;\n vec2 maxUV = center + halfScale;\n\n // Always sample the texture\n vec2 localUV = (vUV - minUV) / scale;\n vec4 texColor = texture2D(textureSampler, localUV);\n\n // Calculate mask: 1.0 inside, 0.0 outside\n float inside = step(minUV.x, vUV.x) * step(vUV.x, maxUV.x)\n * step(minUV.y, vUV.y) * step(vUV.y, maxUV.y);\n\n // Mix texture and white\n vec4 finalColor = mix(vec4(1.0), texColor, inside);\n gl_FragColor = finalColor;\n gl_FragColor.a *= visibility;\n }\n ";
|
|
1783
1966
|
|
|
1784
1967
|
// Create material
|
|
1785
|
-
var shaderMat = new ShaderMaterial(
|
|
1786
|
-
vertex:
|
|
1787
|
-
fragment:
|
|
1968
|
+
var shaderMat = new ShaderMaterial('shader', scene, {
|
|
1969
|
+
vertex: 'custom',
|
|
1970
|
+
fragment: 'custom'
|
|
1788
1971
|
}, {
|
|
1789
|
-
attributes: [
|
|
1790
|
-
uniforms: [
|
|
1791
|
-
samplers: [
|
|
1972
|
+
attributes: ['position', 'uv'],
|
|
1973
|
+
uniforms: ['worldViewProjection', 'scale', 'visibility'],
|
|
1974
|
+
samplers: ['textureSampler']
|
|
1792
1975
|
});
|
|
1793
1976
|
this._diffuseTexture = new Texture((_overlayImage$base = _overlayImage === null || _overlayImage === void 0 ? void 0 : _overlayImage.base64) !== null && _overlayImage$base !== void 0 ? _overlayImage$base : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAwAB/ep3wWkAAAAASUVORK5CYII=', scene, false, true);
|
|
1794
|
-
shaderMat.setTexture(
|
|
1795
|
-
shaderMat.setVector2(
|
|
1977
|
+
shaderMat.setTexture('textureSampler', this._diffuseTexture);
|
|
1978
|
+
shaderMat.setVector2('scale', new Vector2(1, 1)); // adjust scale here
|
|
1796
1979
|
shaderMat.alpha = 1;
|
|
1797
1980
|
shaderMat.backFaceCulling = true;
|
|
1798
1981
|
|
|
@@ -1806,7 +1989,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1806
1989
|
this._shaderMat = shaderMat;
|
|
1807
1990
|
|
|
1808
1991
|
// Position it in front of the camera
|
|
1809
|
-
this._plane.position.z = 0.11;
|
|
1992
|
+
this._plane.position.z = -0.11;
|
|
1993
|
+
this._plane.rotation.y = 180 * Math.PI / 180;
|
|
1810
1994
|
this._plane.isPickable = false;
|
|
1811
1995
|
this._plane.parent = scene.activeCamera;
|
|
1812
1996
|
this._selectedHl = new HighlightLayer('hl', this._scene);
|
|
@@ -1826,7 +2010,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1826
2010
|
templateConfig: 'standard',
|
|
1827
2011
|
posNumIcon: 'TOP_LEFT_BACK',
|
|
1828
2012
|
posTrashIcon: 'POSNUM_TOP',
|
|
1829
|
-
hideUiIcons: false
|
|
2013
|
+
hideUiIcons: false,
|
|
2014
|
+
plannerMode: '3DCOMB'
|
|
1830
2015
|
};
|
|
1831
2016
|
if (this._uiConfig.templateConfig == 'gold') {
|
|
1832
2017
|
this._colors.defaultBg = '#dfdfdf';
|
|
@@ -1876,7 +2061,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1876
2061
|
key: "fadeOutOverlayImage",
|
|
1877
2062
|
value: function fadeOutOverlayImage() {
|
|
1878
2063
|
this._plane.visibility = 0;
|
|
1879
|
-
this._shaderMat.setFloat(
|
|
2064
|
+
this._shaderMat.setFloat('visiblity', 0);
|
|
1880
2065
|
var root = this._scene.getTransformNodeByName('Root');
|
|
1881
2066
|
if (root) root.getChildMeshes().forEach(function (m) {
|
|
1882
2067
|
m.visibility = 1;
|
|
@@ -1897,7 +2082,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1897
2082
|
var progress = Math.min(elapsedTime / 500, 1); // Normalize progress (0 to 1)
|
|
1898
2083
|
|
|
1899
2084
|
_this3._plane.visibility = skip ? 1 : progress;
|
|
1900
|
-
_this3._shaderMat.setFloat(
|
|
2085
|
+
_this3._shaderMat.setFloat('visibility', skip ? 1 : progress);
|
|
1901
2086
|
if (!skip && progress < 1) {
|
|
1902
2087
|
requestAnimationFrame(_animate);
|
|
1903
2088
|
} else {
|
|
@@ -1907,7 +2092,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1907
2092
|
var engine = _this3._scene.getEngine();
|
|
1908
2093
|
var ratio = size.width / size.height;
|
|
1909
2094
|
var engineRatio = engine.getRenderWidth() / engine.getRenderHeight();
|
|
1910
|
-
_this3._shaderMat.setVector2(
|
|
2095
|
+
_this3._shaderMat.setVector2('scale', new Vector2(1 / (engineRatio / ratio), 1)); // adjust scale here */
|
|
1911
2096
|
|
|
1912
2097
|
var root = _this3._scene.getTransformNodeByName('Root');
|
|
1913
2098
|
if (root) root.getChildMeshes().forEach(function (m) {
|
|
@@ -1923,10 +2108,18 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1923
2108
|
};
|
|
1924
2109
|
_animate();
|
|
1925
2110
|
}
|
|
2111
|
+
}, {
|
|
2112
|
+
key: "excludePreviewBoxes",
|
|
2113
|
+
value: function excludePreviewBoxes() {
|
|
2114
|
+
var _this4 = this;
|
|
2115
|
+
this._scene.getMeshesByTags('box').forEach(function (m) {
|
|
2116
|
+
return _this4._selectedHl.addExcludedMesh(m);
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
1926
2119
|
}, {
|
|
1927
2120
|
key: "createGridGui",
|
|
1928
2121
|
value: function createGridGui(mesh, onClickDel) {
|
|
1929
|
-
var
|
|
2122
|
+
var _this5 = this;
|
|
1930
2123
|
if (!this._selectionHandler || !mesh || this._uiConfig.hideUiIcons) return;
|
|
1931
2124
|
this.removeGridGui();
|
|
1932
2125
|
var guiElem = new TransformNode('gridGuiElem', this._scene);
|
|
@@ -1951,10 +2144,10 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1951
2144
|
dbt.height = this._uiConfig.templateConfig == 'standard' ? nSize : '70%';
|
|
1952
2145
|
dbt.onPointerClickObservable.add(onClickDel);
|
|
1953
2146
|
dtarget.onPointerEnterObservable = new Observable(function () {
|
|
1954
|
-
return dtarget.background =
|
|
2147
|
+
return dtarget.background = _this5._colors.gridHoverBg;
|
|
1955
2148
|
});
|
|
1956
2149
|
dtarget.onPointerOutObservable = new Observable(function () {
|
|
1957
|
-
return dtarget.background =
|
|
2150
|
+
return dtarget.background = _this5._colors.defaultBg;
|
|
1958
2151
|
});
|
|
1959
2152
|
if (this._uiConfig.templateConfig == 'standard') dtarget.linkOffsetY = -48;
|
|
1960
2153
|
dtarget.addControl(dbt);
|
|
@@ -1982,7 +2175,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1982
2175
|
engine.resize();
|
|
1983
2176
|
var ratio = size.width / size.height;
|
|
1984
2177
|
var engineRatio = engine.getRenderWidth() / engine.getRenderHeight();
|
|
1985
|
-
this._shaderMat.setVector2(
|
|
2178
|
+
this._shaderMat.setVector2('scale', new Vector2(1 / (engineRatio / ratio), 1)); // adjust scale here */
|
|
1986
2179
|
this._gui.dispose();
|
|
1987
2180
|
this._gui = AdvancedDynamicTexture.CreateFullscreenUI('UI', true, this._scene);
|
|
1988
2181
|
this._gui.renderScale = 1;
|
|
@@ -2004,7 +2197,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2004
2197
|
key: "pointerOverElement",
|
|
2005
2198
|
value: function pointerOverElement(element) {
|
|
2006
2199
|
var _this$_runRenderLoopF,
|
|
2007
|
-
|
|
2200
|
+
_this6 = this;
|
|
2008
2201
|
this.unityCombActive && ((_this$_runRenderLoopF = this._runRenderLoopForTime) === null || _this$_runRenderLoopF === void 0 ? void 0 : _this$_runRenderLoopF.call(this, 5000));
|
|
2009
2202
|
this._selectedHl.removeAllMeshes();
|
|
2010
2203
|
this._selectedHl.addExcludedMesh(this._plane);
|
|
@@ -2013,14 +2206,14 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2013
2206
|
});
|
|
2014
2207
|
element.getChildMeshes().forEach(function (_m) {
|
|
2015
2208
|
_m.visibility = 1;
|
|
2016
|
-
|
|
2209
|
+
_this6._selectedHl.addMesh(_m, Color3.Black());
|
|
2017
2210
|
});
|
|
2018
2211
|
}
|
|
2019
2212
|
}, {
|
|
2020
2213
|
key: "pointerOutElement",
|
|
2021
2214
|
value: function pointerOutElement(element) {
|
|
2022
2215
|
var _this$_runRenderLoopF2,
|
|
2023
|
-
|
|
2216
|
+
_this7 = this;
|
|
2024
2217
|
this.unityCombActive && ((_this$_runRenderLoopF2 = this._runRenderLoopForTime) === null || _this$_runRenderLoopF2 === void 0 ? void 0 : _this$_runRenderLoopF2.call(this, 5000));
|
|
2025
2218
|
this._selectedHl.removeAllMeshes();
|
|
2026
2219
|
this._selectedHl.addExcludedMesh(this._plane);
|
|
@@ -2029,15 +2222,44 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2029
2222
|
});
|
|
2030
2223
|
this._selectedMeshes.forEach(function (_m) {
|
|
2031
2224
|
_m.visibility = 1;
|
|
2032
|
-
|
|
2225
|
+
_this7._selectedHl.addMesh(_m, Color3.Black());
|
|
2033
2226
|
});
|
|
2034
2227
|
}
|
|
2228
|
+
}, {
|
|
2229
|
+
key: "createTrash",
|
|
2230
|
+
value: function createTrash(guiElem, node, elementInfo) {
|
|
2231
|
+
var _this$_tabgroupTypeAc,
|
|
2232
|
+
_this8 = this;
|
|
2233
|
+
if (((_this$_tabgroupTypeAc = this._tabgroupTypeActive) !== null && _this$_tabgroupTypeAc !== void 0 && _this$_tabgroupTypeAc.call(this, 'PLANNER') || this._uiConfig.plannerMode == 'BoxPlanner') && elementInfo.active) {
|
|
2234
|
+
var dtarget = this._uiConfig.templateConfig == 'standard' ? new Ellipse('deleteEllipse') : new Rectangle('deleteEllipse');
|
|
2235
|
+
guiElem.elements.push(dtarget);
|
|
2236
|
+
var size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '28px' : '40px' : '35px';
|
|
2237
|
+
dtarget.width = size;
|
|
2238
|
+
dtarget.height = size;
|
|
2239
|
+
dtarget.thickness = 1;
|
|
2240
|
+
dtarget.background = this._colors.defaultBg;
|
|
2241
|
+
var dbt = Button.CreateImageOnlyButton('buttond', this._uiConfig.templateConfig == 'standard' ? delButton : gdelButton);
|
|
2242
|
+
guiElem.elements.push(dbt);
|
|
2243
|
+
dbt.color = 'transparent';
|
|
2244
|
+
var nSize = this._isMobile ? '20px' : '40px';
|
|
2245
|
+
dbt.width = this._uiConfig.templateConfig == 'standard' ? nSize : '60%';
|
|
2246
|
+
dbt.height = this._uiConfig.templateConfig == 'standard' ? nSize : '70%';
|
|
2247
|
+
dbt.onPointerClickObservable.add(function () {
|
|
2248
|
+
return _this8._utilStore.onElementDeleted(elementInfo.setId, elementInfo.elementId);
|
|
2249
|
+
});
|
|
2250
|
+
if (this._uiConfig.templateConfig == 'standard' && !node) dtarget.linkOffsetY = !this._isMobile ? -48 : -30;
|
|
2251
|
+
dtarget.addControl(dbt);
|
|
2252
|
+
this._gui.addControl(dtarget);
|
|
2253
|
+
dtarget.linkWithMesh(node);
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2035
2256
|
}, {
|
|
2036
2257
|
key: "createPosNr",
|
|
2037
|
-
value: function createPosNr(elementInfo, element,
|
|
2038
|
-
var
|
|
2258
|
+
value: function createPosNr(elementInfo, element, onElSelected) {
|
|
2259
|
+
var _this9 = this,
|
|
2260
|
+
_guiElemRightBack,
|
|
2039
2261
|
_this$_elementsInfo,
|
|
2040
|
-
_this$
|
|
2262
|
+
_this$_tabgroupTypeAc2;
|
|
2041
2263
|
var guiElem = {
|
|
2042
2264
|
elementId: elementInfo.elementId,
|
|
2043
2265
|
elements: []
|
|
@@ -2045,14 +2267,15 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2045
2267
|
var bbox = element.getHierarchyBoundingVectors();
|
|
2046
2268
|
var guiElemLeftBack = null;
|
|
2047
2269
|
var guiElemRightBack = null;
|
|
2270
|
+
var isBoxPlanner = this._uiConfig.plannerMode == 'BoxPlanner';
|
|
2048
2271
|
if (!isBoxPlanner && elementInfo.selectable && this._uiConfig.templateConfig != 'hidden') {
|
|
2049
2272
|
guiElemLeftBack = new TransformNode('guiElem_' + elementInfo.elementId, this._scene);
|
|
2050
2273
|
var forward = element.getDirection(Vector3.Forward()).normalize();
|
|
2051
2274
|
var left = element.getDirection(Vector3.Left()).normalize();
|
|
2052
2275
|
var x = bbox.max.x;
|
|
2053
|
-
var z = bbox.
|
|
2276
|
+
var z = bbox.max.z;
|
|
2054
2277
|
if (forward.x < forward.z) x = bbox.min.x;
|
|
2055
|
-
if (left.z > left.x) z = bbox.
|
|
2278
|
+
if (left.z > left.x) z = bbox.min.z;
|
|
2056
2279
|
guiElemLeftBack.position = new Vector3(x, bbox.max.y, z);
|
|
2057
2280
|
guiElem.elements.push(guiElemLeftBack);
|
|
2058
2281
|
guiElemRightBack = undefined;
|
|
@@ -2070,21 +2293,19 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2070
2293
|
target.fontSize = this._uiConfig.templateConfig == 'standard' ? 50 : this._isMobile ? 10 : 20;
|
|
2071
2294
|
target.background = this._colors.defaultBg;
|
|
2072
2295
|
target.thickness = 0;
|
|
2073
|
-
if (elementInfo.active) {
|
|
2074
|
-
target.background = this._colors.selectedBg;
|
|
2075
|
-
} else {
|
|
2296
|
+
if (elementInfo.active) target.background = this._colors.selectedBg;else {
|
|
2076
2297
|
target.onPointerClickObservable.add(function (evt) {
|
|
2077
|
-
|
|
2078
|
-
|
|
2298
|
+
_this9._guiIsPicked = true;
|
|
2299
|
+
_this9.selectElem(element.name.slice(-1), element, onElSelected);
|
|
2079
2300
|
setTimeout(function () {
|
|
2080
|
-
return
|
|
2301
|
+
return _this9._guiIsPicked = false;
|
|
2081
2302
|
}, 10);
|
|
2082
2303
|
});
|
|
2083
2304
|
target.onPointerEnterObservable.add(function () {
|
|
2084
|
-
return target.background =
|
|
2305
|
+
return target.background = _this9._colors.hoverBg;
|
|
2085
2306
|
});
|
|
2086
2307
|
target.onPointerOutObservable.add(function () {
|
|
2087
|
-
target.background =
|
|
2308
|
+
target.background = _this9._colors.defaultBg;
|
|
2088
2309
|
});
|
|
2089
2310
|
}
|
|
2090
2311
|
if (!elementInfo.selectable) target.background = '';
|
|
@@ -2105,6 +2326,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2105
2326
|
var _pos = new Vector3(bbox.min.x, bbox.max.y, bbox.min.z);
|
|
2106
2327
|
guiElemRightBack.position = _pos;
|
|
2107
2328
|
}
|
|
2329
|
+
if (elementInfo.active) this.createTrash(guiElem, (_guiElemRightBack = guiElemRightBack) !== null && _guiElemRightBack !== void 0 ? _guiElemRightBack : guiElemLeftBack, elementInfo);
|
|
2108
2330
|
var childMeshes = element.getChildMeshes();
|
|
2109
2331
|
this._selectedHl.addExcludedMesh(this._plane);
|
|
2110
2332
|
var cantSelect = (_this$_elementsInfo = this._elementsInfo) === null || _this$_elementsInfo === void 0 ? void 0 : _this$_elementsInfo.every(function (ei) {
|
|
@@ -2112,7 +2334,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2112
2334
|
});
|
|
2113
2335
|
childMeshes.forEach(function (m) {
|
|
2114
2336
|
if (!m.material) return;
|
|
2115
|
-
if (
|
|
2337
|
+
if (_this9._plane.visibility == 1) {
|
|
2116
2338
|
m.visibility = 0;
|
|
2117
2339
|
m.material.depthFunction = Constants.ALWAYS;
|
|
2118
2340
|
m.material.disableColorWrite = true;
|
|
@@ -2123,25 +2345,25 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2123
2345
|
}
|
|
2124
2346
|
if (elementInfo.active) m.visibility = 1;
|
|
2125
2347
|
if (!cantSelect && !elementInfo.active && elementInfo.selectable) {
|
|
2126
|
-
if (!m.actionManager) m.actionManager = new ActionManager(
|
|
2348
|
+
if (!m.actionManager) m.actionManager = new ActionManager(_this9._scene);
|
|
2127
2349
|
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, function () {
|
|
2128
|
-
return
|
|
2350
|
+
return _this9.pointerOverElement(element);
|
|
2129
2351
|
}));
|
|
2130
2352
|
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function () {
|
|
2131
|
-
return
|
|
2353
|
+
return _this9.pointerOutElement(element);
|
|
2132
2354
|
}));
|
|
2133
2355
|
} else if (!cantSelect && elementInfo.active) {
|
|
2134
2356
|
var _m$actionManager;
|
|
2135
|
-
|
|
2136
|
-
|
|
2357
|
+
_this9._selectedMeshes = [].concat(_toConsumableArray(_this9._selectedMeshes), _toConsumableArray(childMeshes));
|
|
2358
|
+
_this9._selectedHl.addMesh(m, Color3.Black());
|
|
2137
2359
|
(_m$actionManager = m.actionManager) === null || _m$actionManager === void 0 || _m$actionManager.dispose();
|
|
2138
2360
|
} else {
|
|
2139
2361
|
var _m$actionManager2;
|
|
2140
2362
|
(_m$actionManager2 = m.actionManager) === null || _m$actionManager2 === void 0 || _m$actionManager2.dispose();
|
|
2141
2363
|
}
|
|
2142
2364
|
});
|
|
2143
|
-
if ((_this$
|
|
2144
|
-
var
|
|
2365
|
+
if ((_this$_tabgroupTypeAc2 = this._tabgroupTypeActive) !== null && _this$_tabgroupTypeAc2 !== void 0 && _this$_tabgroupTypeAc2.call(this, 'PLANNER') && elementInfo.active) {
|
|
2366
|
+
var _guiElemRightBack2;
|
|
2145
2367
|
var dtarget = this._uiConfig.templateConfig == 'standard' ? new Ellipse('deleteEllipse') : new Rectangle('deleteEllipse');
|
|
2146
2368
|
guiElem.elements.push(dtarget);
|
|
2147
2369
|
var _size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '75px' : '40px' : this._isMobile ? '100px' : '35px';
|
|
@@ -2156,12 +2378,12 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2156
2378
|
dbt.width = this._uiConfig.templateConfig == 'standard' ? nSize : '60%';
|
|
2157
2379
|
dbt.height = this._uiConfig.templateConfig == 'standard' ? nSize : '70%';
|
|
2158
2380
|
dbt.onPointerClickObservable.add(function () {
|
|
2159
|
-
return
|
|
2381
|
+
return _this9._utilStore.onElementDeleted(elementInfo.setId, elementInfo.elementId);
|
|
2160
2382
|
});
|
|
2161
2383
|
if (this._uiConfig.templateConfig == 'standard' && !guiElemRightBack) dtarget.linkOffsetY = !this._isMobile ? -48 : -80;
|
|
2162
2384
|
dtarget.addControl(dbt);
|
|
2163
2385
|
this._gui.addControl(dtarget);
|
|
2164
|
-
dtarget.linkWithMesh((
|
|
2386
|
+
dtarget.linkWithMesh((_guiElemRightBack2 = guiElemRightBack) !== null && _guiElemRightBack2 !== void 0 ? _guiElemRightBack2 : guiElemLeftBack);
|
|
2165
2387
|
}
|
|
2166
2388
|
this._guiElements.push(guiElem);
|
|
2167
2389
|
}
|
|
@@ -2170,7 +2392,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2170
2392
|
value: function createBoxCopyButtons(elementInfo, element) {
|
|
2171
2393
|
var _this$_scene$activeCa,
|
|
2172
2394
|
_this$_scene$activeCa2,
|
|
2173
|
-
|
|
2395
|
+
_this10 = this,
|
|
2174
2396
|
_this$_scene$activeCa3;
|
|
2175
2397
|
var guiElem = {
|
|
2176
2398
|
elementId: elementInfo.elementId,
|
|
@@ -2196,8 +2418,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2196
2418
|
target.rotation = 0;
|
|
2197
2419
|
}
|
|
2198
2420
|
(_this$_scene$activeCa2 = this._scene.activeCamera) === null || _this$_scene$activeCa2 === void 0 || _this$_scene$activeCa2.onViewMatrixChangedObservable.add(function () {
|
|
2199
|
-
var
|
|
2200
|
-
var _dir = (
|
|
2421
|
+
var _this10$_scene$active;
|
|
2422
|
+
var _dir = (_this10$_scene$active = _this10._scene.activeCamera) === null || _this10$_scene$active === void 0 ? void 0 : _this10$_scene$active.getDirection(Axis.Z);
|
|
2201
2423
|
if (_dir.z > 0) {
|
|
2202
2424
|
target.rotation = 180 * Math.PI / 180;
|
|
2203
2425
|
} else {
|
|
@@ -2205,8 +2427,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2205
2427
|
}
|
|
2206
2428
|
});
|
|
2207
2429
|
target.onPointerClickObservable.add(function () {
|
|
2208
|
-
var
|
|
2209
|
-
return (
|
|
2430
|
+
var _this10$_onElementCop;
|
|
2431
|
+
return (_this10$_onElementCop = _this10._onElementCopy) === null || _this10$_onElementCop === void 0 ? void 0 : _this10$_onElementCop.call(_this10, elementInfo.setId, elementInfo.elementId, 'LEFT');
|
|
2210
2432
|
});
|
|
2211
2433
|
break;
|
|
2212
2434
|
case 'BoxCopyRight':
|
|
@@ -2219,8 +2441,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2219
2441
|
guiElement.position = element.absolutePosition.add(new Vector3(-(bbox.max.x - bbox.min.x), (bbox.max.y - bbox.min.y) / 2, bbox.max.z - bbox.min.z));
|
|
2220
2442
|
guiElement.rotation = new Vector3(90 * Math.PI / 180, 0, 0);
|
|
2221
2443
|
(_this$_scene$activeCa3 = this._scene.activeCamera) === null || _this$_scene$activeCa3 === void 0 || _this$_scene$activeCa3.onViewMatrixChangedObservable.add(function () {
|
|
2222
|
-
var
|
|
2223
|
-
var _dir = (
|
|
2444
|
+
var _this10$_scene$active2;
|
|
2445
|
+
var _dir = (_this10$_scene$active2 = _this10._scene.activeCamera) === null || _this10$_scene$active2 === void 0 ? void 0 : _this10$_scene$active2.getDirection(Axis.Z);
|
|
2224
2446
|
if (_dir.z < 0) {
|
|
2225
2447
|
target.rotation = 180 * Math.PI / 180;
|
|
2226
2448
|
} else {
|
|
@@ -2228,16 +2450,16 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2228
2450
|
}
|
|
2229
2451
|
});
|
|
2230
2452
|
target.onPointerClickObservable.add(function () {
|
|
2231
|
-
var
|
|
2232
|
-
return (
|
|
2453
|
+
var _this10$_onElementCop2;
|
|
2454
|
+
return (_this10$_onElementCop2 = _this10._onElementCopy) === null || _this10$_onElementCop2 === void 0 ? void 0 : _this10$_onElementCop2.call(_this10, elementInfo.setId, elementInfo.elementId, 'RIGHT');
|
|
2233
2455
|
});
|
|
2234
2456
|
break;
|
|
2235
2457
|
case 'BoxCopyTop':
|
|
2236
2458
|
target.rotation = 90 * Math.PI / 180;
|
|
2237
2459
|
guiElement.position = element.absolutePosition.add(new Vector3(-(bbox.max.x - bbox.min.x) / 2, bbox.max.y - bbox.min.y, bbox.max.z - bbox.min.z));
|
|
2238
2460
|
target.onPointerClickObservable.add(function () {
|
|
2239
|
-
var
|
|
2240
|
-
return (
|
|
2461
|
+
var _this10$_onElementCop3;
|
|
2462
|
+
return (_this10$_onElementCop3 = _this10._onElementCopy) === null || _this10$_onElementCop3 === void 0 ? void 0 : _this10$_onElementCop3.call(_this10, elementInfo.setId, elementInfo.elementId, 'TOP');
|
|
2241
2463
|
});
|
|
2242
2464
|
break;
|
|
2243
2465
|
}
|
|
@@ -2248,7 +2470,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2248
2470
|
}, {
|
|
2249
2471
|
key: "initGui",
|
|
2250
2472
|
value: function initGui(onElSelected, elements) {
|
|
2251
|
-
var
|
|
2473
|
+
var _this11 = this;
|
|
2252
2474
|
// elementinfo update before unity -- return and wait for after buildscene
|
|
2253
2475
|
if (!this._selectionHandler) this.initSelectionHandler(onElSelected);
|
|
2254
2476
|
if (!this._scene || !this._elementsInfo || this._elementsInfo.filter(function (e) {
|
|
@@ -2256,9 +2478,6 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2256
2478
|
}).length > elements.length) return;
|
|
2257
2479
|
this.clearGui();
|
|
2258
2480
|
if (this._plane.parent == null) this._plane.parent = this._scene.activeCamera;
|
|
2259
|
-
var isBoxPlanner = !this._elementsInfo.every(function (v) {
|
|
2260
|
-
return v.type == 'PosNr';
|
|
2261
|
-
});
|
|
2262
2481
|
this._selectedHl.removeAllMeshes();
|
|
2263
2482
|
this._selectedMeshes = [];
|
|
2264
2483
|
this._elementsInfo.forEach(function (elementInfo) {
|
|
@@ -2266,16 +2485,16 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2266
2485
|
return Number(el.bbn.name.slice(el.bbn.name.lastIndexOf('E') + 1, el.bbn.name.length)) == elementInfo.elementId;
|
|
2267
2486
|
});
|
|
2268
2487
|
if (!emnt) return;
|
|
2269
|
-
var element =
|
|
2270
|
-
if (!element ||
|
|
2271
|
-
if (elementInfo.type == 'PosNr')
|
|
2488
|
+
var element = _this11._scene.getTransformNodeByName(emnt.bbn.name);
|
|
2489
|
+
if (!element || _this11._uiConfig.hideUiIcons) return;
|
|
2490
|
+
if (elementInfo.type == 'PosNr') _this11.createPosNr(elementInfo, element, onElSelected);
|
|
2272
2491
|
});
|
|
2273
2492
|
}
|
|
2274
2493
|
}, {
|
|
2275
2494
|
key: "selectElem",
|
|
2276
2495
|
value: function selectElem(name, element, onElSelected) {
|
|
2277
2496
|
var _this$_elementsInfo2,
|
|
2278
|
-
|
|
2497
|
+
_this12 = this;
|
|
2279
2498
|
var elementInfo = (_this$_elementsInfo2 = this._elementsInfo) === null || _this$_elementsInfo2 === void 0 ? void 0 : _this$_elementsInfo2.find(function (ef) {
|
|
2280
2499
|
return ef.elementId.toString() == name;
|
|
2281
2500
|
});
|
|
@@ -2296,9 +2515,9 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2296
2515
|
this._guiElements.forEach(function (guiElem) {
|
|
2297
2516
|
return guiElem.elements.forEach(function (element) {
|
|
2298
2517
|
if (element.typeName == 'label') element.color = 'Black';
|
|
2299
|
-
if (element.typeName == 'Ellipse') element.color =
|
|
2518
|
+
if (element.typeName == 'Ellipse') element.color = _this12._colors.defaultBg;
|
|
2300
2519
|
if (guiElem.elementId.toString() == name) {
|
|
2301
|
-
if (element.typeName == 'label') element.color =
|
|
2520
|
+
if (element.typeName == 'label') element.color = _this12._colors.selectedBg;
|
|
2302
2521
|
if (element.typeName == 'Ellipse') element.color = 'White';
|
|
2303
2522
|
}
|
|
2304
2523
|
});
|
|
@@ -2342,7 +2561,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2342
2561
|
}, {
|
|
2343
2562
|
key: "requestNewOverlayImage",
|
|
2344
2563
|
value: function requestNewOverlayImage(viewpoint, focusedElement, targetCameraPosition, updateCameraInformation) {
|
|
2345
|
-
var
|
|
2564
|
+
var _this13 = this;
|
|
2346
2565
|
//this._overlayImage exists only when unity combi is enabled
|
|
2347
2566
|
if (!this._isUnityComb || this._isStaticBg) return;
|
|
2348
2567
|
var elementId = undefined;
|
|
@@ -2358,12 +2577,12 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2358
2577
|
clearTimeout(this._timeoutId);
|
|
2359
2578
|
if (!this._latestViewpoint || this._latestViewpoint.isOutdated || Math.abs(this._latestViewpoint.pos.x - viewpoint.pos.x) > 0.05 || Math.abs(this._latestViewpoint.pos.y - viewpoint.pos.y) > 0.05 || Math.abs(this._latestViewpoint.pos.z - viewpoint.pos.z) > 0.05 || Math.abs(this._latestViewpoint.rot.x - viewpoint.rot.x) > 0.05 || Math.abs(this._latestViewpoint.rot.y - viewpoint.rot.y) > 0.05 || Math.abs(this._latestViewpoint.rot.z - viewpoint.rot.z) > 0.05) {
|
|
2360
2579
|
this._timeoutId = setTimeout(function () {
|
|
2361
|
-
var
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2580
|
+
var _this13$_requestNewOv;
|
|
2581
|
+
_this13._latestViewpoint = viewpoint;
|
|
2582
|
+
_this13._utilStore.addOutstandingImageCount();
|
|
2583
|
+
_this13._utilStore.updateCam = true;
|
|
2365
2584
|
updateCameraInformation === null || updateCameraInformation === void 0 || updateCameraInformation(viewpoint);
|
|
2366
|
-
(
|
|
2585
|
+
(_this13$_requestNewOv = _this13._requestNewOverlayImage) === null || _this13$_requestNewOv === void 0 || _this13$_requestNewOv.call(_this13, viewpoint, {
|
|
2367
2586
|
adjustZoomInUnity: false,
|
|
2368
2587
|
onlyAdjustZoomBBChanged: false,
|
|
2369
2588
|
rotationCenter: viewpoint.targetPos,
|
|
@@ -2601,17 +2820,17 @@ var UtilStore = /*#__PURE__*/function () {
|
|
|
2601
2820
|
|
|
2602
2821
|
var _context;
|
|
2603
2822
|
var unregisterContext = function unregisterContext() {
|
|
2604
|
-
_context =
|
|
2823
|
+
_context = null;
|
|
2605
2824
|
};
|
|
2606
2825
|
var registerContext = function registerContext(scene, hqRenderScript, apiConfig, jwt, viewHandler, onMissingGeo, requestNewOverlayImage, overlayImage, uiConfig, updateCameraInformation, isMobile) {
|
|
2607
2826
|
var utilStore = new UtilStore(false, viewHandler);
|
|
2608
2827
|
var sceneStore = new SceneStore(scene, hqRenderScript, utilStore, apiConfig, jwt, onMissingGeo, updateCameraInformation);
|
|
2609
|
-
var uiStore = new UIStore(scene, sceneStore.enableSSAO.bind(sceneStore), utilStore, uiConfig, requestNewOverlayImage, overlayImage, viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.viewPlannerHandler.onElementCopy, sceneStore.runRenderLoopForTime.bind(sceneStore), viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.tabgroupTypeActive, isMobile);
|
|
2828
|
+
var uiStore = new UIStore(scene, sceneStore.enableSSAO.bind(sceneStore), utilStore, uiConfig, requestNewOverlayImage, overlayImage, viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.viewPlannerHandler.onElementCopy, sceneStore.runRenderLoopForTime.bind(sceneStore), viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.tabgroupTypeActive, isMobile, viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.divaWebPlanner.getPlannerInteractionInformation.bind(viewHandler.divaWebPlanner));
|
|
2610
2829
|
return _context = {
|
|
2611
2830
|
utilStore: utilStore,
|
|
2612
2831
|
sceneStore: sceneStore,
|
|
2613
2832
|
uiStore: uiStore,
|
|
2614
|
-
gridStore: new GridStore(sceneStore, uiStore, viewHandler)
|
|
2833
|
+
gridStore: new GridStore(sceneStore, uiStore, uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.plannerMode, viewHandler)
|
|
2615
2834
|
};
|
|
2616
2835
|
};
|
|
2617
2836
|
var useUIStoreContext = function useUIStoreContext() {
|
|
@@ -2794,7 +3013,9 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2794
3013
|
if (!texture) return texture;
|
|
2795
3014
|
var reCtrTex = new Texture(texture.url, _customMat.scene);
|
|
2796
3015
|
reCtrTex.uScale = texture.uScale;
|
|
2797
|
-
reCtrTex.vScale = texture.vScale;
|
|
3016
|
+
reCtrTex.vScale = -texture.vScale;
|
|
3017
|
+
reCtrTex.uOffset = 1;
|
|
3018
|
+
reCtrTex.vOffset = -(1 - texture.vScale);
|
|
2798
3019
|
reCtrTex._mimeType = texture.url.endsWith('.jpg') ? 'image/jpeg' : 'image/png';
|
|
2799
3020
|
return reCtrTex;
|
|
2800
3021
|
};
|
|
@@ -2812,7 +3033,6 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2812
3033
|
case 16:
|
|
2813
3034
|
res = _context.sent;
|
|
2814
3035
|
parsedMat = PBRMetallicRoughnessMaterial.Parse(res, _customMat.scene, '');
|
|
2815
|
-
parsedMat.name = _customMat.name;
|
|
2816
3036
|
parsedMat.baseTexture = doReCtrTex(parsedMat.baseTexture);
|
|
2817
3037
|
parsedMat.metallicRoughnessTexture = doReCtrTex(parsedMat.metallicRoughnessTexture);
|
|
2818
3038
|
parsedMat.normalTexture = doReCtrTex(parsedMat.normalTexture);
|
|
@@ -2830,8 +3050,8 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2830
3050
|
mat: parsedMat,
|
|
2831
3051
|
found: true
|
|
2832
3052
|
});
|
|
2833
|
-
case
|
|
2834
|
-
_context.prev =
|
|
3053
|
+
case 27:
|
|
3054
|
+
_context.prev = 27;
|
|
2835
3055
|
_context.t0 = _context["catch"](9);
|
|
2836
3056
|
if (setDataRow) useUtilStoreContext().setAnalyzeDataRow({
|
|
2837
3057
|
type: 'MAT',
|
|
@@ -2841,17 +3061,17 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2841
3061
|
path: _customMat.blob,
|
|
2842
3062
|
sizeMb: 0
|
|
2843
3063
|
});
|
|
2844
|
-
case
|
|
3064
|
+
case 30:
|
|
2845
3065
|
mat = new PBRMetallicRoughnessMaterial(_customMat.name, sceneStore.scene);
|
|
2846
3066
|
return _context.abrupt("return", {
|
|
2847
3067
|
mat: mat,
|
|
2848
3068
|
found: true
|
|
2849
3069
|
});
|
|
2850
|
-
case
|
|
3070
|
+
case 32:
|
|
2851
3071
|
case "end":
|
|
2852
3072
|
return _context.stop();
|
|
2853
3073
|
}
|
|
2854
|
-
}, _callee, null, [[9,
|
|
3074
|
+
}, _callee, null, [[9, 27]]);
|
|
2855
3075
|
}));
|
|
2856
3076
|
return function customMat(_x) {
|
|
2857
3077
|
return _ref.apply(this, arguments);
|
|
@@ -2970,7 +3190,7 @@ function _findAssets() {
|
|
|
2970
3190
|
geo: geo.name
|
|
2971
3191
|
});
|
|
2972
3192
|
geo.material = mat.mat;
|
|
2973
|
-
oldMat = sceneStore.scene.
|
|
3193
|
+
oldMat = sceneStore.scene.getMaterialByUniqueID(oldMatId);
|
|
2974
3194
|
if (oldMat) {
|
|
2975
3195
|
_context.next = 17;
|
|
2976
3196
|
break;
|
|
@@ -2988,7 +3208,7 @@ function _findAssets() {
|
|
|
2988
3208
|
} finally {
|
|
2989
3209
|
_iterator3.f();
|
|
2990
3210
|
}
|
|
2991
|
-
oldMat.dispose(
|
|
3211
|
+
oldMat.dispose();
|
|
2992
3212
|
_context.next = 39;
|
|
2993
3213
|
break;
|
|
2994
3214
|
case 22:
|
|
@@ -3311,11 +3531,11 @@ function _createOrGetMaterial() {
|
|
|
3311
3531
|
return _createOrGetMaterial.apply(this, arguments);
|
|
3312
3532
|
}
|
|
3313
3533
|
|
|
3534
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3535
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3314
3536
|
function _createForOfIteratorHelper$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
3315
3537
|
function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
|
|
3316
3538
|
function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
3317
|
-
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3318
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3319
3539
|
var buildScene = function buildScene(_ref) {
|
|
3320
3540
|
var _sceneStore$elements;
|
|
3321
3541
|
var startNode = _ref.startNode,
|
|
@@ -3324,6 +3544,7 @@ var buildScene = function buildScene(_ref) {
|
|
|
3324
3544
|
cachedAssets = _ref.cachedAssets;
|
|
3325
3545
|
var sceneStore = useSceneStoreContext();
|
|
3326
3546
|
var utilStore = useUtilStoreContext();
|
|
3547
|
+
useGridStoreContext();
|
|
3327
3548
|
var scene = sceneStore.scene;
|
|
3328
3549
|
var hqsGeos = sceneStore.hqRenderScript.assets.geos;
|
|
3329
3550
|
var curElement = (_sceneStore$elements = sceneStore.elements) === null || _sceneStore$elements === void 0 || (_sceneStore$elements = _sceneStore$elements[0]) === null || _sceneStore$elements === void 0 ? void 0 : _sceneStore$elements.hqs;
|
|
@@ -3341,10 +3562,12 @@ var buildScene = function buildScene(_ref) {
|
|
|
3341
3562
|
return asset.id == curGeo.id;
|
|
3342
3563
|
})) === null || _cachedAssets$find === void 0 || (_cachedAssets$find = _cachedAssets$find.geo) === null || _cachedAssets$find === void 0 || _cachedAssets$find.onElements.push(curElement); // TODO
|
|
3343
3564
|
var geo = mesh.clone('geo_' + mesh.name, parentNode);
|
|
3344
|
-
geo.position = new Vector3(curGeo.pos.x / 100, curGeo.pos.y / 100,
|
|
3345
|
-
geo.rotation = utilStore.degreesToRadians(
|
|
3346
|
-
x: hqsGeo.isIDM3D ? 90 - curGeo.rot.x : curGeo.rot.x
|
|
3347
|
-
|
|
3565
|
+
geo.position = new Vector3(curGeo.pos.x / 100, curGeo.pos.y / 100, curGeo.pos.z / 100);
|
|
3566
|
+
geo.rotation = utilStore.degreesToRadians({
|
|
3567
|
+
x: hqsGeo.isIDM3D ? 90 - curGeo.rot.x : -curGeo.rot.x,
|
|
3568
|
+
y: 360 - curGeo.rot.y,
|
|
3569
|
+
z: curGeo.rot.z
|
|
3570
|
+
});
|
|
3348
3571
|
geo.setEnabled(true);
|
|
3349
3572
|
utilStore.setAnalyzeDataRowStatus(curMeshName, true);
|
|
3350
3573
|
}
|
|
@@ -3409,7 +3632,6 @@ var buildScene = function buildScene(_ref) {
|
|
|
3409
3632
|
var node = new TransformNode(hqsNode.name, scene);
|
|
3410
3633
|
if (hqsNode.name == 'Root') {
|
|
3411
3634
|
//for model viewer direction
|
|
3412
|
-
hqsNode.rot.y = 180;
|
|
3413
3635
|
sceneStore.setRoot(node, hqsNode);
|
|
3414
3636
|
}
|
|
3415
3637
|
if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.name) == 'Wohnzimmer') sceneStore.addSet(node, hqsNode);
|
|
@@ -3418,8 +3640,11 @@ var buildScene = function buildScene(_ref) {
|
|
|
3418
3640
|
sceneStore.addElement(node, hqsNode);
|
|
3419
3641
|
curElement = hqsNode;
|
|
3420
3642
|
}
|
|
3421
|
-
node.position = new Vector3(hqsNode.pos.x / 100, hqsNode.pos.y / 100,
|
|
3422
|
-
node.rotation = utilStore.degreesToRadians(hqsNode.rot)
|
|
3643
|
+
node.position = new Vector3(hqsNode.pos.x / 100, hqsNode.pos.y / 100, hqsNode.pos.z / 100);
|
|
3644
|
+
node.rotation = utilStore.degreesToRadians(_objectSpread$1(_objectSpread$1({}, hqsNode.rot), {}, {
|
|
3645
|
+
x: -hqsNode.rot.x,
|
|
3646
|
+
y: 360 - hqsNode.rot.y
|
|
3647
|
+
}));
|
|
3423
3648
|
if (parentNode !== undefined) {
|
|
3424
3649
|
node.parent = parentNode;
|
|
3425
3650
|
}
|
|
@@ -3577,19 +3802,20 @@ function deacCache(cache) {
|
|
|
3577
3802
|
var parser = /*#__PURE__*/function () {
|
|
3578
3803
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
3579
3804
|
var _changedElements$upda;
|
|
3580
|
-
var sceneStore, hasRendered, hqRenderScript, scene, cache, changedElements, utilStore, _yield$findAssets, cacheGroup, newCache, _changedElements$upda2;
|
|
3805
|
+
var sceneStore, hasRendered, hqRenderScript, scene, cache, changedElements, utilStore, gridStore, _yield$findAssets, cacheGroup, newCache, _changedElements$upda2, _sceneStore$scene$get, root;
|
|
3581
3806
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
3582
3807
|
while (1) switch (_context.prev = _context.next) {
|
|
3583
3808
|
case 0:
|
|
3584
3809
|
sceneStore = useSceneStoreContext();
|
|
3585
3810
|
hasRendered = sceneStore.hasRendered, hqRenderScript = sceneStore.hqRenderScript, scene = sceneStore.scene, cache = sceneStore.cache, changedElements = sceneStore.changedElements;
|
|
3586
|
-
utilStore = useUtilStoreContext();
|
|
3811
|
+
utilStore = useUtilStoreContext();
|
|
3812
|
+
gridStore = useGridStoreContext(); //disable elementrows from old cache
|
|
3587
3813
|
changedElements === null || changedElements === void 0 || (_changedElements$upda = changedElements.updatedElements) === null || _changedElements$upda === void 0 || _changedElements$upda.forEach(function (el) {
|
|
3588
3814
|
return utilStore.disableElementRows(el.name, cache);
|
|
3589
3815
|
});
|
|
3590
|
-
_context.next =
|
|
3816
|
+
_context.next = 7;
|
|
3591
3817
|
return findAssets(hqRenderScript.assets, cache);
|
|
3592
|
-
case
|
|
3818
|
+
case 7:
|
|
3593
3819
|
_yield$findAssets = _context.sent;
|
|
3594
3820
|
cacheGroup = _yield$findAssets.cacheGroup;
|
|
3595
3821
|
newCache = _yield$findAssets.newCache;
|
|
@@ -3614,6 +3840,7 @@ var parser = /*#__PURE__*/function () {
|
|
|
3614
3840
|
parentNode: parent
|
|
3615
3841
|
});
|
|
3616
3842
|
findMaterials(newCache);
|
|
3843
|
+
gridStore.setupElementMove([updatedElement.name], utilStore.moveObjectInDirection);
|
|
3617
3844
|
});
|
|
3618
3845
|
} else if (!hasRendered) {
|
|
3619
3846
|
buildScene({
|
|
@@ -3622,13 +3849,17 @@ var parser = /*#__PURE__*/function () {
|
|
|
3622
3849
|
cachedAssets: newCache
|
|
3623
3850
|
});
|
|
3624
3851
|
findMaterials(newCache);
|
|
3852
|
+
root = (_sceneStore$scene$get = sceneStore.scene.getTransformNodeByName(hqRenderScript.scene.nodes[0].name)) === null || _sceneStore$scene$get === void 0 || (_sceneStore$scene$get = _sceneStore$scene$get.getChildren()) === null || _sceneStore$scene$get === void 0 || (_sceneStore$scene$get = _sceneStore$scene$get[0]) === null || _sceneStore$scene$get === void 0 || (_sceneStore$scene$get = _sceneStore$scene$get.getChildren()) === null || _sceneStore$scene$get === void 0 || (_sceneStore$scene$get = _sceneStore$scene$get[0]) === null || _sceneStore$scene$get === void 0 ? void 0 : _sceneStore$scene$get.getChildren().map(function (r) {
|
|
3853
|
+
return r.name;
|
|
3854
|
+
});
|
|
3855
|
+
gridStore.setupElementMove(root !== null && root !== void 0 ? root : [], utilStore.moveObjectInDirection);
|
|
3625
3856
|
}
|
|
3626
3857
|
utilStore.setRTVAnalyzeData();
|
|
3627
3858
|
deacCache(cacheGroup);
|
|
3628
3859
|
sceneStore.scene.executeWhenReady(function () {
|
|
3629
3860
|
return sceneStore.checkMaterialCache();
|
|
3630
3861
|
});
|
|
3631
|
-
case
|
|
3862
|
+
case 16:
|
|
3632
3863
|
case "end":
|
|
3633
3864
|
return _context.stop();
|
|
3634
3865
|
}
|
|
@@ -3678,7 +3909,7 @@ function createCams(scene, viewpoint) {
|
|
|
3678
3909
|
name: 'defaultCam',
|
|
3679
3910
|
isEnabled: true,
|
|
3680
3911
|
pos: new Vector3(4.5, 2.2, 8),
|
|
3681
|
-
rot: new Vector3(7.75,
|
|
3912
|
+
rot: new Vector3(7.75, 150, 0),
|
|
3682
3913
|
parent: undefined
|
|
3683
3914
|
})];
|
|
3684
3915
|
}
|
|
@@ -3687,11 +3918,11 @@ function createCams(scene, viewpoint) {
|
|
|
3687
3918
|
return [createCam({
|
|
3688
3919
|
name: 'defaultCam',
|
|
3689
3920
|
isEnabled: true,
|
|
3690
|
-
pos: vector3ToBVector3(viewpoint.pos).multiply(new Vector3(
|
|
3921
|
+
pos: vector3ToBVector3(viewpoint.pos).multiply(new Vector3(0.01, 0.01, 0.01)),
|
|
3691
3922
|
rot: vector3ToBVector3(_objectSpread(_objectSpread({}, viewpoint.rot), {}, {
|
|
3692
|
-
|
|
3923
|
+
y: 360 - viewpoint.rot.y
|
|
3693
3924
|
})),
|
|
3694
|
-
target: vector3ToBVector3(viewpoint.targetPos).multiply(new Vector3(
|
|
3925
|
+
target: vector3ToBVector3(viewpoint.targetPos).multiply(new Vector3(0.01, 0.01, 0.01)),
|
|
3695
3926
|
parent: undefined
|
|
3696
3927
|
})];
|
|
3697
3928
|
}
|
|
@@ -3708,11 +3939,11 @@ function updateCam(camera, scene) {
|
|
|
3708
3939
|
return;
|
|
3709
3940
|
}
|
|
3710
3941
|
if (camera.pos.x == cam.position.x && camera.pos.y == cam.position.y && camera.pos.z == camera.pos.z) return;
|
|
3711
|
-
var position = utilStore.vector3ToBVector3(camera.pos).multiply(new Vector3(
|
|
3942
|
+
var position = utilStore.vector3ToBVector3(camera.pos).multiply(new Vector3(0.01, 0.01, 0.01));
|
|
3712
3943
|
var rotation = utilStore.degreesToRadians(utilStore.vector3ToBVector3(_objectSpread(_objectSpread({}, camera.rot), {}, {
|
|
3713
|
-
|
|
3944
|
+
y: 360 - camera.rot.y
|
|
3714
3945
|
})));
|
|
3715
|
-
var target = utilStore.vector3ToBVector3(camera.targetPos).multiply(new Vector3(
|
|
3946
|
+
var target = utilStore.vector3ToBVector3(camera.targetPos).multiply(new Vector3(0.01, 0.01, 0.01));
|
|
3716
3947
|
cam.position = position;
|
|
3717
3948
|
cam.rotation = rotation;
|
|
3718
3949
|
cam.setTarget(target);
|
|
@@ -3724,17 +3955,17 @@ function updateCam(camera, scene) {
|
|
|
3724
3955
|
lensShiftY: 0,
|
|
3725
3956
|
name: cam.name,
|
|
3726
3957
|
pos: {
|
|
3727
|
-
x: position.x,
|
|
3958
|
+
x: -position.x,
|
|
3728
3959
|
y: position.y,
|
|
3729
3960
|
z: position.z
|
|
3730
3961
|
},
|
|
3731
3962
|
rot: {
|
|
3732
3963
|
x: rotation.x * 180 / Math.PI,
|
|
3733
|
-
y: rotation.y * 180 / Math.PI,
|
|
3964
|
+
y: 360 - rotation.y * 180 / Math.PI,
|
|
3734
3965
|
z: rotation.z * 180 / Math.PI
|
|
3735
3966
|
},
|
|
3736
3967
|
targetPos: {
|
|
3737
|
-
x: target.x,
|
|
3968
|
+
x: -target.x,
|
|
3738
3969
|
y: target.y,
|
|
3739
3970
|
z: target.z
|
|
3740
3971
|
},
|
|
@@ -3744,7 +3975,7 @@ function updateCam(camera, scene) {
|
|
|
3744
3975
|
|
|
3745
3976
|
var LOG = getLogger('ARViewer', 'RealTimeRenderData');
|
|
3746
3977
|
function useRealTimeRenderData (_ref) {
|
|
3747
|
-
var
|
|
3978
|
+
var _sceneStore4;
|
|
3748
3979
|
var jwt = _ref.jwt,
|
|
3749
3980
|
actions = _ref.actions,
|
|
3750
3981
|
apiConfig = _ref.apiConfig,
|
|
@@ -3833,11 +4064,12 @@ function useRealTimeRenderData (_ref) {
|
|
|
3833
4064
|
return parser();
|
|
3834
4065
|
case 20:
|
|
3835
4066
|
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
4067
|
+
if (viewHandler !== null && viewHandler !== void 0 && viewHandler.settingsState.generalPlanningState) gridStore.getGrids1(viewHandler.settingsState.generalPlanningState, uiStore.excludePreviewBoxes.bind(uiStore));
|
|
3836
4068
|
if (freePlacesOnGrids || plannedPlacesOnGrids) gridStore.getGrids(freePlacesOnGrids, plannedPlacesOnGrids);
|
|
3837
|
-
_context2.next =
|
|
4069
|
+
_context2.next = 30;
|
|
3838
4070
|
break;
|
|
3839
|
-
case
|
|
3840
|
-
_context2.prev =
|
|
4071
|
+
case 25:
|
|
4072
|
+
_context2.prev = 25;
|
|
3841
4073
|
_context2.t0 = _context2["catch"](16);
|
|
3842
4074
|
LOG.errorTransaction('BUILD_SCENE', 'RTS_0001', _context2.t0.message);
|
|
3843
4075
|
LOG.error(new DivaError('Error building scene', {
|
|
@@ -3845,12 +4077,9 @@ function useRealTimeRenderData (_ref) {
|
|
|
3845
4077
|
code: 'RTS_0001'
|
|
3846
4078
|
}));
|
|
3847
4079
|
sceneStore.isInitializing = false;
|
|
3848
|
-
case
|
|
4080
|
+
case 30:
|
|
3849
4081
|
if (callbacks.setGlb) {
|
|
3850
|
-
sceneStore.exportScene(
|
|
3851
|
-
var _callbacks$setGlb;
|
|
3852
|
-
if (res) (_callbacks$setGlb = callbacks.setGlb) === null || _callbacks$setGlb === void 0 || _callbacks$setGlb.call(callbacks, URL.createObjectURL(res.glTFFiles['fileName.glb']), res.glTFFiles['fileName.glb']);
|
|
3853
|
-
});
|
|
4082
|
+
sceneStore.exportScene(callbacks.setGlb);
|
|
3854
4083
|
} else {
|
|
3855
4084
|
LOG.debug('callbacks.setGlb is undefined');
|
|
3856
4085
|
}
|
|
@@ -3860,11 +4089,11 @@ function useRealTimeRenderData (_ref) {
|
|
|
3860
4089
|
sceneStore.runRenderLoopForTime(5000);
|
|
3861
4090
|
sceneStore.scene.onAfterRenderObservable.add(onFirstFrame);
|
|
3862
4091
|
LOG.successTransaction('BUILD_SCENE');
|
|
3863
|
-
case
|
|
4092
|
+
case 35:
|
|
3864
4093
|
case "end":
|
|
3865
4094
|
return _context2.stop();
|
|
3866
4095
|
}
|
|
3867
|
-
}, _callee2, null, [[16,
|
|
4096
|
+
}, _callee2, null, [[16, 25]]);
|
|
3868
4097
|
}));
|
|
3869
4098
|
return _onSceneReady.apply(this, arguments);
|
|
3870
4099
|
}
|
|
@@ -3883,13 +4112,10 @@ function useRealTimeRenderData (_ref) {
|
|
|
3883
4112
|
// trigger if gamecanvas did not update but renderjob
|
|
3884
4113
|
if (gameCanvas.current && sceneStore && sceneStore.scene.getEngine()) {
|
|
3885
4114
|
var _queueRerender = function queueRerender() {
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
});
|
|
3891
|
-
}
|
|
3892
|
-
}
|
|
4115
|
+
var _sceneStore$scene;
|
|
4116
|
+
if (sceneStore.isInitializing) setTimeout(_queueRerender, 150);else (_sceneStore$scene = sceneStore.scene) === null || _sceneStore$scene === void 0 || _sceneStore$scene.executeWhenReady(function () {
|
|
4117
|
+
return onSceneReady();
|
|
4118
|
+
});
|
|
3893
4119
|
};
|
|
3894
4120
|
_queueRerender();
|
|
3895
4121
|
}
|
|
@@ -3900,12 +4126,14 @@ function useRealTimeRenderData (_ref) {
|
|
|
3900
4126
|
}
|
|
3901
4127
|
}, [gameCanvas.current]);
|
|
3902
4128
|
useEffect(function () {
|
|
3903
|
-
|
|
4129
|
+
var disposed = false;
|
|
4130
|
+
var engine = null;
|
|
4131
|
+
function init() {
|
|
3904
4132
|
return _init.apply(this, arguments);
|
|
3905
4133
|
}
|
|
3906
4134
|
function _init() {
|
|
3907
|
-
_init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(
|
|
3908
|
-
var babylonEngine, babylonScene, context;
|
|
4135
|
+
_init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
4136
|
+
var babylonEngine, babylonScene, context, _observer;
|
|
3909
4137
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
3910
4138
|
while (1) switch (_context.prev = _context.next) {
|
|
3911
4139
|
case 0:
|
|
@@ -3922,12 +4150,28 @@ function useRealTimeRenderData (_ref) {
|
|
|
3922
4150
|
return _context.abrupt("return");
|
|
3923
4151
|
case 4:
|
|
3924
4152
|
_context.next = 6;
|
|
3925
|
-
return
|
|
4153
|
+
return EngineFactory.CreateAsync(gameCanvas.current, {
|
|
4154
|
+
antialias: true,
|
|
4155
|
+
stencil: true,
|
|
4156
|
+
audioEngine: false,
|
|
4157
|
+
adaptToDeviceRatio: true,
|
|
4158
|
+
useHighPrecisionFloats: true,
|
|
4159
|
+
preserveDrawingBuffer: true
|
|
4160
|
+
});
|
|
3926
4161
|
case 6:
|
|
3927
4162
|
babylonEngine = _context.sent;
|
|
4163
|
+
engine = babylonEngine;
|
|
4164
|
+
if (!disposed) {
|
|
4165
|
+
_context.next = 11;
|
|
4166
|
+
break;
|
|
4167
|
+
}
|
|
4168
|
+
engine.dispose();
|
|
4169
|
+
return _context.abrupt("return");
|
|
4170
|
+
case 11:
|
|
3928
4171
|
babylonEngine.renderEvenInBackground = renderInBackground;
|
|
3929
4172
|
babylonEngine.disablePerformanceMonitorInBackground = true;
|
|
3930
4173
|
babylonScene = new Scene(babylonEngine, undefined);
|
|
4174
|
+
babylonScene.useRightHandedSystem = true;
|
|
3931
4175
|
babylonScene.clearColor = new Color4(255, 255, 255, 255);
|
|
3932
4176
|
context = registerContext(babylonScene, renderjob, apiConfig, jwt, viewHandler, callbacks.onMissingGeo, callbacks.requestNewOverlayImage, overlayImage, uiConfig, callbacks.updateCameraInformation, !!isMobile);
|
|
3933
4177
|
createCams(babylonScene, viewpoint);
|
|
@@ -3935,23 +4179,13 @@ function useRealTimeRenderData (_ref) {
|
|
|
3935
4179
|
utilStore = context.utilStore;
|
|
3936
4180
|
gridStore = context.gridStore;
|
|
3937
4181
|
uiStore = context.uiStore;
|
|
3938
|
-
if (!babylonScene.isReady()) {
|
|
3939
|
-
_context.next = 22;
|
|
3940
|
-
break;
|
|
3941
|
-
}
|
|
3942
|
-
_context.next = 20;
|
|
3943
|
-
return onSceneReady();
|
|
3944
|
-
case 20:
|
|
3945
|
-
_context.next = 23;
|
|
3946
|
-
break;
|
|
3947
|
-
case 22:
|
|
3948
4182
|
babylonScene.executeWhenReady(function () {
|
|
3949
4183
|
return onSceneReady();
|
|
3950
4184
|
});
|
|
3951
|
-
case 23:
|
|
3952
4185
|
if (window && gameCanvas.current) {
|
|
3953
4186
|
window.addEventListener('resize', resize);
|
|
3954
|
-
new ResizeObserver(resize)
|
|
4187
|
+
_observer = new ResizeObserver(resize);
|
|
4188
|
+
_observer.observe(gameCanvas.current);
|
|
3955
4189
|
}
|
|
3956
4190
|
case 24:
|
|
3957
4191
|
case "end":
|
|
@@ -3970,26 +4204,27 @@ function useRealTimeRenderData (_ref) {
|
|
|
3970
4204
|
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
3971
4205
|
};
|
|
3972
4206
|
if (!gameCanvas.current) return;
|
|
3973
|
-
|
|
3974
|
-
antialias: true,
|
|
3975
|
-
stencil: true,
|
|
3976
|
-
audioEngine: false,
|
|
3977
|
-
adaptToDeviceRatio: true,
|
|
3978
|
-
useHighPrecisionFloats: true,
|
|
3979
|
-
preserveDrawingBuffer: true
|
|
3980
|
-
});
|
|
3981
|
-
init(enginePrmise);
|
|
4207
|
+
init();
|
|
3982
4208
|
return function () {
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
4209
|
+
disposed = true;
|
|
4210
|
+
actions.toggleLoading('buildScene', false, false);
|
|
4211
|
+
if (engine) {
|
|
4212
|
+
engine.scenes.forEach(function (s) {
|
|
4213
|
+
s.textures.forEach(function (t) {
|
|
4214
|
+
return t.dispose();
|
|
4215
|
+
});
|
|
4216
|
+
s.materials.forEach(function (m) {
|
|
4217
|
+
return m.dispose();
|
|
4218
|
+
});
|
|
4219
|
+
s.meshes.forEach(function (m) {
|
|
4220
|
+
return m.dispose(false, true);
|
|
4221
|
+
});
|
|
4222
|
+
s.dispose();
|
|
4223
|
+
});
|
|
4224
|
+
engine.dispose();
|
|
3992
4225
|
}
|
|
4226
|
+
unregisterContext();
|
|
4227
|
+
if (window) window.removeEventListener('resize', resize);
|
|
3993
4228
|
};
|
|
3994
4229
|
}, []);
|
|
3995
4230
|
useEffect(function () {
|
|
@@ -4001,13 +4236,21 @@ function useRealTimeRenderData (_ref) {
|
|
|
4001
4236
|
if (viewpoint) updateCam(viewpoint, sceneStore.scene);
|
|
4002
4237
|
}
|
|
4003
4238
|
}, [overlayImage]);
|
|
4239
|
+
useEffect(function () {
|
|
4240
|
+
var _sceneStore3;
|
|
4241
|
+
if (!(viewHandler !== null && viewHandler !== void 0 && viewHandler.settingsState.generalPlanningState) || !((_sceneStore3 = sceneStore) !== null && _sceneStore3 !== void 0 && _sceneStore3.scene) || !elementsInfo) return;
|
|
4242
|
+
sceneStore.scene.executeWhenReady(function () {
|
|
4243
|
+
gridStore.getGrids1(viewHandler.settingsState.generalPlanningState, uiStore.excludePreviewBoxes.bind(uiStore));
|
|
4244
|
+
});
|
|
4245
|
+
sceneStore.runRenderLoopForTime(5000);
|
|
4246
|
+
}, [viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.settingsState.generalPlanningState]);
|
|
4004
4247
|
useEffect(function () {
|
|
4005
4248
|
if (sceneStore && elementsInfo && gameCanvas.current && sceneStore.scene.getEngine()) {
|
|
4006
4249
|
uiStore.addElementsInfo(elementsInfo);
|
|
4007
4250
|
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
4008
4251
|
sceneStore.runRenderLoopForTime(5000);
|
|
4009
4252
|
}
|
|
4010
|
-
}, [elementsInfo, (
|
|
4253
|
+
}, [elementsInfo, (_sceneStore4 = sceneStore) === null || _sceneStore4 === void 0 ? void 0 : _sceneStore4.elements]);
|
|
4011
4254
|
useEffect(function () {
|
|
4012
4255
|
if (!gameCanvas.current || !sceneStore) return;
|
|
4013
4256
|
if (inBackground) {
|
|
@@ -4049,31 +4292,18 @@ function styleInject(css, ref) {
|
|
|
4049
4292
|
}
|
|
4050
4293
|
|
|
4051
4294
|
var canvas = "canvas-gZFEa";
|
|
4052
|
-
var
|
|
4295
|
+
var canvasWrapper = "canvas-wrapper-Taxav";
|
|
4296
|
+
var css_248z = ".canvas-gZFEa {\n height: 100%;\n width: 100%;\n margin: auto;\n display: block;\n backgroundColor: white;\n}\n\n.canvas-gZFEa.focus-visible-ubYpO {\n outline: medium none invert;\n outline: initial;\n}\n\n.canvas-gZFEa.focus-visible-ubYpO {\n outline: medium none invert;\n outline: initial;\n}\n\n.canvas-gZFEa.focus-visible-ubYpO {\n outline: medium none invert;\n outline: initial;\n}\n\n.canvas-gZFEa:focus-visible {\n outline: medium none invert;\n outline: initial;\n}\n\n.canvas-wrapper-Taxav {\n position: absolute;\n top: 0px;\n width: 100%;\n height: 100%;\n backgroundColor: white;\n zIndex: 2;\n}\n\n.flex-container-column-XYHvU {\n display: flex;\n flex-wrap: nowrap;\n flex-direction: column;\n background-color: white;\n gap: 15px;\n padding: 10px;\n margin-top: 50px;\n border: 0.5px solid;\n border-top-right-radius: 10px;\n border-bottom-right-radius: 10px;\n}\n\n.flex-container-column-closed-2D7IF {\n display: flex;\n flex-wrap: nowrap;\n flex-direction: column;\n background-color: white;\n gap: 15px;\n padding: 10px;\n}\n\n.flex-container-row-ENPOV {\n display: flex;\n justify-content: space-between;\n flex-wrap: nowrap;\n flex-direction: row;\n background-color: white;\n gap: 5px;\n}\n\n.create-button-NPGTz {\n width: 200px;\n height: 35px;\n border-radius: 5px;\n border-style: none;\n color: #fff;\n background-color: #713434;\n}\n\n.create-button-NPGTz:hover {\n background-color: #42090e;\n}\n\n.check-box-2GPp1 {\n width: 20px;\n height: 20px;\n margin: 0px;\n}\n\n.input-field-uCQ0h {\n width: 193px;\n height: 35px;\n border-radius: 5px;\n border-style: none;\n color: rgb(0, 0, 0);\n border-style: solid;\n border-color: #000000;\n background-color: #f7f7f7;\n border-width: 0.5px;\n}\n\n.input-field-uCQ0h:hover {\n background-color: #ebebeb;\n}\n";
|
|
4053
4297
|
styleInject(css_248z);
|
|
4054
4298
|
|
|
4055
4299
|
var RealTimeRenderer = /*#__PURE__*/memo(function (props) {
|
|
4056
4300
|
var _useRealTimeRenderDat = useRealTimeRenderData(props),
|
|
4057
4301
|
gameCanvas = _useRealTimeRenderDat.gameCanvas;
|
|
4058
4302
|
return /*#__PURE__*/jsx("div", {
|
|
4059
|
-
|
|
4060
|
-
position: 'absolute',
|
|
4061
|
-
top: '0px',
|
|
4062
|
-
width: '100%',
|
|
4063
|
-
height: '100%',
|
|
4064
|
-
backgroundColor: 'white',
|
|
4065
|
-
zIndex: 2
|
|
4066
|
-
},
|
|
4303
|
+
className: canvasWrapper,
|
|
4067
4304
|
children: /*#__PURE__*/jsx("canvas", {
|
|
4068
4305
|
id: "gameCanvas",
|
|
4069
4306
|
ref: gameCanvas,
|
|
4070
|
-
style: {
|
|
4071
|
-
height: '100%',
|
|
4072
|
-
width: '100%',
|
|
4073
|
-
margin: 'auto',
|
|
4074
|
-
display: 'block',
|
|
4075
|
-
backgroundColor: 'white'
|
|
4076
|
-
},
|
|
4077
4307
|
className: canvas
|
|
4078
4308
|
})
|
|
4079
4309
|
});
|