kitchen-simulator 4.1.1-react-18 → 4.1.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 +162 -111
- package/es/LiteRenderer.js +161 -129
- package/es/actions/export.js +25 -12
- 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 +222 -213
- package/es/class/hole.js +0 -2
- package/es/class/item.js +89 -70
- package/es/class/layer.js +1 -1
- package/es/class/line.js +4 -8
- package/es/class/project.js +97 -80
- package/es/components/content.js +5 -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 -27
- 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 -52
- 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 +56 -87
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +255 -58
- package/es/components/viewer3d/viewer3d-first-person.js +24 -26
- package/es/components/viewer3d/viewer3d.js +103 -124
- package/es/constants.js +7 -2
- package/es/devLiteRenderer.js +491 -150
- package/es/index.js +588 -23
- 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 +3 -0
- 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 +827 -607
- package/es/utils/molding.js +459 -11
- package/es/utils/ruler.js +58 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +161 -111
- package/lib/LiteRenderer.js +160 -129
- package/lib/actions/export.js +35 -39
- 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 +219 -210
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +87 -68
- package/lib/class/layer.js +1 -1
- package/lib/class/line.js +3 -7
- package/lib/class/project.js +97 -80
- package/lib/components/content.js +5 -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 -27
- 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 -52
- 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 +54 -84
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/components/viewer3d/scene-creator.js +252 -55
- package/lib/components/viewer3d/viewer3d-first-person.js +24 -26
- package/lib/components/viewer3d/viewer3d.js +100 -120
- package/lib/constants.js +12 -7
- package/lib/devLiteRenderer.js +489 -148
- package/lib/index.js +590 -23
- 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 +3 -0
- 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 +827 -606
- package/lib/utils/molding.js +460 -9
- package/lib/utils/ruler.js +63 -0
- package/package.json +20 -15
- 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
|
@@ -9,14 +9,14 @@ import * as Three from 'three';
|
|
|
9
9
|
import { Color, Group } from 'three';
|
|
10
10
|
import createGrid from "./grid-creator";
|
|
11
11
|
import { disposeObject } from "./three-memory-cleaner";
|
|
12
|
-
import { ANIMATE_STEP_MAX, ANIMATE_STEP_MIN, ARRAY_3D_MODES, ARROW_TEXT_BACKCOLOR, ARROW_TEXT_FONTFACE, ARROW_TEXT_FORECOLOR, BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, DECIMAL_PLACES_2, DIFFERENT_VALUES_PATH_LENGTH, DISTANCE_EPSILON, EPSILON, MIDDLE_MOLDING_LOCATION, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM_3D, MODE_IDLE, MODE_IDLE_3D, MODE_ROTATING_ITEM_3D, OBJTYPE_MESH, SHADE_DARK_PURPLE_COLOR, TOP_MOLDING_LOCATION, UNIT_CENTIMETER, WALL_CABINET_LAYOUTPOS } from "../../constants";
|
|
12
|
+
import { ANIMATE_STEP_MAX, ANIMATE_STEP_MIN, ARRAY_3D_MODES, ARROW_TEXT_BACKCOLOR, ARROW_TEXT_FONTFACE, ARROW_TEXT_FORECOLOR, BASE_CABINET_LAYOUTPOS, BOTTOM_MOLDING_LOCATION, DECIMAL_PLACES_2, DIFFERENT_VALUES_PATH_LENGTH, DISTANCE_EPSILON, EPSILON, MIDDLE_MOLDING_LOCATION, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM_3D, MODE_IDLE, MODE_IDLE_3D, MODE_ROTATING_ITEM_3D, OBJTYPE_MESH, SHADE_DARK_PURPLE_COLOR, TOP_MOLDING_LOCATION, UNIT_CENTIMETER, UNIT_FOOT, UNIT_INCH, UNIT_METER, WALL_CABINET_LAYOUTPOS } from "../../constants";
|
|
13
13
|
import { GeometryUtils, IDBroker, MoldingUtils } from "../../utils/export";
|
|
14
14
|
import { convert } from "../../utils/convert-units-lite";
|
|
15
|
-
import { verticesDistance } from "../../utils/geometry";
|
|
15
|
+
import { calcDistancesFromItemToWalls, verticesDistance } from "../../utils/geometry";
|
|
16
16
|
import * as GeomUtils from "../../catalog/utils/geom-utils";
|
|
17
17
|
import { loadTexture } from "../../catalog/utils/item-loader";
|
|
18
18
|
import { returnReplaceableDeepSearchType } from "../viewer2d/utils";
|
|
19
|
-
import { animateDoor, isElevationView, isEmpty, replaceMeshesWithLineSegments, translateDrawer } from "../../utils/helper";
|
|
19
|
+
import { animateDoor, isElevationView, isEmpty, isImmutable, replaceMeshesWithLineSegments, translateDrawer } from "../../utils/helper";
|
|
20
20
|
import { formatNumber } from "../../utils/math";
|
|
21
21
|
var transformBox;
|
|
22
22
|
export var fVLine = [];
|
|
@@ -187,6 +187,31 @@ export function createWarningObject() {
|
|
|
187
187
|
warningObj.name = 'warningObj';
|
|
188
188
|
return warningObj;
|
|
189
189
|
}
|
|
190
|
+
function swapLengthProperty(diffs) {
|
|
191
|
+
var idx1 = diffs.findIndex(function (v) {
|
|
192
|
+
return v.path[v.path.length - 1] === 'length';
|
|
193
|
+
});
|
|
194
|
+
var idx2 = diffs.findIndex(function (v) {
|
|
195
|
+
return v.path[v.path.length - 1] === '_length';
|
|
196
|
+
});
|
|
197
|
+
if (idx1 < 0 || idx2 < 0) return diffs;
|
|
198
|
+
if (idx1 > idx2) return diffs;
|
|
199
|
+
if (diffs[idx1].op === diffs[idx2].op) {
|
|
200
|
+
var isSwap = true;
|
|
201
|
+
for (var i = 0; i < diffs[idx1].path.length - 2; i++) {
|
|
202
|
+
if (diffs[idx1].path[i] !== diffs[idx2].path[i]) {
|
|
203
|
+
isSwap = false;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (isSwap) {
|
|
208
|
+
var temp = diffs[idx1];
|
|
209
|
+
diffs[idx1] = diffs[idx2];
|
|
210
|
+
diffs[idx2] = temp;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return diffs;
|
|
214
|
+
}
|
|
190
215
|
export function updateScene(planData, sceneData, oldSceneData, diffArray, actions, catalog) {
|
|
191
216
|
var _draggingItem$toJS, _filteredDiffs, _filteredDiffs2;
|
|
192
217
|
var mode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
@@ -204,6 +229,9 @@ export function updateScene(planData, sceneData, oldSceneData, diffArray, action
|
|
|
204
229
|
value: el.value
|
|
205
230
|
};
|
|
206
231
|
});
|
|
232
|
+
|
|
233
|
+
// move "length" to after "_length"
|
|
234
|
+
splitted = swapLengthProperty(splitted);
|
|
207
235
|
var filteredDiffs = filterDiffs(splitted, sceneData, oldSceneData);
|
|
208
236
|
//***testing additional filter***
|
|
209
237
|
filteredDiffs = filteredDiffs.filter(function (_ref) {
|
|
@@ -238,7 +266,7 @@ export function updateScene(planData, sceneData, oldSceneData, diffArray, action
|
|
|
238
266
|
* Every 'doorStyle' change has a 'door_style_id' change.
|
|
239
267
|
* So, if door_style_id changes, it indicates 'doorStyle' change.
|
|
240
268
|
*/
|
|
241
|
-
if (['id'].includes(path[path.length - 1])) isSettingDoorStyle = true;
|
|
269
|
+
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;
|
|
242
270
|
|
|
243
271
|
// If there are any molding change of layer
|
|
244
272
|
if (path[1] === 'layers' && path[3] === 'molding') isUpdateMolding = true;
|
|
@@ -451,19 +479,19 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
451
479
|
if (modifiedPath[keyIndex] == 'rotation') {
|
|
452
480
|
item3D.rotation.set(0, value * Math.PI / 180 + Math.PI, 0);
|
|
453
481
|
setTimeout(function () {
|
|
454
|
-
getDistances(layer);
|
|
482
|
+
getDistances(layer, item);
|
|
455
483
|
}, 50);
|
|
456
484
|
removeSelItemMesh(tmpMoldings, item, planData, mode);
|
|
457
485
|
} else if (modifiedPath[keyIndex] == 'x') {
|
|
458
486
|
item3D.position.x = value;
|
|
459
487
|
setTimeout(function () {
|
|
460
|
-
getDistances(layer);
|
|
488
|
+
getDistances(layer, item);
|
|
461
489
|
}, 50);
|
|
462
490
|
removeSelItemMesh(tmpMoldings, item, planData, mode);
|
|
463
491
|
} else if (modifiedPath[keyIndex] == 'y') {
|
|
464
492
|
item3D.position.z = -value;
|
|
465
493
|
setTimeout(function () {
|
|
466
|
-
getDistances(layer);
|
|
494
|
+
getDistances(layer, item);
|
|
467
495
|
}, 50);
|
|
468
496
|
removeSelItemMesh(tmpMoldings, item, planData, mode);
|
|
469
497
|
} else if (modifiedPath[keyIndex] == 'selected') {
|
|
@@ -614,10 +642,10 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
614
642
|
vLine3.material.depthTest = false;
|
|
615
643
|
var uVec = new Three.Vector3(-posVec.x / scalevec.x, -posVec.y / scalevec.y, -posVec.z / scalevec.z);
|
|
616
644
|
var blLighting = item.type.includes('Light');
|
|
617
|
-
vLine.translateY(blLighting ? 1.6 : 0.1);
|
|
618
|
-
vLine1.translateY(blLighting ? 1.6 : 0.1);
|
|
619
|
-
vLine2.translateY(blLighting ? 1.6 : 0.1);
|
|
620
|
-
vLine3.translateY(blLighting ? 1.6 : 0.1);
|
|
645
|
+
vLine.translateY(blLighting ? 1.6 : boundingBox.min.y + 0.1);
|
|
646
|
+
vLine1.translateY(blLighting ? 1.6 : boundingBox.min.y + 0.1);
|
|
647
|
+
vLine2.translateY(blLighting ? 1.6 : boundingBox.min.y + 0.1);
|
|
648
|
+
vLine3.translateY(blLighting ? 1.6 : boundingBox.min.y + 0.1);
|
|
621
649
|
upObj.translateOnAxis(uVec, 1);
|
|
622
650
|
upObj.translateY(max.y - min.y);
|
|
623
651
|
_mBox.name = 'TransformBox';
|
|
@@ -689,7 +717,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
689
717
|
return actions.itemsActions.selectItem(layer.id, modifiedPath[4]);
|
|
690
718
|
});
|
|
691
719
|
setTimeout(function () {
|
|
692
|
-
getDistances(layer);
|
|
720
|
+
getDistances(layer, item);
|
|
693
721
|
}, 100);
|
|
694
722
|
}
|
|
695
723
|
} else if (modifiedPath[keyIndex] == 'length') {
|
|
@@ -817,7 +845,7 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
817
845
|
removeItemWithoutItem(planData, layer.id, modifiedPath[4]);
|
|
818
846
|
promises.push(addItem(sceneData, planData, layer, modifiedPath[4], catalog, actions.itemsActions, mode, null, rItem));
|
|
819
847
|
setTimeout(function () {
|
|
820
|
-
getDistances(layer);
|
|
848
|
+
getDistances(layer, item);
|
|
821
849
|
}, 100);
|
|
822
850
|
}
|
|
823
851
|
break;
|
|
@@ -863,11 +891,170 @@ function replaceObject(modifiedPath, layer, planData, actions, sceneData, oldSce
|
|
|
863
891
|
promise: p1
|
|
864
892
|
};
|
|
865
893
|
}
|
|
866
|
-
export function getDistances(layer, isCalcWall) {
|
|
894
|
+
export function getDistances(layer, curItem, isCalcWall) {
|
|
895
|
+
// matching fvLine distance with OP
|
|
896
|
+
var pointArray = calcDistancesFromItemToWalls(curItem, layer).PointArray;
|
|
897
|
+
if ((pointArray === null || pointArray === void 0 ? void 0 : pointArray.length) > 0) {
|
|
898
|
+
var _loop2 = function _loop2() {
|
|
899
|
+
var direction = i === 0 ? 90 : i === 1 ? -90 : i === 2 ? 180 : 0;
|
|
900
|
+
if (fVLine[i].userData) {
|
|
901
|
+
var _pointArray$filter$;
|
|
902
|
+
var opDist = (_pointArray$filter$ = pointArray.filter(function (v) {
|
|
903
|
+
return v[1] === direction;
|
|
904
|
+
})[0]) !== null && _pointArray$filter$ !== void 0 ? _pointArray$filter$ : fVLine[i].userData.distance;
|
|
905
|
+
fVLine[i].userData.opDist = opDist[0];
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
for (var i = 0; i < ((_fVLine = fVLine) === null || _fVLine === void 0 ? void 0 : _fVLine.length); i++) {
|
|
909
|
+
var _fVLine;
|
|
910
|
+
_loop2();
|
|
911
|
+
}
|
|
912
|
+
}
|
|
867
913
|
fVLine.forEach(function (line, index) {
|
|
868
|
-
|
|
914
|
+
getLineDistance2(line, layer, isEmpty(isCalcWall) ? false : isCalcWall, index);
|
|
869
915
|
});
|
|
870
916
|
}
|
|
917
|
+
function getLineDistance2(obj, layer, isCalcWall, index) {
|
|
918
|
+
var _obj$userData$opDist, _obj$userData, _obj$userData2, _obj$userData$opDist2, _obj$userData3, _obj$userData4;
|
|
919
|
+
if (obj === undefined) return;
|
|
920
|
+
var positionAttribute = obj.geometry.attributes.position;
|
|
921
|
+
if (positionAttribute === undefined) return;
|
|
922
|
+
var wPoint0 = new Three.Vector3().fromBufferAttribute(positionAttribute, 0).applyMatrix4(obj.matrixWorld);
|
|
923
|
+
var wPoint1 = new Three.Vector3().fromBufferAttribute(positionAttribute, 1).applyMatrix4(obj.matrixWorld);
|
|
924
|
+
var raycaster = new Three.Raycaster(wPoint0, new Three.Vector3(wPoint1.x - wPoint0.x, wPoint1.y - wPoint0.y, wPoint1.z - wPoint0.z));
|
|
925
|
+
var rayDirection = raycaster.ray.direction;
|
|
926
|
+
raycaster.camera = new Three.Camera();
|
|
927
|
+
rayDirection.normalize();
|
|
928
|
+
var meshes = [];
|
|
929
|
+
planData.plan.traverse(function (child) {
|
|
930
|
+
if (child.isMesh && child.geometry) {
|
|
931
|
+
meshes.push(child);
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
var dx = wPoint0.x - wPoint1.x;
|
|
935
|
+
var dy = wPoint0.y - wPoint1.y;
|
|
936
|
+
var dz = wPoint0.z - wPoint1.z;
|
|
937
|
+
var length = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
938
|
+
var scale = 1;
|
|
939
|
+
var extrudeSettings = {
|
|
940
|
+
steps: 2,
|
|
941
|
+
depth: 0.01,
|
|
942
|
+
bevelEnabled: false
|
|
943
|
+
};
|
|
944
|
+
var w = 0.2;
|
|
945
|
+
var h = w * (Math.sqrt(3) / 2);
|
|
946
|
+
var shape = new Three.Shape();
|
|
947
|
+
shape.moveTo(0, 0);
|
|
948
|
+
shape.lineTo(-w / 4, h / 2);
|
|
949
|
+
shape.lineTo(w / 4, h / 2);
|
|
950
|
+
var geom = new Three.ExtrudeGeometry(shape, extrudeSettings);
|
|
951
|
+
geom.center();
|
|
952
|
+
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;
|
|
953
|
+
scale = opDist / length;
|
|
954
|
+
if (opDist <= 0.1) {
|
|
955
|
+
scale = 0.1 / length;
|
|
956
|
+
}
|
|
957
|
+
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;
|
|
958
|
+
// obj.userData.target = intersects[i].object;
|
|
959
|
+
var originPoint = obj.geometry.attributes.position.array.slice(0, 3);
|
|
960
|
+
var lx = obj.geometry.attributes.position.array[3] - obj.geometry.attributes.position.array[0];
|
|
961
|
+
var ly = obj.geometry.attributes.position.array[4] - obj.geometry.attributes.position.array[1];
|
|
962
|
+
var lz = obj.geometry.attributes.position.array[5] - obj.geometry.attributes.position.array[2];
|
|
963
|
+
var newVec = new Three.Vector3(originPoint[0] + lx * scale, originPoint[1] + ly * scale, originPoint[2] + lz * scale);
|
|
964
|
+
obj.geometry.attributes.position.array[3] = newVec.x;
|
|
965
|
+
obj.geometry.attributes.position.array[4] = newVec.y;
|
|
966
|
+
obj.geometry.attributes.position.array[5] = newVec.z;
|
|
967
|
+
obj.geometry.attributes.position.needsUpdate = true;
|
|
968
|
+
obj.geometry.computeBoundingSphere();
|
|
969
|
+
obj.geometry.computeBoundingBox();
|
|
970
|
+
var dist = convert(opDist).from('cm').to('in');
|
|
971
|
+
if (dist > 3) {
|
|
972
|
+
var _canvas = getDistanceCanvas(dist, layer);
|
|
973
|
+
var wid = _canvas.width / window.innerWidth * 30;
|
|
974
|
+
var hei = _canvas.height / window.innerHeight * 30;
|
|
975
|
+
var texture = new Three.Texture(_canvas);
|
|
976
|
+
texture.minFilter = Three.LinearFilter;
|
|
977
|
+
texture.needsUpdate = true;
|
|
978
|
+
var geometry = new Three.PlaneGeometry(wid / 5, hei / 5);
|
|
979
|
+
geometry.computeBoundingBox();
|
|
980
|
+
var material = new Three.MeshBasicMaterial({
|
|
981
|
+
map: texture,
|
|
982
|
+
side: Three.DoubleSide
|
|
983
|
+
});
|
|
984
|
+
var textMesh = new Three.Mesh(geometry, material);
|
|
985
|
+
for (; obj.children.length != 0;) {
|
|
986
|
+
var temp = obj.children.pop();
|
|
987
|
+
disposeObject(temp);
|
|
988
|
+
}
|
|
989
|
+
textMesh.rotation.set(Math.PI / 2, Math.PI, 0);
|
|
990
|
+
// obj.add(textMesh);
|
|
991
|
+
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);
|
|
992
|
+
textMesh.name = 'lineText';
|
|
993
|
+
textMesh.renderOrder = 2;
|
|
994
|
+
textMesh.material.depthTest = false;
|
|
995
|
+
textMesh.material.transparent = true;
|
|
996
|
+
var sprite1 = new Three.Sprite(new Three.SpriteMaterial({
|
|
997
|
+
map: texture
|
|
998
|
+
}));
|
|
999
|
+
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);
|
|
1000
|
+
sprite1.name = 'lineText';
|
|
1001
|
+
sprite1.renderOrder = 2;
|
|
1002
|
+
sprite1.scale.set(0.2, 0.1, 0.2);
|
|
1003
|
+
sprite1.layers.set(1);
|
|
1004
|
+
sprite1.material.depthTest = false;
|
|
1005
|
+
obj.add(sprite1);
|
|
1006
|
+
if (obj.parent != null) {
|
|
1007
|
+
// is not lighting
|
|
1008
|
+
var item3D = obj.parent.parent.parent;
|
|
1009
|
+
var max = item3D.children[0].userData.max;
|
|
1010
|
+
var min = item3D.children[0].userData.min;
|
|
1011
|
+
var objW = (max.x - min.x) / 100,
|
|
1012
|
+
objL = (max.z - min.z) / 100;
|
|
1013
|
+
var triangle = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
1014
|
+
color: SHADE_DARK_PURPLE_COLOR
|
|
1015
|
+
}));
|
|
1016
|
+
var triangle1 = new Three.Mesh(geom, new Three.MeshBasicMaterial({
|
|
1017
|
+
color: SHADE_DARK_PURPLE_COLOR
|
|
1018
|
+
}));
|
|
1019
|
+
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)));
|
|
1020
|
+
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);
|
|
1021
|
+
if (index < 2) {
|
|
1022
|
+
triangle.rotation.x = Math.cos(index * Math.PI) * Math.PI / 2;
|
|
1023
|
+
triangle1.rotation.x = -Math.cos(index * Math.PI) * Math.PI / 2;
|
|
1024
|
+
} else {
|
|
1025
|
+
triangle.rotation.x = -Math.PI / 2;
|
|
1026
|
+
triangle.rotation.z = -(index === 2 ? 1 : -1) * Math.PI / 2;
|
|
1027
|
+
triangle1.rotation.x = Math.PI / 2;
|
|
1028
|
+
triangle1.rotation.z = (index === 2 ? 1 : -1) * Math.PI / 2;
|
|
1029
|
+
}
|
|
1030
|
+
triangle.name = 'lineText';
|
|
1031
|
+
triangle1.name = 'lineText';
|
|
1032
|
+
triangle.renderOrder = 2;
|
|
1033
|
+
triangle1.renderOrder = 2;
|
|
1034
|
+
triangle.material.transparent = true;
|
|
1035
|
+
triangle1.material.transparent = true;
|
|
1036
|
+
triangle.material.depthTest = false;
|
|
1037
|
+
triangle1.material.depthTest = false;
|
|
1038
|
+
obj.add(triangle);
|
|
1039
|
+
obj.add(triangle1);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// if (obj.userData.distance <= 50 && obj.userData.distance >= 0.5) {
|
|
1044
|
+
var real_target = obj.userData.target;
|
|
1045
|
+
for (; ((_real_target = real_target) === null || _real_target === void 0 ? void 0 : _real_target.name) != 'pivot';) {
|
|
1046
|
+
var _real_target, _real_target2, _real_target3;
|
|
1047
|
+
if (((_real_target2 = real_target) === null || _real_target2 === void 0 ? void 0 : _real_target2.parent) == null) break;
|
|
1048
|
+
real_target = (_real_target3 = real_target) === null || _real_target3 === void 0 ? void 0 : _real_target3.parent;
|
|
1049
|
+
}
|
|
1050
|
+
// let item3D = obj.parent.parent.parent;
|
|
1051
|
+
// let origin = obj.geometry.vertices[0].clone().applyMatrix4(obj.matrixWorld);
|
|
1052
|
+
// let target = obj.geometry.vertices[1].clone().applyMatrix4(obj.matrixWorld);
|
|
1053
|
+
// let uVec = new Three.Vector3(target.x - origin.x - 0.2, target.y - origin.y - 0.2, target.z - origin.z - 0.2);
|
|
1054
|
+
obj.visible = true;
|
|
1055
|
+
if (dist < 3) obj.visible = false;
|
|
1056
|
+
return obj;
|
|
1057
|
+
}
|
|
871
1058
|
function getLineDistance(obj, layer, isCalcWall, index) {
|
|
872
1059
|
if (obj === undefined) return;
|
|
873
1060
|
var positionAttribute = obj.geometry.attributes.position;
|
|
@@ -923,12 +1110,12 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
923
1110
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
924
1111
|
obj.geometry.computeBoundingSphere();
|
|
925
1112
|
obj.geometry.computeBoundingBox();
|
|
926
|
-
var dist =
|
|
1113
|
+
var dist = convert(intersects[i].distance).from('cm').to('in');
|
|
927
1114
|
if (dist > 3) {
|
|
928
|
-
var
|
|
929
|
-
var wid =
|
|
930
|
-
var hei =
|
|
931
|
-
var texture = new Three.Texture(
|
|
1115
|
+
var _canvas2 = getDistanceCanvas(dist, layer);
|
|
1116
|
+
var wid = _canvas2.width / window.innerWidth * 30;
|
|
1117
|
+
var hei = _canvas2.height / window.innerHeight * 30;
|
|
1118
|
+
var texture = new Three.Texture(_canvas2);
|
|
932
1119
|
texture.minFilter = Three.LinearFilter;
|
|
933
1120
|
texture.needsUpdate = true;
|
|
934
1121
|
var geometry = new Three.PlaneGeometry(wid / 5, hei / 5);
|
|
@@ -957,6 +1144,7 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
957
1144
|
sprite1.renderOrder = 2;
|
|
958
1145
|
sprite1.scale.set(0.2, 0.1, 0.2);
|
|
959
1146
|
sprite1.layers.set(1);
|
|
1147
|
+
sprite1.material.depthTest = false;
|
|
960
1148
|
obj.add(sprite1);
|
|
961
1149
|
if (obj.parent != null) {
|
|
962
1150
|
// is not lighting
|
|
@@ -1045,12 +1233,12 @@ function getLineDistance(obj, layer, isCalcWall, index) {
|
|
|
1045
1233
|
obj.geometry.attributes.position.array[4] = _newVec.y;
|
|
1046
1234
|
obj.geometry.attributes.position.array[5] = _newVec.z;
|
|
1047
1235
|
obj.geometry.attributes.position.needsUpdate = true;
|
|
1048
|
-
var _dist = formatNumber(distance, DECIMAL_PLACES_2);
|
|
1236
|
+
var _dist = convert(formatNumber(distance, DECIMAL_PLACES_2)).from('cm').to('in');
|
|
1049
1237
|
if (_dist > 3) {
|
|
1050
|
-
var
|
|
1051
|
-
var _wid =
|
|
1052
|
-
var _hei =
|
|
1053
|
-
var _texture = new Three.Texture(
|
|
1238
|
+
var _canvas3 = getDistanceCanvas(_dist, layer);
|
|
1239
|
+
var _wid = _canvas3.width / window.innerWidth * 30;
|
|
1240
|
+
var _hei = _canvas3.height / window.innerHeight * 30;
|
|
1241
|
+
var _texture = new Three.Texture(_canvas3);
|
|
1054
1242
|
_texture.needsUpdate = true;
|
|
1055
1243
|
var _geometry = new Three.PlaneGeometry(_wid / 2, _hei / 2);
|
|
1056
1244
|
_geometry.computeBoundingBox();
|
|
@@ -1175,12 +1363,18 @@ export function getIntersectPoint(opX, opY, pX, pY) {
|
|
|
1175
1363
|
function gcd(a, b) {
|
|
1176
1364
|
return a % b ? gcd(b, a % b) : b;
|
|
1177
1365
|
}
|
|
1178
|
-
function
|
|
1179
|
-
var
|
|
1366
|
+
function getDistanceCanvas(distance, layer) {
|
|
1367
|
+
var _layer$unit;
|
|
1368
|
+
var parameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1180
1369
|
var canvas = document.createElement('canvas');
|
|
1181
1370
|
var ctx = canvas.getContext('2d');
|
|
1371
|
+
var curUnit = (_layer$unit = layer === null || layer === void 0 ? void 0 : layer.unit) !== null && _layer$unit !== void 0 ? _layer$unit : UNIT_INCH;
|
|
1372
|
+
var fixedLength = (layer === null || layer === void 0 ? void 0 : layer.unit) === UNIT_METER || (layer === null || layer === void 0 ? void 0 : layer.unit) === UNIT_FOOT ? 2 : 0;
|
|
1373
|
+
var distText = String((Math.round(convert(distance).from('in').to(curUnit) * 100) / 100).toFixed(fixedLength));
|
|
1182
1374
|
var fontSize = 16;
|
|
1183
|
-
var integral =
|
|
1375
|
+
var integral = distText + curUnit;
|
|
1376
|
+
// let integral = String(distance) + "''";
|
|
1377
|
+
|
|
1184
1378
|
parameters.fontName = parameters.fontName || ARROW_TEXT_FONTFACE;
|
|
1185
1379
|
|
|
1186
1380
|
// Prepare the font to be able to measure
|
|
@@ -1774,7 +1968,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1774
1968
|
layer.lines.forEach(function (data) {
|
|
1775
1969
|
lines.push(data);
|
|
1776
1970
|
});
|
|
1777
|
-
var
|
|
1971
|
+
var _loop3 = function _loop3() {
|
|
1778
1972
|
var data = lines[i];
|
|
1779
1973
|
var realVec = [];
|
|
1780
1974
|
data.vertices.forEach(function (vec) {
|
|
@@ -1787,7 +1981,7 @@ function addArea(sceneData, planData, layer, areaID, catalog, areaActions, mode)
|
|
|
1787
1981
|
}
|
|
1788
1982
|
};
|
|
1789
1983
|
for (var i = 0; i < lines.length; i++) {
|
|
1790
|
-
if (
|
|
1984
|
+
if (_loop3()) break;
|
|
1791
1985
|
}
|
|
1792
1986
|
ceil.translateZ(convert(layer.ceilHeight).from(layer.unit).to(UNIT_CENTIMETER));
|
|
1793
1987
|
pivot.name = 'pivot';
|
|
@@ -1842,6 +2036,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1842
2036
|
if (!catalogElement) catalogElement = catalog.getElement(returnReplaceableDeepSearchType(item.type));
|
|
1843
2037
|
if (!catalogElement) return false;
|
|
1844
2038
|
return catalogElement.render3D(item, layer, sceneData, mode).then(function (item3D) {
|
|
2039
|
+
var _item$properties$getI, _item$properties$getI2, _item$properties$getI3;
|
|
1845
2040
|
if (item3D instanceof Three.LOD) {
|
|
1846
2041
|
planData.sceneGraph.LODs[itemID] = item3D;
|
|
1847
2042
|
}
|
|
@@ -1898,7 +2093,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1898
2093
|
if (child.type === 'Line' && child.geometry.attributes !== undefined) fVLine.push(child);
|
|
1899
2094
|
});
|
|
1900
2095
|
setTimeout(function () {
|
|
1901
|
-
getDistances();
|
|
2096
|
+
getDistances(layer, item);
|
|
1902
2097
|
}, 50);
|
|
1903
2098
|
}
|
|
1904
2099
|
applyOpacity(pivot, opacity);
|
|
@@ -1957,9 +2152,9 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
1957
2152
|
var catid = item.type;
|
|
1958
2153
|
var cat = catalog.elements[catid];
|
|
1959
2154
|
if (!cat) cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
|
|
1960
|
-
var width = convert(item.properties.getIn(['width', '_length'])).from('in').to(sceneData.unit);
|
|
1961
|
-
var height = convert(item.properties.getIn(['height', '_length'])).from('in').to(sceneData.unit);
|
|
1962
|
-
var depth = convert(item.properties.getIn(['depth', '_length'])).from('in').to(sceneData.unit);
|
|
2155
|
+
var width = 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);
|
|
2156
|
+
var height = 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);
|
|
2157
|
+
var depth = 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);
|
|
1963
2158
|
val.size = {
|
|
1964
2159
|
width: width,
|
|
1965
2160
|
height: height,
|
|
@@ -2013,7 +2208,7 @@ function addItem(sceneData, planData, layer, itemID, catalog, itemsActions) {
|
|
|
2013
2208
|
return itemsActions.selectItem(layer.id, item.id);
|
|
2014
2209
|
});
|
|
2015
2210
|
setTimeout(function () {
|
|
2016
|
-
return getDistances(layer);
|
|
2211
|
+
return getDistances(layer, item);
|
|
2017
2212
|
}, 100);
|
|
2018
2213
|
if (!sceneData.loadFlag && scene_mode == MODE_DRAWING_ITEM_3D) {
|
|
2019
2214
|
itemsActions.endLoading();
|
|
@@ -3030,23 +3225,18 @@ function _addMGMesh(molding, planData, layer, data, svg_width, svg_height, flag)
|
|
|
3030
3225
|
// let layoutType = molding.items[0].layoutpos;
|
|
3031
3226
|
// let visible = molding.items[0];
|
|
3032
3227
|
molding.pointGroups.forEach(function (pointGroup) {
|
|
3228
|
+
var _child$width_unit, _child$height_unit, _child$length_unit;
|
|
3033
3229
|
var geometry = new Three.BufferGeometry();
|
|
3034
3230
|
var length = data.length; //point array
|
|
3035
|
-
var
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
}
|
|
3045
|
-
temp_unit = child.length_unit;
|
|
3046
|
-
if (temp_unit === 'inch') {
|
|
3047
|
-
child.length = convert(child.length).from('in').to('cm');
|
|
3048
|
-
child.length_unit = 'cm';
|
|
3049
|
-
}
|
|
3231
|
+
var widthUnit = child.width_unit === 'inch' ? 'in' : (_child$width_unit = child.width_unit) !== null && _child$width_unit !== void 0 ? _child$width_unit : 'in';
|
|
3232
|
+
var heightUnit = child.height_unit === 'inch' ? 'in' : (_child$height_unit = child.height_unit) !== null && _child$height_unit !== void 0 ? _child$height_unit : 'in';
|
|
3233
|
+
var lengthUnit = child.length_unit === 'inch' ? 'in' : (_child$length_unit = child.length_unit) !== null && _child$length_unit !== void 0 ? _child$length_unit : 'in';
|
|
3234
|
+
child.height = convert(child.height).from(heightUnit).to('cm');
|
|
3235
|
+
child.height_unit = 'cm';
|
|
3236
|
+
child.width = convert(child.width).from(widthUnit).to('cm');
|
|
3237
|
+
child.width_unit = 'cm';
|
|
3238
|
+
child.length = convert(child.length).from(lengthUnit).to('cm');
|
|
3239
|
+
child.length_unit = 'cm';
|
|
3050
3240
|
geometry.needsUpdate = true;
|
|
3051
3241
|
geometry = moldingVertices(pointGroup, geometry, data, child, svg_width, svg_height, molding.pointGroups.length);
|
|
3052
3242
|
var total = geometry.attributes.position.count;
|
|
@@ -3356,7 +3546,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3356
3546
|
if (isEmpty(filteredNewMGList)) {
|
|
3357
3547
|
return true;
|
|
3358
3548
|
}
|
|
3359
|
-
var
|
|
3549
|
+
var _loop4 = function _loop4() {
|
|
3360
3550
|
var newMG = filteredNewMGList[k];
|
|
3361
3551
|
if (oldMG.items.some(function (it) {
|
|
3362
3552
|
return it.id === selItem.id;
|
|
@@ -3409,7 +3599,7 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3409
3599
|
},
|
|
3410
3600
|
_ret;
|
|
3411
3601
|
for (var k = 0; k < filteredNewMGList.length; k++) {
|
|
3412
|
-
_ret =
|
|
3602
|
+
_ret = _loop4();
|
|
3413
3603
|
if (_ret) return _ret.v;
|
|
3414
3604
|
}
|
|
3415
3605
|
return true;
|
|
@@ -3417,14 +3607,21 @@ export function updateMoldingGroupArray(MGArray, selItem, planData, layer) {
|
|
|
3417
3607
|
if (changeMoldings.length === 0 && isEnableMolding) {
|
|
3418
3608
|
// refresh mesh of the updating molding groups
|
|
3419
3609
|
new_MGArray.forEach(function (mg, index) {
|
|
3420
|
-
|
|
3421
|
-
|
|
3610
|
+
var _mg$items$;
|
|
3611
|
+
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) {
|
|
3612
|
+
var _mol$toJS;
|
|
3613
|
+
return 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;
|
|
3422
3614
|
})) {
|
|
3423
|
-
var
|
|
3424
|
-
|
|
3615
|
+
var _mg$items$2, _mg$items$3, _mg$items$4;
|
|
3616
|
+
var molding = 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) {
|
|
3617
|
+
var _mol$toJS2;
|
|
3618
|
+
return (mol === null || mol === void 0 || (_mol$toJS2 = mol.toJS()) === null || _mol$toJS2 === void 0 ? void 0 : _mol$toJS2.location_type) === mg.location_type;
|
|
3619
|
+
}).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) {
|
|
3620
|
+
return (mol === null || mol === void 0 ? void 0 : mol.location_type) === mg.location_type;
|
|
3425
3621
|
})[0];
|
|
3426
3622
|
if (mg.molding === null || mg.molding.itemID !== mol.itemID || mg.lines === null || mg.points === null) {
|
|
3427
|
-
|
|
3623
|
+
var _mg$molding;
|
|
3624
|
+
if (mg.molding !== null && ((_mg$molding = mg.molding) === null || _mg$molding === void 0 ? void 0 : _mg$molding.itemID) !== molding.itemID) {
|
|
3428
3625
|
deleteMGMesh(mg, planData, mode);
|
|
3429
3626
|
}
|
|
3430
3627
|
mg = MoldingUtils.createMonldingGroup(mg, layer, molding, planData.catalog);
|
|
@@ -3571,7 +3768,7 @@ export function addWarningBox(itemId, altitude, planData) {
|
|
|
3571
3768
|
deleteSpecifiedMeshObjects('WarningBox' + itemId);
|
|
3572
3769
|
var item3D = planData.sceneGraph.layers[planData.sceneData.selectedLayer].items[itemId];
|
|
3573
3770
|
if (item3D == undefined) return;
|
|
3574
|
-
var altitudeLength =
|
|
3771
|
+
var altitudeLength = altitude;
|
|
3575
3772
|
var sBounding = item3D.children[0].userData;
|
|
3576
3773
|
var width = sBounding.max.x - sBounding.min.x;
|
|
3577
3774
|
var height = sBounding.max.y - sBounding.min.y;
|
|
@@ -254,12 +254,10 @@ var Viewer3DFirstPerson = /*#__PURE__*/function (_React$Component) {
|
|
|
254
254
|
this.renderer.renderLists.dispose();
|
|
255
255
|
}
|
|
256
256
|
}, {
|
|
257
|
-
key: "
|
|
258
|
-
value: function
|
|
259
|
-
var
|
|
260
|
-
|
|
261
|
-
height = _this$props.height,
|
|
262
|
-
state = _this$props.state;
|
|
257
|
+
key: "componentWillReceiveProps",
|
|
258
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
259
|
+
var width = nextProps.width,
|
|
260
|
+
height = nextProps.height;
|
|
263
261
|
var camera = this.camera,
|
|
264
262
|
renderer = this.renderer,
|
|
265
263
|
scene3D = this.scene3D,
|
|
@@ -272,27 +270,19 @@ var Viewer3DFirstPerson = /*#__PURE__*/function (_React$Component) {
|
|
|
272
270
|
linesActions: this.context.linesActions,
|
|
273
271
|
projectActions: this.context.projectActions
|
|
274
272
|
};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
renderer.setSize(width, height);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// Handle scene changes
|
|
286
|
-
if (state.scene !== prevProps.state.scene) {
|
|
287
|
-
var changedValues = diff(prevProps.state.scene, state.scene);
|
|
288
|
-
updateScene(planData, state.scene, prevProps.state.scene, changedValues.toJS(), actions, this.context.catalog);
|
|
273
|
+
this.width = width;
|
|
274
|
+
this.height = height;
|
|
275
|
+
camera.aspect = width / height;
|
|
276
|
+
camera.updateProjectionMatrix();
|
|
277
|
+
if (nextProps.scene !== this.props.state.scene) {
|
|
278
|
+
var changedValues = diff(this.props.state.scene, nextProps.state.scene);
|
|
279
|
+
updateScene(planData, nextProps.state.scene, this.props.state.scene, changedValues.toJS(), actions, this.context.catalog);
|
|
289
280
|
}
|
|
290
|
-
|
|
291
|
-
//
|
|
292
|
-
renderer.
|
|
293
|
-
renderer.
|
|
294
|
-
renderer.
|
|
295
|
-
renderer.render(sceneOnTop, camera);
|
|
281
|
+
renderer.setSize(width, height);
|
|
282
|
+
renderer.clear(); // clear buffers
|
|
283
|
+
renderer.render(scene3D, camera); // render scene 1
|
|
284
|
+
renderer.clearDepth(); // clear depth buffer
|
|
285
|
+
renderer.render(sceneOnTop, camera); // render scene 2
|
|
296
286
|
}
|
|
297
287
|
}, {
|
|
298
288
|
key: "render",
|
|
@@ -308,4 +298,12 @@ Viewer3DFirstPerson.propTypes = {
|
|
|
308
298
|
state: PropTypes.object.isRequired,
|
|
309
299
|
width: PropTypes.number.isRequired,
|
|
310
300
|
height: PropTypes.number.isRequired
|
|
301
|
+
};
|
|
302
|
+
Viewer3DFirstPerson.contextTypes = {
|
|
303
|
+
areaActions: PropTypes.object.isRequired,
|
|
304
|
+
holesActions: PropTypes.object.isRequired,
|
|
305
|
+
itemsActions: PropTypes.object.isRequired,
|
|
306
|
+
linesActions: PropTypes.object.isRequired,
|
|
307
|
+
projectActions: PropTypes.object.isRequired,
|
|
308
|
+
catalog: PropTypes.object
|
|
311
309
|
};
|