kitchen-simulator 4.1.7-react-18 → 4.2.1
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/README.md +3 -0
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +171 -111
- package/es/LiteRenderer.js +161 -129
- package/es/actions/export.js +25 -12
- package/es/actions/project-actions.js +2 -1
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/catalog.js +21 -5
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/factories/wall-factory.js +1 -1
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +68 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +50 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +100 -0
- package/es/catalog/properties/property-length-measure.js +84 -0
- package/es/catalog/properties/property-length-measure_hole.js +100 -0
- package/es/catalog/properties/property-number.js +48 -0
- package/es/catalog/properties/property-read-only.js +26 -0
- package/es/catalog/properties/property-string.js +48 -0
- package/es/catalog/properties/property-toggle.js +39 -0
- package/es/catalog/properties/shared-property-style.js +14 -0
- package/es/catalog/utils/exporter.js +24 -11
- package/es/catalog/utils/item-loader.js +224 -220
- package/es/class/hole.js +0 -2
- package/es/class/item.js +92 -70
- package/es/class/layer.js +1 -1
- package/es/class/line.js +4 -8
- package/es/class/project.js +96 -81
- package/es/components/content.js +10 -93
- package/es/components/export.js +4 -6
- package/es/components/style/button.js +106 -0
- package/es/components/style/cancel-button.js +21 -0
- package/es/components/style/content-container.js +30 -0
- package/es/components/style/content-title.js +25 -0
- package/es/components/style/delete-button.js +24 -0
- package/es/components/style/export.js +28 -2
- package/es/components/style/form-block.js +20 -0
- package/es/components/style/form-color-input.js +26 -0
- package/es/components/style/form-label.js +22 -0
- package/es/components/style/form-number-input.js +29 -29
- package/es/components/style/form-number-input_2.js +200 -0
- package/es/components/style/form-select.js +19 -0
- package/es/components/style/form-slider.js +60 -0
- package/es/components/style/form-submit-button.js +25 -0
- package/es/components/style/form-text-input.js +69 -0
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/group.js +5 -4
- package/es/components/viewer2d/item.js +155 -359
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +22 -54
- package/es/components/viewer2d/ruler.js +16 -11
- package/es/components/viewer2d/rulerDist.js +38 -51
- package/es/components/viewer2d/rulerX.js +4 -2
- package/es/components/viewer2d/rulerY.js +3 -0
- package/es/components/viewer2d/scene.js +17 -12
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/vertex.js +3 -2
- package/es/components/viewer2d/viewer2d.js +81 -118
- package/es/components/viewer3d/front3D.js +13 -1
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +270 -69
- package/es/components/viewer3d/viewer3d-first-person.js +26 -32
- package/es/components/viewer3d/viewer3d.js +110 -130
- package/es/constants.js +7 -2
- package/es/devLiteRenderer.js +491 -150
- package/es/index.js +589 -62
- package/es/models.js +13 -8
- package/es/plugins/SVGLoader.js +1414 -0
- package/es/plugins/console-debugger.js +34 -0
- package/es/plugins/export.js +7 -0
- package/es/plugins/keyboard.js +110 -0
- package/es/reducers/project-reducer.js +4 -1
- package/es/reducers/viewer2d-reducer.js +3 -1
- package/es/reducers/viewer3d-reducer.js +3 -1
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/utils/geometry.js +77 -119
- package/es/utils/helper.js +38 -1
- package/es/utils/isolate-event-handler.js +829 -609
- package/es/utils/molding.js +459 -11
- package/es/utils/ruler.js +58 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +170 -111
- package/lib/LiteRenderer.js +160 -129
- package/lib/actions/export.js +35 -39
- package/lib/actions/project-actions.js +2 -1
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/catalog.js +20 -4
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/factories/wall-factory.js +1 -1
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/properties/export.js +81 -0
- package/lib/catalog/properties/property-checkbox.js +76 -0
- package/lib/catalog/properties/property-color.js +47 -0
- package/lib/catalog/properties/property-enum.js +58 -0
- package/lib/catalog/properties/property-hidden.js +27 -0
- package/lib/catalog/properties/property-lenght-measure.js +108 -0
- package/lib/catalog/properties/property-length-measure.js +92 -0
- package/lib/catalog/properties/property-length-measure_hole.js +108 -0
- package/lib/catalog/properties/property-number.js +56 -0
- package/lib/catalog/properties/property-read-only.js +34 -0
- package/lib/catalog/properties/property-string.js +56 -0
- package/lib/catalog/properties/property-toggle.js +47 -0
- package/lib/catalog/properties/shared-property-style.js +21 -0
- package/lib/catalog/utils/exporter.js +24 -11
- package/lib/catalog/utils/item-loader.js +221 -217
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +90 -68
- package/lib/class/layer.js +1 -1
- package/lib/class/line.js +3 -7
- package/lib/class/project.js +96 -81
- package/lib/components/content.js +10 -93
- package/lib/components/export.js +6 -26
- package/lib/components/style/button.js +115 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +38 -0
- package/lib/components/style/content-title.js +35 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +105 -1
- package/lib/components/style/form-block.js +28 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +30 -0
- package/lib/components/style/form-number-input.js +29 -29
- package/lib/components/style/form-number-input_2.js +209 -0
- package/lib/components/style/form-select.js +29 -0
- package/lib/components/style/form-slider.js +68 -0
- package/lib/components/style/form-submit-button.js +35 -0
- package/lib/components/style/form-text-input.js +78 -0
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/group.js +5 -4
- package/lib/components/viewer2d/item.js +152 -356
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +22 -54
- package/lib/components/viewer2d/ruler.js +15 -10
- package/lib/components/viewer2d/rulerDist.js +38 -51
- package/lib/components/viewer2d/rulerX.js +4 -2
- package/lib/components/viewer2d/rulerY.js +3 -0
- package/lib/components/viewer2d/scene.js +17 -12
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/vertex.js +3 -2
- package/lib/components/viewer2d/viewer2d.js +79 -115
- package/lib/components/viewer3d/front3D.js +13 -1
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/components/viewer3d/scene-creator.js +267 -66
- package/lib/components/viewer3d/viewer3d-first-person.js +26 -32
- package/lib/components/viewer3d/viewer3d.js +107 -126
- package/lib/constants.js +12 -7
- package/lib/devLiteRenderer.js +489 -148
- package/lib/index.js +591 -62
- package/lib/models.js +13 -8
- package/lib/plugins/SVGLoader.js +1419 -0
- package/lib/plugins/console-debugger.js +42 -0
- package/lib/plugins/export.js +25 -0
- package/lib/plugins/keyboard.js +117 -0
- package/lib/reducers/project-reducer.js +4 -1
- package/lib/reducers/viewer2d-reducer.js +3 -1
- package/lib/reducers/viewer3d-reducer.js +3 -1
- package/lib/styles/export.js +13 -0
- package/lib/styles/tabs.css +40 -0
- package/lib/utils/geometry.js +77 -119
- package/lib/utils/helper.js +40 -1
- package/lib/utils/isolate-event-handler.js +829 -608
- package/lib/utils/molding.js +460 -9
- package/lib/utils/ruler.js +63 -0
- package/package.json +21 -20
- package/es/mocks/appliancePayload.json +0 -27
- package/es/mocks/cabinetPayload.json +0 -1914
- package/es/mocks/cabinetPayload2.json +0 -76
- package/es/mocks/dataBundle2.json +0 -4
- package/es/mocks/distancePayload.json +0 -6
- package/es/mocks/doorStylePayload2.json +0 -84
- package/es/mocks/furnishingPayload.json +0 -23
- package/es/mocks/itemCDSPayload.json +0 -27
- package/es/mocks/lightingPayload.json +0 -23
- package/es/mocks/mockProps.json +0 -43
- package/es/mocks/mockProps2.json +0 -9
- package/es/mocks/moldingPayload.json +0 -19
- package/es/mocks/projectItemsCatalog.json +0 -133
- package/es/mocks/rectangleShape.json +0 -238
- package/es/mocks/replaceCabinetPayload.json +0 -81
- package/es/mocks/roomShapePayload.json +0 -5
- package/es/useAppContext.js +0 -8
- package/lib/mocks/appliancePayload.json +0 -27
- package/lib/mocks/cabinetPayload.json +0 -1914
- package/lib/mocks/cabinetPayload2.json +0 -76
- package/lib/mocks/dataBundle2.json +0 -4
- package/lib/mocks/distancePayload.json +0 -6
- package/lib/mocks/doorStylePayload2.json +0 -84
- package/lib/mocks/furnishingPayload.json +0 -23
- package/lib/mocks/itemCDSPayload.json +0 -27
- package/lib/mocks/lightingPayload.json +0 -23
- package/lib/mocks/mockProps.json +0 -43
- package/lib/mocks/mockProps2.json +0 -9
- package/lib/mocks/moldingPayload.json +0 -19
- package/lib/mocks/projectItemsCatalog.json +0 -133
- package/lib/mocks/rectangleShape.json +0 -238
- package/lib/mocks/replaceCabinetPayload.json +0 -81
- package/lib/mocks/roomShapePayload.json +0 -5
- package/lib/useAppContext.js +0 -16
|
@@ -222,6 +222,31 @@ function createWarningObject() {
|
|
|
222
222
|
warningObj.name = 'warningObj';
|
|
223
223
|
return warningObj;
|
|
224
224
|
}
|
|
225
|
+
function swapLengthProperty(diffs) {
|
|
226
|
+
var idx1 = diffs.findIndex(function (v) {
|
|
227
|
+
return v.path[v.path.length - 1] === 'length';
|
|
228
|
+
});
|
|
229
|
+
var idx2 = diffs.findIndex(function (v) {
|
|
230
|
+
return v.path[v.path.length - 1] === '_length';
|
|
231
|
+
});
|
|
232
|
+
if (idx1 < 0 || idx2 < 0) return diffs;
|
|
233
|
+
if (idx1 > idx2) return diffs;
|
|
234
|
+
if (diffs[idx1].op === diffs[idx2].op) {
|
|
235
|
+
var isSwap = true;
|
|
236
|
+
for (var i = 0; i < diffs[idx1].path.length - 2; i++) {
|
|
237
|
+
if (diffs[idx1].path[i] !== diffs[idx2].path[i]) {
|
|
238
|
+
isSwap = false;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (isSwap) {
|
|
243
|
+
var temp = diffs[idx1];
|
|
244
|
+
diffs[idx1] = diffs[idx2];
|
|
245
|
+
diffs[idx2] = temp;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return diffs;
|
|
249
|
+
}
|
|
225
250
|
function updateScene(planData, sceneData, oldSceneData, diffArray, actions, catalog) {
|
|
226
251
|
var _draggingItem$toJS, _filteredDiffs, _filteredDiffs2;
|
|
227
252
|
var mode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
@@ -239,6 +264,9 @@ function updateScene(planData, sceneData, oldSceneData, diffArray, actions, cata
|
|
|
239
264
|
value: el.value
|
|
240
265
|
};
|
|
241
266
|
});
|
|
267
|
+
|
|
268
|
+
// move "length" to after "_length"
|
|
269
|
+
splitted = swapLengthProperty(splitted);
|
|
242
270
|
var filteredDiffs = filterDiffs(splitted, sceneData, oldSceneData);
|
|
243
271
|
//***testing additional filter***
|
|
244
272
|
filteredDiffs = filteredDiffs.filter(function (_ref) {
|
|
@@ -273,7 +301,7 @@ function updateScene(planData, sceneData, oldSceneData, diffArray, actions, cata
|
|
|
273
301
|
* Every 'doorStyle' change has a 'door_style_id' change.
|
|
274
302
|
* So, if door_style_id changes, it indicates 'doorStyle' change.
|
|
275
303
|
*/
|
|
276
|
-
if (['id'].includes(path[path.length - 1])) isSettingDoorStyle = true;
|
|
304
|
+
if (path[1] === 'layers' && path[3] === 'molding' || path[path.length - 2] === 'doorStyle' && path[path.length - 1] === 'id' || ['id'].includes(path[path.length - 1])) isSettingDoorStyle = true;
|
|
277
305
|
|
|
278
306
|
// If there are any molding change of layer
|
|
279
307
|
if (path[1] === 'layers' && path[3] === 'molding') isUpdateMolding = true;
|
|
@@ -486,19 +514,19 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
486
514
|
if (modifiedPath[keyIndex] == 'rotation') {
|
|
487
515
|
item3D.rotation.set(0, value * Math.PI / 180 + Math.PI, 0);
|
|
488
516
|
setTimeout(function () {
|
|
489
|
-
getDistances(layer);
|
|
517
|
+
getDistances(layer, item);
|
|
490
518
|
}, 50);
|
|
491
519
|
removeSelItemMesh(tmpMoldings, item, planData, mode);
|
|
492
520
|
} else if (modifiedPath[keyIndex] == 'x') {
|
|
493
521
|
item3D.position.x = value;
|
|
494
522
|
setTimeout(function () {
|
|
495
|
-
getDistances(layer);
|
|
523
|
+
getDistances(layer, item);
|
|
496
524
|
}, 50);
|
|
497
525
|
removeSelItemMesh(tmpMoldings, item, planData, mode);
|
|
498
526
|
} else if (modifiedPath[keyIndex] == 'y') {
|
|
499
527
|
item3D.position.z = -value;
|
|
500
528
|
setTimeout(function () {
|
|
501
|
-
getDistances(layer);
|
|
529
|
+
getDistances(layer, item);
|
|
502
530
|
}, 50);
|
|
503
531
|
removeSelItemMesh(tmpMoldings, item, planData, mode);
|
|
504
532
|
} else if (modifiedPath[keyIndex] == 'selected') {
|
|
@@ -649,10 +677,10 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
649
677
|
vLine3.material.depthTest = false;
|
|
650
678
|
var uVec = new Three.Vector3(-posVec.x / scalevec.x, -posVec.y / scalevec.y, -posVec.z / scalevec.z);
|
|
651
679
|
var blLighting = item.type.includes('Light');
|
|
652
|
-
vLine.translateY(blLighting ? 1.6 : 0.1);
|
|
653
|
-
vLine1.translateY(blLighting ? 1.6 : 0.1);
|
|
654
|
-
vLine2.translateY(blLighting ? 1.6 : 0.1);
|
|
655
|
-
vLine3.translateY(blLighting ? 1.6 : 0.1);
|
|
680
|
+
vLine.translateY(blLighting ? 1.6 : boundingBox.min.y + 0.1);
|
|
681
|
+
vLine1.translateY(blLighting ? 1.6 : boundingBox.min.y + 0.1);
|
|
682
|
+
vLine2.translateY(blLighting ? 1.6 : boundingBox.min.y + 0.1);
|
|
683
|
+
vLine3.translateY(blLighting ? 1.6 : boundingBox.min.y + 0.1);
|
|
656
684
|
upObj.translateOnAxis(uVec, 1);
|
|
657
685
|
upObj.translateY(max.y - min.y);
|
|
658
686
|
_mBox.name = 'TransformBox';
|
|
@@ -724,7 +752,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
724
752
|
return actions.itemsActions.selectItem(layer.id, modifiedPath[4]);
|
|
725
753
|
});
|
|
726
754
|
setTimeout(function () {
|
|
727
|
-
getDistances(layer);
|
|
755
|
+
getDistances(layer, item);
|
|
728
756
|
}, 100);
|
|
729
757
|
}
|
|
730
758
|
} else if (modifiedPath[keyIndex] == 'length') {
|
|
@@ -852,7 +880,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
852
880
|
removeItemWithoutItem(planData, layer.id, modifiedPath[4]);
|
|
853
881
|
promises.push(addItem(sceneData, planData, layer, modifiedPath[4], catalog, actions.itemsActions, mode, null, rItem));
|
|
854
882
|
setTimeout(function () {
|
|
855
|
-
getDistances(layer);
|
|
883
|
+
getDistances(layer, item);
|
|
856
884
|
}, 100);
|
|
857
885
|
}
|
|
858
886
|
break;
|
|
@@ -898,10 +926,169 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
898
926
|
promise: p1
|
|
899
927
|
};
|
|
900
928
|
}
|
|
901
|
-
function getDistances(layer, isCalcWall) {
|
|
929
|
+
function getDistances(layer, curItem, isCalcWall) {
|
|
930
|
+
// matching fvLine distance with OP
|
|
931
|
+
var pointArray = (0, _geometry2.calcDistancesFromItemToWalls)(curItem, layer).PointArray;
|
|
932
|
+
if ((pointArray === null || pointArray === void 0 ? void 0 : pointArray.length) > 0) {
|
|
933
|
+
var _loop2 = function _loop2() {
|
|
934
|
+
var direction = i === 0 ? 90 : i === 1 ? -90 : i === 2 ? 180 : 0;
|
|
935
|
+
if (fVLine[i].userData) {
|
|
936
|
+
var _pointArray$filter$;
|
|
937
|
+
var opDist = (_pointArray$filter$ = pointArray.filter(function (v) {
|
|
938
|
+
return v[1] === direction;
|
|
939
|
+
})[0]) !== null && _pointArray$filter$ !== void 0 ? _pointArray$filter$ : fVLine[i].userData.distance;
|
|
940
|
+
fVLine[i].userData.opDist = opDist[0];
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
for (var i = 0; i < ((_fVLine = fVLine) === null || _fVLine === void 0 ? void 0 : _fVLine.length); i++) {
|
|
944
|
+
var _fVLine;
|
|
945
|
+
_loop2();
|
|
946
|
+
}
|
|
947
|
+
}
|
|
902
948
|
fVLine.forEach(function (line, index) {
|
|
903
|
-
|
|
949
|
+
getLineDistance2(line, layer, (0, _helper.isEmpty)(isCalcWall) ? false : isCalcWall, index);
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
function getLineDistance2(obj, layer, isCalcWall, index) {
|
|
953
|
+
var _obj$userData$opDist, _obj$userData, _obj$userData2, _obj$userData$opDist2, _obj$userData3, _obj$userData4;
|
|
954
|
+
if (obj === undefined) return;
|
|
955
|
+
var positionAttribute = obj.geometry.attributes.position;
|
|
956
|
+
if (positionAttribute === undefined) return;
|
|
957
|
+
var wPoint0 = new Three.Vector3().fromBufferAttribute(positionAttribute, 0).applyMatrix4(obj.matrixWorld);
|
|
958
|
+
var wPoint1 = new Three.Vector3().fromBufferAttribute(positionAttribute, 1).applyMatrix4(obj.matrixWorld);
|
|
959
|
+
var raycaster = new Three.Raycaster(wPoint0, new Three.Vector3(wPoint1.x - wPoint0.x, wPoint1.y - wPoint0.y, wPoint1.z - wPoint0.z));
|
|
960
|
+
var rayDirection = raycaster.ray.direction;
|
|
961
|
+
raycaster.camera = new Three.Camera();
|
|
962
|
+
rayDirection.normalize();
|
|
963
|
+
var meshes = [];
|
|
964
|
+
planData.plan.traverse(function (child) {
|
|
965
|
+
if (child.isMesh && child.geometry) {
|
|
966
|
+
meshes.push(child);
|
|
967
|
+
}
|
|
904
968
|
});
|
|
969
|
+
var dx = wPoint0.x - wPoint1.x;
|
|
970
|
+
var dy = wPoint0.y - wPoint1.y;
|
|
971
|
+
var dz = wPoint0.z - wPoint1.z;
|
|
972
|
+
var length = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
973
|
+
var scale = 1;
|
|
974
|
+
var extrudeSettings = {
|
|
975
|
+
steps: 2,
|
|
976
|
+
depth: 0.01,
|
|
977
|
+
bevelEnabled: false
|
|
978
|
+
};
|
|
979
|
+
var w = 0.2;
|
|
980
|
+
var h = w * (Math.sqrt(3) / 2);
|
|
981
|
+
var shape = new Three.Shape();
|
|
982
|
+
shape.moveTo(0, 0);
|
|
983
|
+
shape.lineTo(-w / 4, h / 2);
|
|
984
|
+
shape.lineTo(w / 4, h / 2);
|
|
985
|
+
var geom = new Three.ExtrudeGeometry(shape, extrudeSettings);
|
|
986
|
+
geom.center();
|
|
987
|
+
var opDist = (_obj$userData$opDist = (_obj$userData = obj.userData) === null || _obj$userData === void 0 ? void 0 : _obj$userData.opDist) !== null && _obj$userData$opDist !== void 0 ? _obj$userData$opDist : (_obj$userData2 = obj.userData) === null || _obj$userData2 === void 0 ? void 0 : _obj$userData2.distance;
|
|
988
|
+
scale = opDist / length;
|
|
989
|
+
if (opDist <= 0.1) {
|
|
990
|
+
scale = 0.1 / length;
|
|
991
|
+
}
|
|
992
|
+
obj.userData.distance = (_obj$userData$opDist2 = (_obj$userData3 = obj.userData) === null || _obj$userData3 === void 0 ? void 0 : _obj$userData3.opDist) !== null && _obj$userData$opDist2 !== void 0 ? _obj$userData$opDist2 : (_obj$userData4 = obj.userData) === null || _obj$userData4 === void 0 ? void 0 : _obj$userData4.distance;
|
|
993
|
+
// obj.userData.target = intersects[i].object;
|
|
994
|
+
var originPoint = obj.geometry.attributes.position.array.slice(0, 3);
|
|
995
|
+
var lx = obj.geometry.attributes.position.array[3] - obj.geometry.attributes.position.array[0];
|
|
996
|
+
var ly = obj.geometry.attributes.position.array[4] - obj.geometry.attributes.position.array[1];
|
|
997
|
+
var lz = obj.geometry.attributes.position.array[5] - obj.geometry.attributes.position.array[2];
|
|
998
|
+
var newVec = new Three.Vector3(originPoint[0] + lx * scale, originPoint[1] + ly * scale, originPoint[2] + lz * scale);
|
|
999
|
+
obj.geometry.attributes.position.array[3] = newVec.x;
|
|
1000
|
+
obj.geometry.attributes.position.array[4] = newVec.y;
|
|
1001
|
+
obj.geometry.attributes.position.array[5] = newVec.z;
|
|
1002
|
+
obj.geometry.attributes.position.needsUpdate = true;
|
|
1003
|
+
obj.geometry.computeBoundingSphere();
|
|
1004
|
+
obj.geometry.computeBoundingBox();
|
|
1005
|
+
var dist = (0, _convertUnitsLite.convert)(opDist).from('cm').to('in');
|
|
1006
|
+
if (dist > 3) {
|
|
1007
|
+
var _canvas = getDistanceCanvas(dist, layer);
|
|
1008
|
+
var wid = _canvas.width / window.innerWidth * 30;
|
|
1009
|
+
var hei = _canvas.height / window.innerHeight * 30;
|
|
1010
|
+
var texture = new Three.Texture(_canvas);
|
|
1011
|
+
texture.minFilter = Three.LinearFilter;
|
|
1012
|
+
texture.needsUpdate = true;
|
|
1013
|
+
var geometry = new Three.PlaneGeometry(wid / 5, hei / 5);
|
|
1014
|
+
geometry.computeBoundingBox();
|
|
1015
|
+
var material = new Three.MeshBasicMaterial({
|
|
1016
|
+
map: texture,
|
|
1017
|
+
side: Three.DoubleSide
|
|
1018
|
+
});
|
|
1019
|
+
var textMesh = new Three.Mesh(geometry, material);
|
|
1020
|
+
for (; obj.children.length != 0;) {
|
|
1021
|
+
var temp = obj.children.pop();
|
|
1022
|
+
(0, _threeMemoryCleaner.disposeObject)(temp);
|
|
1023
|
+
}
|
|
1024
|
+
textMesh.rotation.set(Math.PI / 2, Math.PI, 0);
|
|
1025
|
+
// obj.add(textMesh);
|
|
1026
|
+
textMesh.position.set((obj.geometry.attributes.position.array[0] + obj.geometry.attributes.position.array[3]) / 2, 0.01, (obj.geometry.attributes.position.array[2] + obj.geometry.attributes.position.array[5]) / 2);
|
|
1027
|
+
textMesh.name = 'lineText';
|
|
1028
|
+
textMesh.renderOrder = 2;
|
|
1029
|
+
textMesh.material.depthTest = false;
|
|
1030
|
+
textMesh.material.transparent = true;
|
|
1031
|
+
var sprite1 = new Three.Sprite(new Three.SpriteMaterial({
|
|
1032
|
+
map: texture
|
|
1033
|
+
}));
|
|
1034
|
+
sprite1.position.set((obj.geometry.attributes.position.array[0] + obj.geometry.attributes.position.array[3]) / 2, 0.01, (obj.geometry.attributes.position.array[2] + obj.geometry.attributes.position.array[5]) / 2);
|
|
1035
|
+
sprite1.name = 'lineText';
|
|
1036
|
+
sprite1.renderOrder = 2;
|
|
1037
|
+
sprite1.scale.set(0.2, 0.1, 0.2);
|
|
1038
|
+
sprite1.layers.set(1);
|
|
1039
|
+
sprite1.material.depthTest = false;
|
|
1040
|
+
obj.add(sprite1);
|
|
1041
|
+
if (obj.parent != null) {
|
|
1042
|
+
// is not lighting
|
|
1043
|
+
var item3D = obj.parent.parent.parent;
|
|
1044
|
+
var max = item3D.children[0].userData.max;
|
|
1045
|
+
var min = item3D.children[0].userData.min;
|
|
1046
|
+
var objW = (max.x - min.x) / 100,
|
|
1047
|
+
objL = (max.z - min.z) / 100;
|
|
1048
|
+
var triangle = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
1049
|
+
color: _constants.SHADE_DARK_PURPLE_COLOR
|
|
1050
|
+
}));
|
|
1051
|
+
var triangle1 = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
1052
|
+
color: _constants.SHADE_DARK_PURPLE_COLOR
|
|
1053
|
+
}));
|
|
1054
|
+
triangle.position.set((index < 2 ? 0 : Math.sin((index === 2 ? 1 : -1) * Math.PI / 2)) * (obj.geometry.attributes.position.array[0] + h / 4 + (index % 2 === 0 ? 0 : objW)), newVec.y, (index < 2 ? Math.cos(index * Math.PI) : 0) * (obj.geometry.attributes.position.array[2] + h / 4 + (index % 2 === 0 ? 0 : objL)));
|
|
1055
|
+
triangle1.position.set(newVec.x - (index < 2 ? 0 : Math.sin((index === 2 ? 1 : -1) * Math.PI / 2)) * h / 4, newVec.y, newVec.z - (index < 2 ? Math.cos(index * Math.PI) : 0) * h / 4);
|
|
1056
|
+
if (index < 2) {
|
|
1057
|
+
triangle.rotation.x = Math.cos(index * Math.PI) * Math.PI / 2;
|
|
1058
|
+
triangle1.rotation.x = -Math.cos(index * Math.PI) * Math.PI / 2;
|
|
1059
|
+
} else {
|
|
1060
|
+
triangle.rotation.x = -Math.PI / 2;
|
|
1061
|
+
triangle.rotation.z = -(index === 2 ? 1 : -1) * Math.PI / 2;
|
|
1062
|
+
triangle1.rotation.x = Math.PI / 2;
|
|
1063
|
+
triangle1.rotation.z = (index === 2 ? 1 : -1) * Math.PI / 2;
|
|
1064
|
+
}
|
|
1065
|
+
triangle.name = 'lineText';
|
|
1066
|
+
triangle1.name = 'lineText';
|
|
1067
|
+
triangle.renderOrder = 2;
|
|
1068
|
+
triangle1.renderOrder = 2;
|
|
1069
|
+
triangle.material.transparent = true;
|
|
1070
|
+
triangle1.material.transparent = true;
|
|
1071
|
+
triangle.material.depthTest = false;
|
|
1072
|
+
triangle1.material.depthTest = false;
|
|
1073
|
+
obj.add(triangle);
|
|
1074
|
+
obj.add(triangle1);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
// if (obj.userData.distance <= 50 && obj.userData.distance >= 0.5) {
|
|
1079
|
+
var real_target = obj.userData.target;
|
|
1080
|
+
for (; ((_real_target = real_target) === null || _real_target === void 0 ? void 0 : _real_target.name) != 'pivot';) {
|
|
1081
|
+
var _real_target, _real_target2, _real_target3;
|
|
1082
|
+
if (((_real_target2 = real_target) === null || _real_target2 === void 0 ? void 0 : _real_target2.parent) == null) break;
|
|
1083
|
+
real_target = (_real_target3 = real_target) === null || _real_target3 === void 0 ? void 0 : _real_target3.parent;
|
|
1084
|
+
}
|
|
1085
|
+
// let item3D = obj.parent.parent.parent;
|
|
1086
|
+
// let origin = obj.geometry.vertices[0].clone().applyMatrix4(obj.matrixWorld);
|
|
1087
|
+
// let target = obj.geometry.vertices[1].clone().applyMatrix4(obj.matrixWorld);
|
|
1088
|
+
// let uVec = new Three.Vector3(target.x - origin.x - 0.2, target.y - origin.y - 0.2, target.z - origin.z - 0.2);
|
|
1089
|
+
obj.visible = true;
|
|
1090
|
+
if (dist < 3) obj.visible = false;
|
|
1091
|
+
return obj;
|
|
905
1092
|
}
|
|
906
1093
|
function getLineDistance(obj, layer, isCalcWall, index) {
|
|
907
1094
|
if (obj === undefined) return;
|
|
@@ -958,12 +1145,12 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
958
1145
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
959
1146
|
obj.geometry.computeBoundingSphere();
|
|
960
1147
|
obj.geometry.computeBoundingBox();
|
|
961
|
-
var dist = (0,
|
|
1148
|
+
var dist = (0, _convertUnitsLite.convert)(intersects[i].distance).from('cm').to('in');
|
|
962
1149
|
if (dist > 3) {
|
|
963
|
-
var
|
|
964
|
-
var wid =
|
|
965
|
-
var hei =
|
|
966
|
-
var texture = new Three.Texture(
|
|
1150
|
+
var _canvas2 = getDistanceCanvas(dist, layer);
|
|
1151
|
+
var wid = _canvas2.width / window.innerWidth * 30;
|
|
1152
|
+
var hei = _canvas2.height / window.innerHeight * 30;
|
|
1153
|
+
var texture = new Three.Texture(_canvas2);
|
|
967
1154
|
texture.minFilter = Three.LinearFilter;
|
|
968
1155
|
texture.needsUpdate = true;
|
|
969
1156
|
var geometry = new Three.PlaneGeometry(wid / 5, hei / 5);
|
|
@@ -992,6 +1179,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
992
1179
|
sprite1.renderOrder = 2;
|
|
993
1180
|
sprite1.scale.set(0.2, 0.1, 0.2);
|
|
994
1181
|
sprite1.layers.set(1);
|
|
1182
|
+
sprite1.material.depthTest = false;
|
|
995
1183
|
obj.add(sprite1);
|
|
996
1184
|
if (obj.parent != null) {
|
|
997
1185
|
// is not lighting
|
|
@@ -1080,12 +1268,12 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1080
1268
|
obj.geometry.attributes.position.array[4] = _newVec.y;
|
|
1081
1269
|
obj.geometry.attributes.position.array[5] = _newVec.z;
|
|
1082
1270
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
1083
|
-
var _dist = (0, _math.formatNumber)(distance, _constants.DECIMAL_PLACES_2);
|
|
1271
|
+
var _dist = (0, _convertUnitsLite.convert)((0, _math.formatNumber)(distance, _constants.DECIMAL_PLACES_2)).from('cm').to('in');
|
|
1084
1272
|
if (_dist > 3) {
|
|
1085
|
-
var
|
|
1086
|
-
var _wid =
|
|
1087
|
-
var _hei =
|
|
1088
|
-
var _texture = new Three.Texture(
|
|
1273
|
+
var _canvas3 = getDistanceCanvas(_dist, layer);
|
|
1274
|
+
var _wid = _canvas3.width / window.innerWidth * 30;
|
|
1275
|
+
var _hei = _canvas3.height / window.innerHeight * 30;
|
|
1276
|
+
var _texture = new Three.Texture(_canvas3);
|
|
1089
1277
|
_texture.needsUpdate = true;
|
|
1090
1278
|
var _geometry = new Three.PlaneGeometry(_wid / 2, _hei / 2);
|
|
1091
1279
|
_geometry.computeBoundingBox();
|
|
@@ -1210,12 +1398,18 @@ function getIntersectPoint(opX, opY, pX, pY) {
|
|
|
1210
1398
|
function gcd(a, b) {
|
|
1211
1399
|
return a % b ? gcd(b, a % b) : b;
|
|
1212
1400
|
}
|
|
1213
|
-
function
|
|
1214
|
-
var
|
|
1401
|
+
function getDistanceCanvas(distance, layer) {
|
|
1402
|
+
var _layer$unit;
|
|
1403
|
+
var parameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1215
1404
|
var canvas = document.createElement('canvas');
|
|
1216
1405
|
var ctx = canvas.getContext('2d');
|
|
1406
|
+
var curUnit = (_layer$unit = layer === null || layer === void 0 ? void 0 : layer.unit) !== null && _layer$unit !== void 0 ? _layer$unit : _constants.UNIT_INCH;
|
|
1407
|
+
var fixedLength = (layer === null || layer === void 0 ? void 0 : layer.unit) === _constants.UNIT_METER || (layer === null || layer === void 0 ? void 0 : layer.unit) === _constants.UNIT_FOOT ? 2 : 0;
|
|
1408
|
+
var distText = String((Math.round((0, _convertUnitsLite.convert)(distance).from('in').to(curUnit) * 100) / 100).toFixed(fixedLength));
|
|
1217
1409
|
var fontSize = 16;
|
|
1218
|
-
var integral =
|
|
1410
|
+
var integral = distText + curUnit;
|
|
1411
|
+
// let integral = String(distance) + "''";
|
|
1412
|
+
|
|
1219
1413
|
parameters.fontName = parameters.fontName || _constants.ARROW_TEXT_FONTFACE;
|
|
1220
1414
|
|
|
1221
1415
|
// Prepare the font to be able to measure
|
|
@@ -1809,7 +2003,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1809
2003
|
layer.lines.forEach(function (data) {
|
|
1810
2004
|
lines.push(data);
|
|
1811
2005
|
});
|
|
1812
|
-
var
|
|
2006
|
+
var _loop3 = function _loop3() {
|
|
1813
2007
|
var data = lines[i];
|
|
1814
2008
|
var realVec = [];
|
|
1815
2009
|
data.vertices.forEach(function (vec) {
|
|
@@ -1822,7 +2016,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1822
2016
|
}
|
|
1823
2017
|
};
|
|
1824
2018
|
for (var i = 0; i < lines.length; i++) {
|
|
1825
|
-
if (
|
|
2019
|
+
if (_loop3()) break;
|
|
1826
2020
|
}
|
|
1827
2021
|
ceil.translateZ((0, _convertUnitsLite.convert)(layer.ceilHeight).from(layer.unit).to(_constants.UNIT_CENTIMETER));
|
|
1828
2022
|
pivot.name = 'pivot';
|
|
@@ -1877,6 +2071,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1877
2071
|
if (!catalogElement) catalogElement = catalog.getElement((0, _utils.returnReplaceableDeepSearchType)(item.type));
|
|
1878
2072
|
if (!catalogElement) return false;
|
|
1879
2073
|
return catalogElement.render3D(item, layer, sceneData, mode).then(function (item3D) {
|
|
2074
|
+
var _item$properties$getI, _item$properties$getI2, _item$properties$getI3;
|
|
1880
2075
|
if (item3D instanceof Three.LOD) {
|
|
1881
2076
|
planData.sceneGraph.LODs[itemID] = item3D;
|
|
1882
2077
|
}
|
|
@@ -1933,7 +2128,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1933
2128
|
if (child.type === 'Line' && child.geometry.attributes !== undefined) fVLine.push(child);
|
|
1934
2129
|
});
|
|
1935
2130
|
setTimeout(function () {
|
|
1936
|
-
getDistances();
|
|
2131
|
+
getDistances(layer, item);
|
|
1937
2132
|
}, 50);
|
|
1938
2133
|
}
|
|
1939
2134
|
applyOpacity(pivot, opacity);
|
|
@@ -1992,9 +2187,9 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1992
2187
|
var catid = item.type;
|
|
1993
2188
|
var cat = catalog.elements[catid];
|
|
1994
2189
|
if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
|
|
1995
|
-
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from('in').to(sceneData.unit);
|
|
1996
|
-
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['height', '_length'])).from('in').to(sceneData.unit);
|
|
1997
|
-
var depth = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from('in').to(sceneData.unit);
|
|
2190
|
+
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from((_item$properties$getI = item.properties.getIn(['width', '_unit'])) !== null && _item$properties$getI !== void 0 ? _item$properties$getI : 'in').to(sceneData.unit);
|
|
2191
|
+
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['height', '_length'])).from((_item$properties$getI2 = item.properties.getIn(['height', '_unit'])) !== null && _item$properties$getI2 !== void 0 ? _item$properties$getI2 : 'in').to(sceneData.unit);
|
|
2192
|
+
var depth = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from((_item$properties$getI3 = item.properties.getIn(['depth', '_unit'])) !== null && _item$properties$getI3 !== void 0 ? _item$properties$getI3 : 'in').to(sceneData.unit);
|
|
1998
2193
|
val.size = {
|
|
1999
2194
|
width: width,
|
|
2000
2195
|
height: height,
|
|
@@ -2048,7 +2243,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
2048
2243
|
return itemsActions.selectItem(layer.id, item.id);
|
|
2049
2244
|
});
|
|
2050
2245
|
setTimeout(function () {
|
|
2051
|
-
return getDistances(layer);
|
|
2246
|
+
return getDistances(layer, item);
|
|
2052
2247
|
}, 100);
|
|
2053
2248
|
if (!sceneData.loadFlag && scene_mode == _constants.MODE_DRAWING_ITEM_3D) {
|
|
2054
2249
|
itemsActions.endLoading();
|
|
@@ -2875,19 +3070,23 @@ function createBacksplash(item, layer, planData, scene) {
|
|
|
2875
3070
|
var altItems = [],
|
|
2876
3071
|
flag = false;
|
|
2877
3072
|
wallItems.map(function (wallItem) {
|
|
2878
|
-
var
|
|
2879
|
-
var
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
3073
|
+
var _wallItem$itemInfo, _wallItem$itemInfo2;
|
|
3074
|
+
var altitude = (_wallItem$itemInfo = wallItem.itemInfo) === null || _wallItem$itemInfo === void 0 || (_wallItem$itemInfo = _wallItem$itemInfo.properties) === null || _wallItem$itemInfo === void 0 ? void 0 : _wallItem$itemInfo.get('altitude').get('_length');
|
|
3075
|
+
var altitudeUnit = ((_wallItem$itemInfo2 = wallItem.itemInfo) === null || _wallItem$itemInfo2 === void 0 || (_wallItem$itemInfo2 = _wallItem$itemInfo2.properties) === null || _wallItem$itemInfo2 === void 0 ? void 0 : _wallItem$itemInfo2.get('altitude').get('_unit')) || 'cm';
|
|
3076
|
+
if (!(0, _helper.isEmpty)(altitude) && !(0, _helper.isEmpty)(altitudeUnit)) {
|
|
3077
|
+
altitude = (0, _convertUnitsLite.convert)(altitude).from(altitudeUnit).to('cm');
|
|
3078
|
+
altItems.push({
|
|
3079
|
+
x: wallItem.pos.x,
|
|
3080
|
+
width: wallItem.size.width,
|
|
3081
|
+
altitude: altitude
|
|
3082
|
+
});
|
|
3083
|
+
}
|
|
2886
3084
|
});
|
|
2887
3085
|
layer.holes.map(function (hole) {
|
|
2888
|
-
var
|
|
2889
|
-
var
|
|
2890
|
-
|
|
3086
|
+
var _hole$properties, _hole$properties2;
|
|
3087
|
+
var width = (_hole$properties = hole.properties) === null || _hole$properties === void 0 ? void 0 : _hole$properties.getIn(['width', 'length']);
|
|
3088
|
+
var altitude = (_hole$properties2 = hole.properties) === null || _hole$properties2 === void 0 ? void 0 : _hole$properties2.getIn(['altitude', 'length']);
|
|
3089
|
+
if (!(0, _helper.isEmpty)(width) && !(0, _helper.isEmpty)(altitude)) altItems.push({
|
|
2891
3090
|
x: hole.x,
|
|
2892
3091
|
width: width,
|
|
2893
3092
|
altitude: altitude
|
|
@@ -3065,23 +3264,18 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3065
3264
|
// let layoutType = molding.items[0].layoutpos;
|
|
3066
3265
|
// let visible = molding.items[0];
|
|
3067
3266
|
molding.pointGroups.forEach(function (pointGroup) {
|
|
3267
|
+
var _child$width_unit, _child$height_unit, _child$length_unit;
|
|
3068
3268
|
var geometry = new Three.BufferGeometry();
|
|
3069
3269
|
var length = data.length; //point array
|
|
3070
|
-
var
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
}
|
|
3080
|
-
temp_unit = child.length_unit;
|
|
3081
|
-
if (temp_unit === 'inch') {
|
|
3082
|
-
child.length = (0, _convertUnitsLite.convert)(child.length).from('in').to('cm');
|
|
3083
|
-
child.length_unit = 'cm';
|
|
3084
|
-
}
|
|
3270
|
+
var widthUnit = child.width_unit === 'inch' ? 'in' : (_child$width_unit = child.width_unit) !== null && _child$width_unit !== void 0 ? _child$width_unit : 'in';
|
|
3271
|
+
var heightUnit = child.height_unit === 'inch' ? 'in' : (_child$height_unit = child.height_unit) !== null && _child$height_unit !== void 0 ? _child$height_unit : 'in';
|
|
3272
|
+
var lengthUnit = child.length_unit === 'inch' ? 'in' : (_child$length_unit = child.length_unit) !== null && _child$length_unit !== void 0 ? _child$length_unit : 'in';
|
|
3273
|
+
child.height = (0, _convertUnitsLite.convert)(child.height).from(heightUnit).to('cm');
|
|
3274
|
+
child.height_unit = 'cm';
|
|
3275
|
+
child.width = (0, _convertUnitsLite.convert)(child.width).from(widthUnit).to('cm');
|
|
3276
|
+
child.width_unit = 'cm';
|
|
3277
|
+
child.length = (0, _convertUnitsLite.convert)(child.length).from(lengthUnit).to('cm');
|
|
3278
|
+
child.length_unit = 'cm';
|
|
3085
3279
|
geometry.needsUpdate = true;
|
|
3086
3280
|
geometry = moldingVertices(pointGroup, geometry, data, child, svg_width, svg_height, molding.pointGroups.length);
|
|
3087
3281
|
var total = geometry.attributes.position.count;
|
|
@@ -3391,7 +3585,7 @@ function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3391
3585
|
if ((0, _helper.isEmpty)(filteredNewMGList)) {
|
|
3392
3586
|
return true;
|
|
3393
3587
|
}
|
|
3394
|
-
var
|
|
3588
|
+
var _loop4 = function _loop4() {
|
|
3395
3589
|
var newMG = filteredNewMGList[k];
|
|
3396
3590
|
if (oldMG.items.some(function (it) {
|
|
3397
3591
|
return it.id === selItem.id;
|
|
@@ -3444,7 +3638,7 @@ function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3444
3638
|
},
|
|
3445
3639
|
_ret;
|
|
3446
3640
|
for (var k = 0; k < filteredNewMGList.length; k++) {
|
|
3447
|
-
_ret =
|
|
3641
|
+
_ret = _loop4();
|
|
3448
3642
|
if (_ret) return _ret.v;
|
|
3449
3643
|
}
|
|
3450
3644
|
return true;
|
|
@@ -3452,14 +3646,21 @@ function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3452
3646
|
if (changeMoldings.length === 0 && isEnableMolding) {
|
|
3453
3647
|
// refresh mesh of the updating molding groups
|
|
3454
3648
|
new_MGArray.forEach(function (mg, index) {
|
|
3455
|
-
|
|
3456
|
-
|
|
3649
|
+
var _mg$items$;
|
|
3650
|
+
if ((_mg$items$ = mg.items[0]) !== null && _mg$items$ !== void 0 && (_mg$items$ = _mg$items$.molding) !== null && _mg$items$ !== void 0 && _mg$items$.some(function (mol) {
|
|
3651
|
+
var _mol$toJS;
|
|
3652
|
+
return (0, _helper.isImmutable)(mol) ? (mol === null || mol === void 0 || (_mol$toJS = mol.toJS()) === null || _mol$toJS === void 0 ? void 0 : _mol$toJS.location_type) === mg.location_type : (mol === null || mol === void 0 ? void 0 : mol.location_type) === mg.location_type;
|
|
3457
3653
|
})) {
|
|
3458
|
-
var
|
|
3459
|
-
|
|
3654
|
+
var _mg$items$2, _mg$items$3, _mg$items$4;
|
|
3655
|
+
var molding = (0, _helper.isImmutable)((_mg$items$2 = mg.items[0]) === null || _mg$items$2 === void 0 ? void 0 : _mg$items$2.molding) ? (_mg$items$3 = mg.items[0]) === null || _mg$items$3 === void 0 || (_mg$items$3 = _mg$items$3.molding) === null || _mg$items$3 === void 0 ? void 0 : _mg$items$3.filter(function (mol) {
|
|
3656
|
+
var _mol$toJS2;
|
|
3657
|
+
return (mol === null || mol === void 0 || (_mol$toJS2 = mol.toJS()) === null || _mol$toJS2 === void 0 ? void 0 : _mol$toJS2.location_type) === mg.location_type;
|
|
3658
|
+
}).toJS()[0] : (_mg$items$4 = mg.items[0]) === null || _mg$items$4 === void 0 || (_mg$items$4 = _mg$items$4.molding) === null || _mg$items$4 === void 0 ? void 0 : _mg$items$4.filter(function (mol) {
|
|
3659
|
+
return (mol === null || mol === void 0 ? void 0 : mol.location_type) === mg.location_type;
|
|
3460
3660
|
})[0];
|
|
3461
3661
|
if (mg.molding === null || mg.molding.itemID !== mol.itemID || mg.lines === null || mg.points === null) {
|
|
3462
|
-
|
|
3662
|
+
var _mg$molding;
|
|
3663
|
+
if (mg.molding !== null && ((_mg$molding = mg.molding) === null || _mg$molding === void 0 ? void 0 : _mg$molding.itemID) !== molding.itemID) {
|
|
3463
3664
|
deleteMGMesh(mg, planData, mode);
|
|
3464
3665
|
}
|
|
3465
3666
|
mg = _export.MoldingUtils.createMonldingGroup(mg, layer, molding, planData.catalog);
|
|
@@ -3606,7 +3807,7 @@ function addWarningBox(itemId, altitude, planData) {
|
|
|
3606
3807
|
deleteSpecifiedMeshObjects('WarningBox' + itemId);
|
|
3607
3808
|
var item3D = planData.sceneGraph.layers[planData.sceneData.selectedLayer].items[itemId];
|
|
3608
3809
|
if (item3D == undefined) return;
|
|
3609
|
-
var altitudeLength =
|
|
3810
|
+
var altitudeLength = altitude;
|
|
3610
3811
|
var sBounding = item3D.children[0].userData;
|
|
3611
3812
|
var width = sBounding.max.x - sBounding.min.x;
|
|
3612
3813
|
var height = sBounding.max.y - sBounding.min.y;
|
|
@@ -11,7 +11,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
11
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
14
|
var _react = _interopRequireDefault(require("react"));
|
|
16
15
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
16
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
@@ -22,7 +21,6 @@ var _immutablediff = _interopRequireDefault(require("immutablediff"));
|
|
|
22
21
|
var _pointerLockNavigation = require("./pointer-lock-navigation");
|
|
23
22
|
var _firstPersonControls = require("./libs/first-person-controls");
|
|
24
23
|
var SharedStyle = _interopRequireWildcard(require("../../shared-style"));
|
|
25
|
-
var _AppContext = _interopRequireDefault(require("../../AppContext"));
|
|
26
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
27
25
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
28
26
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
@@ -31,7 +29,6 @@ var Viewer3DFirstPerson = exports["default"] = /*#__PURE__*/function (_React$Com
|
|
|
31
29
|
var _this;
|
|
32
30
|
(0, _classCallCheck2["default"])(this, Viewer3DFirstPerson);
|
|
33
31
|
_this = _callSuper(this, Viewer3DFirstPerson, [props]);
|
|
34
|
-
_this.canvasWrapperRef = /*#__PURE__*/_react["default"].createRef();
|
|
35
32
|
_this.width = props.width;
|
|
36
33
|
_this.height = props.height;
|
|
37
34
|
_this.stopRendering = false;
|
|
@@ -65,7 +62,7 @@ var Viewer3DFirstPerson = exports["default"] = /*#__PURE__*/function (_React$Com
|
|
|
65
62
|
};
|
|
66
63
|
var state = this.props.state;
|
|
67
64
|
var data = state.scene;
|
|
68
|
-
var canvasWrapper = this.
|
|
65
|
+
var canvasWrapper = _reactDom["default"].findDOMNode(this.refs.canvasWrapper);
|
|
69
66
|
var scene3D = new Three.Scene();
|
|
70
67
|
|
|
71
68
|
// As I need to show the pointer above all scene objects, I use this workaround http://stackoverflow.com/a/13309722
|
|
@@ -264,12 +261,10 @@ var Viewer3DFirstPerson = exports["default"] = /*#__PURE__*/function (_React$Com
|
|
|
264
261
|
this.renderer.renderLists.dispose();
|
|
265
262
|
}
|
|
266
263
|
}, {
|
|
267
|
-
key: "
|
|
268
|
-
value: function
|
|
269
|
-
var
|
|
270
|
-
|
|
271
|
-
height = _this$props.height,
|
|
272
|
-
state = _this$props.state;
|
|
264
|
+
key: "componentWillReceiveProps",
|
|
265
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
266
|
+
var width = nextProps.width,
|
|
267
|
+
height = nextProps.height;
|
|
273
268
|
var camera = this.camera,
|
|
274
269
|
renderer = this.renderer,
|
|
275
270
|
scene3D = this.scene3D,
|
|
@@ -282,41 +277,40 @@ var Viewer3DFirstPerson = exports["default"] = /*#__PURE__*/function (_React$Com
|
|
|
282
277
|
linesActions: this.context.linesActions,
|
|
283
278
|
projectActions: this.context.projectActions
|
|
284
279
|
};
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
renderer.setSize(width, height);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// Handle scene changes
|
|
296
|
-
if (state.scene !== prevProps.state.scene) {
|
|
297
|
-
var changedValues = (0, _immutablediff["default"])(prevProps.state.scene, state.scene);
|
|
298
|
-
(0, _sceneCreator.updateScene)(planData, state.scene, prevProps.state.scene, changedValues.toJS(), actions, this.context.catalog);
|
|
280
|
+
this.width = width;
|
|
281
|
+
this.height = height;
|
|
282
|
+
camera.aspect = width / height;
|
|
283
|
+
camera.updateProjectionMatrix();
|
|
284
|
+
if (nextProps.scene !== this.props.state.scene) {
|
|
285
|
+
var changedValues = (0, _immutablediff["default"])(this.props.state.scene, nextProps.state.scene);
|
|
286
|
+
(0, _sceneCreator.updateScene)(planData, nextProps.state.scene, this.props.state.scene, changedValues.toJS(), actions, this.context.catalog);
|
|
299
287
|
}
|
|
300
|
-
|
|
301
|
-
//
|
|
302
|
-
renderer.
|
|
303
|
-
renderer.
|
|
304
|
-
renderer.
|
|
305
|
-
renderer.render(sceneOnTop, camera);
|
|
288
|
+
renderer.setSize(width, height);
|
|
289
|
+
renderer.clear(); // clear buffers
|
|
290
|
+
renderer.render(scene3D, camera); // render scene 1
|
|
291
|
+
renderer.clearDepth(); // clear depth buffer
|
|
292
|
+
renderer.render(sceneOnTop, camera); // render scene 2
|
|
306
293
|
}
|
|
307
294
|
}, {
|
|
308
295
|
key: "render",
|
|
309
296
|
value: function render() {
|
|
310
297
|
return /*#__PURE__*/_react["default"].createElement('div', {
|
|
311
|
-
ref:
|
|
298
|
+
ref: 'canvasWrapper'
|
|
312
299
|
});
|
|
313
300
|
}
|
|
314
301
|
}]);
|
|
315
302
|
}(_react["default"].Component);
|
|
316
|
-
(0, _defineProperty2["default"])(Viewer3DFirstPerson, "contextType", _AppContext["default"]);
|
|
317
303
|
Viewer3DFirstPerson.propTypes = {
|
|
318
304
|
state: _propTypes["default"].object.isRequired,
|
|
319
305
|
width: _propTypes["default"].number.isRequired,
|
|
320
306
|
height: _propTypes["default"].number.isRequired
|
|
321
307
|
};
|
|
308
|
+
Viewer3DFirstPerson.contextTypes = {
|
|
309
|
+
areaActions: _propTypes["default"].object.isRequired,
|
|
310
|
+
holesActions: _propTypes["default"].object.isRequired,
|
|
311
|
+
itemsActions: _propTypes["default"].object.isRequired,
|
|
312
|
+
linesActions: _propTypes["default"].object.isRequired,
|
|
313
|
+
projectActions: _propTypes["default"].object.isRequired,
|
|
314
|
+
catalog: _propTypes["default"].object
|
|
315
|
+
};
|
|
322
316
|
module.exports = exports.default;
|