kitchen-simulator 4.0.3-react-18 → 4.0.4-react-18
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/es/LiteKitchenConfigurator.js +17 -16
- package/es/components/style/form-number-input.js +5 -18
- package/es/components/viewer2d/scene.js +11 -13
- package/es/components/viewer2d/viewer2d.js +3 -0
- package/es/components/viewer3d/viewer3d-first-person.js +26 -16
- package/es/components/viewer3d/viewer3d.js +24 -20
- package/lib/LiteKitchenConfigurator.js +17 -16
- package/lib/components/style/form-number-input.js +5 -18
- package/lib/components/viewer2d/scene.js +11 -13
- package/lib/components/viewer2d/viewer2d.js +3 -0
- package/lib/components/viewer3d/viewer3d-first-person.js +26 -16
- package/lib/components/viewer3d/viewer3d.js +24 -20
- package/package.json +1 -1
|
@@ -306,18 +306,19 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
306
306
|
window.forRedo = [];
|
|
307
307
|
}
|
|
308
308
|
}, {
|
|
309
|
-
key: "
|
|
310
|
-
value: function
|
|
311
|
-
var
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
309
|
+
key: "componentDidUpdate",
|
|
310
|
+
value: function componentDidUpdate(prevProps) {
|
|
311
|
+
var _this$props = this.props,
|
|
312
|
+
stateExtractor = _this$props.stateExtractor,
|
|
313
|
+
state = _this$props.state,
|
|
314
|
+
projectActions = _this$props.projectActions,
|
|
315
|
+
catalog = _this$props.catalog,
|
|
316
|
+
externalEvent = _this$props.externalEvent,
|
|
317
|
+
onInternalEvent = _this$props.onInternalEvent;
|
|
317
318
|
|
|
318
319
|
// handle external events
|
|
319
|
-
if (
|
|
320
|
-
handleExternalEvent(
|
|
320
|
+
if (prevProps.externalEvent !== externalEvent) {
|
|
321
|
+
handleExternalEvent(this.props);
|
|
321
322
|
}
|
|
322
323
|
var plannerState = stateExtractor(state);
|
|
323
324
|
var catalogReady = plannerState.getIn(['catalog', 'ready']);
|
|
@@ -337,12 +338,12 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
337
338
|
key: "render",
|
|
338
339
|
value: function render() {
|
|
339
340
|
var _this2 = this;
|
|
340
|
-
var _this$
|
|
341
|
-
width = _this$
|
|
342
|
-
height = _this$
|
|
343
|
-
state = _this$
|
|
344
|
-
stateExtractor = _this$
|
|
345
|
-
props = _objectWithoutProperties(_this$
|
|
341
|
+
var _this$props2 = this.props,
|
|
342
|
+
width = _this$props2.width,
|
|
343
|
+
height = _this$props2.height,
|
|
344
|
+
state = _this$props2.state,
|
|
345
|
+
stateExtractor = _this$props2.stateExtractor,
|
|
346
|
+
props = _objectWithoutProperties(_this$props2, _excluded);
|
|
346
347
|
var actionsFromProps = objectsMap(actions, function (ns) {
|
|
347
348
|
return _this2.props[ns];
|
|
348
349
|
});
|
|
@@ -29,26 +29,14 @@ var FormNumberInput = /*#__PURE__*/function (_Component) {
|
|
|
29
29
|
}
|
|
30
30
|
_inherits(FormNumberInput, _Component);
|
|
31
31
|
return _createClass(FormNumberInput, [{
|
|
32
|
-
key: "
|
|
33
|
-
value: function
|
|
34
|
-
if (this.
|
|
35
|
-
this.input.current.focus();
|
|
36
|
-
this.input.current.select();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}, {
|
|
40
|
-
key: "componentWillReceiveProps",
|
|
41
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
42
|
-
if (this.props.value !== nextProps.value || this.props.focus !== nextProps.focus) {
|
|
32
|
+
key: "componentDidUpdate",
|
|
33
|
+
value: function componentDidUpdate(prevProps) {
|
|
34
|
+
if (this.props.value !== prevProps.value || this.props.focus !== prevProps.focus) {
|
|
43
35
|
this.setState({
|
|
44
|
-
showedValue:
|
|
45
|
-
focusOn:
|
|
36
|
+
showedValue: this.props.value,
|
|
37
|
+
focusOn: this.props.focus
|
|
46
38
|
});
|
|
47
39
|
}
|
|
48
|
-
}
|
|
49
|
-
}, {
|
|
50
|
-
key: "componentDidUpdate",
|
|
51
|
-
value: function componentDidUpdate(prevProps, preprevState) {
|
|
52
40
|
if (this.props.value !== prevProps.value && prevProps.labelName !== 'Ceiling Height') {
|
|
53
41
|
this.input.current.focus();
|
|
54
42
|
this.input.current.select();
|
|
@@ -69,7 +57,6 @@ var FormNumberInput = /*#__PURE__*/function (_Component) {
|
|
|
69
57
|
});
|
|
70
58
|
}
|
|
71
59
|
}
|
|
72
|
-
return null;
|
|
73
60
|
}
|
|
74
61
|
}, {
|
|
75
62
|
key: "render",
|
|
@@ -19,16 +19,15 @@ var Scene = /*#__PURE__*/function (_Component) {
|
|
|
19
19
|
}
|
|
20
20
|
_inherits(Scene, _Component);
|
|
21
21
|
return _createClass(Scene, [{
|
|
22
|
-
key: "
|
|
22
|
+
key: "componentDidUpdate",
|
|
23
23
|
value: function () {
|
|
24
|
-
var
|
|
25
|
-
var scene, catalog, height, layers, selectedLayer, msg, isNotFoundInElements, itemType;
|
|
24
|
+
var _componentDidUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(prevProps) {
|
|
25
|
+
var _this$props, scene, catalog, height, layers, selectedLayer, msg, isNotFoundInElements, itemType;
|
|
26
26
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
27
27
|
while (1) switch (_context.prev = _context.next) {
|
|
28
28
|
case 0:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
scene = nextProps.scene, catalog = nextProps.catalog;
|
|
29
|
+
if (this.props.scene.hashCode() !== prevProps.scene.hashCode()) {
|
|
30
|
+
_this$props = this.props, scene = _this$props.scene, catalog = _this$props.catalog;
|
|
32
31
|
height = scene.height, layers = scene.layers;
|
|
33
32
|
selectedLayer = layers.get(scene.selectedLayer);
|
|
34
33
|
msg = '';
|
|
@@ -60,10 +59,10 @@ var Scene = /*#__PURE__*/function (_Component) {
|
|
|
60
59
|
}
|
|
61
60
|
}, _callee, this);
|
|
62
61
|
}));
|
|
63
|
-
function
|
|
64
|
-
return
|
|
62
|
+
function componentDidUpdate(_x) {
|
|
63
|
+
return _componentDidUpdate.apply(this, arguments);
|
|
65
64
|
}
|
|
66
|
-
return
|
|
65
|
+
return componentDidUpdate;
|
|
67
66
|
}()
|
|
68
67
|
}, {
|
|
69
68
|
key: "shouldComponentUpdate",
|
|
@@ -74,10 +73,9 @@ var Scene = /*#__PURE__*/function (_Component) {
|
|
|
74
73
|
key: "render",
|
|
75
74
|
value: function render() {
|
|
76
75
|
var _this = this;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
catalog = _this$props.catalog;
|
|
76
|
+
var _this$props2 = this.props,
|
|
77
|
+
scene = _this$props2.scene,
|
|
78
|
+
catalog = _this$props2.catalog;
|
|
81
79
|
var height = scene.height,
|
|
82
80
|
layers = scene.layers;
|
|
83
81
|
var selectedLayer = layers.get(scene.selectedLayer);
|
|
@@ -1451,6 +1451,9 @@ export default function Viewer2D(_ref) {
|
|
|
1451
1451
|
detectPinchGesture: false,
|
|
1452
1452
|
disableDoubleClickZoomWithToolAuto: true,
|
|
1453
1453
|
ref: Viewer,
|
|
1454
|
+
miniatureProps: {
|
|
1455
|
+
position: POSITION_NONE
|
|
1456
|
+
},
|
|
1454
1457
|
toolbarProps: {
|
|
1455
1458
|
position: POSITION_NONE
|
|
1456
1459
|
}
|
|
@@ -254,10 +254,12 @@ var Viewer3DFirstPerson = /*#__PURE__*/function (_React$Component) {
|
|
|
254
254
|
this.renderer.renderLists.dispose();
|
|
255
255
|
}
|
|
256
256
|
}, {
|
|
257
|
-
key: "
|
|
258
|
-
value: function
|
|
259
|
-
var
|
|
260
|
-
|
|
257
|
+
key: "componentDidUpdate",
|
|
258
|
+
value: function componentDidUpdate(prevProps) {
|
|
259
|
+
var _this$props = this.props,
|
|
260
|
+
width = _this$props.width,
|
|
261
|
+
height = _this$props.height,
|
|
262
|
+
state = _this$props.state;
|
|
261
263
|
var camera = this.camera,
|
|
262
264
|
renderer = this.renderer,
|
|
263
265
|
scene3D = this.scene3D,
|
|
@@ -270,19 +272,27 @@ var Viewer3DFirstPerson = /*#__PURE__*/function (_React$Component) {
|
|
|
270
272
|
linesActions: this.context.linesActions,
|
|
271
273
|
projectActions: this.context.projectActions
|
|
272
274
|
};
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
275
|
+
|
|
276
|
+
// Handle width/height changes
|
|
277
|
+
if (width !== prevProps.width || height !== prevProps.height) {
|
|
278
|
+
this.width = width;
|
|
279
|
+
this.height = height;
|
|
280
|
+
camera.aspect = width / height;
|
|
281
|
+
camera.updateProjectionMatrix();
|
|
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);
|
|
280
289
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
renderer.
|
|
284
|
-
renderer.
|
|
285
|
-
renderer.
|
|
290
|
+
|
|
291
|
+
// Always re-render after updates
|
|
292
|
+
renderer.clear();
|
|
293
|
+
renderer.render(scene3D, camera);
|
|
294
|
+
renderer.clearDepth();
|
|
295
|
+
renderer.render(sceneOnTop, camera);
|
|
286
296
|
}
|
|
287
297
|
}, {
|
|
288
298
|
key: "render",
|
|
@@ -2445,14 +2445,18 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2445
2445
|
this.renderer.renderLists.dispose();
|
|
2446
2446
|
}
|
|
2447
2447
|
}, {
|
|
2448
|
-
key: "
|
|
2449
|
-
value: function
|
|
2448
|
+
key: "componentDidUpdate",
|
|
2449
|
+
value: function componentDidUpdate(prevProps) {
|
|
2450
2450
|
var _this4 = this;
|
|
2451
|
-
if
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
var
|
|
2451
|
+
// Early return if downloadFlag and state are unchanged or scene is empty
|
|
2452
|
+
if (this.props.downloadFlag && diff(prevProps.state, this.props.state).toJS().length == 0 || isEmpty(this.props.state.scene)) {
|
|
2453
|
+
return;
|
|
2454
|
+
}
|
|
2455
|
+
var _this$props = this.props,
|
|
2456
|
+
width = _this$props.width,
|
|
2457
|
+
height = _this$props.height;
|
|
2458
|
+
var selectedLayer = this.props.state.getIn(['scene', 'layers', this.props.state.scene.selectedLayer]);
|
|
2459
|
+
var ceilHeight = convert(selectedLayer.ceilHeight).from(selectedLayer.unit).to(this.props.state.scene.unit);
|
|
2456
2460
|
var actions = {
|
|
2457
2461
|
areaActions: this.context.areaActions,
|
|
2458
2462
|
holesActions: this.context.holesActions,
|
|
@@ -2462,7 +2466,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2462
2466
|
projectActions: this.context.projectActions,
|
|
2463
2467
|
catalog: this.context.catalog
|
|
2464
2468
|
};
|
|
2465
|
-
var isLoadingCabinet =
|
|
2469
|
+
var isLoadingCabinet = this.props.state.scene.isLoadingCabinet;
|
|
2466
2470
|
if (this.state.isLoadingCabinet !== isLoadingCabinet) this.setState({
|
|
2467
2471
|
isLoadingCabinet: isLoadingCabinet
|
|
2468
2472
|
});
|
|
@@ -2473,7 +2477,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2473
2477
|
var allItemRect;
|
|
2474
2478
|
|
|
2475
2479
|
// handle camera setting
|
|
2476
|
-
switch (
|
|
2480
|
+
switch (prevProps.state.mode) {
|
|
2477
2481
|
case MODE_ELEVATION_VIEW:
|
|
2478
2482
|
// when Elevation mode (camera: Orthographic)
|
|
2479
2483
|
var cameraRect = handleCamRect(width, height, ceilHeight, this.state.lineLength);
|
|
@@ -2491,12 +2495,12 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2491
2495
|
break;
|
|
2492
2496
|
}
|
|
2493
2497
|
this.camera.updateProjectionMatrix();
|
|
2494
|
-
var data =
|
|
2498
|
+
var data = this.props.state.scene;
|
|
2495
2499
|
var layer = data.getIn(['layers', data.selectedLayer]);
|
|
2496
2500
|
var self = this;
|
|
2497
2501
|
function implementBacksplash() {
|
|
2498
|
-
if (isElevationView(self.props.state.mode)) return;
|
|
2499
|
-
var allItems = GeometryUtils.getAllItemSpecified(
|
|
2502
|
+
if (isElevationView(self.props.state.mode)) return;
|
|
2503
|
+
var allItems = GeometryUtils.getAllItemSpecified(self.props.state.scene, actions.catalog, BASE_CABINET_LAYOUTPOS);
|
|
2500
2504
|
var i,
|
|
2501
2505
|
items = [];
|
|
2502
2506
|
for (i = 0; i < allItems.others.length; i++) items.push(allItems.others[i]);
|
|
@@ -2505,7 +2509,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2505
2509
|
var calcRect = GeometryUtils.getCalcRectFromItem3D(items[i]);
|
|
2506
2510
|
var visible = GeometryUtils.isSnappedLine(calcRect, allLineRects);
|
|
2507
2511
|
actions.itemsActions.setBacksplashVisible(items[i].itemInfo.id, visible);
|
|
2508
|
-
createBacksplash(items[i],
|
|
2512
|
+
createBacksplash(items[i], self.props.state.scene.getIn(['layers', self.props.state.scene.selectedLayer]), planData, self.props.state.scene);
|
|
2509
2513
|
}
|
|
2510
2514
|
}
|
|
2511
2515
|
function implementWarningBox() {
|
|
@@ -2533,10 +2537,10 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2533
2537
|
showflag: false
|
|
2534
2538
|
});
|
|
2535
2539
|
}
|
|
2536
|
-
if (
|
|
2537
|
-
var changedValues = diff(
|
|
2540
|
+
if (this.props.state.scene !== prevProps.state.scene || this.props.state.doorStyle && this.props.state.doorStyle.get('name') !== prevProps.state.doorStyle.get('name')) {
|
|
2541
|
+
var changedValues = diff(prevProps.state.scene, this.props.state.scene);
|
|
2538
2542
|
prepareSnapSpec(layer);
|
|
2539
|
-
if (
|
|
2543
|
+
if (this.props.state.doorStyle && this.props.state.doorStyle.get('name') === prevProps.state.doorStyle.get('name')) {
|
|
2540
2544
|
self.setState({
|
|
2541
2545
|
isLoading: true
|
|
2542
2546
|
});
|
|
@@ -2555,7 +2559,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2555
2559
|
}
|
|
2556
2560
|
self.renderer.domElement.style.display = 'none';
|
|
2557
2561
|
}
|
|
2558
|
-
if (
|
|
2562
|
+
if (this.props.state.scene.showfg == true) {
|
|
2559
2563
|
implementBacksplash();
|
|
2560
2564
|
implementWarningBox();
|
|
2561
2565
|
} else {
|
|
@@ -2564,7 +2568,7 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2564
2568
|
var _this$state = this.state,
|
|
2565
2569
|
toolObj = _this$state.toolObj,
|
|
2566
2570
|
angleObj = _this$state.angleObj;
|
|
2567
|
-
var _updateScene = updateScene(this.planData,
|
|
2571
|
+
var _updateScene = updateScene(this.planData, this.props.state.scene, prevProps.state.scene, changedValues.toJS(), actions, this.context.catalog, this.props.state.mode, toolObj, angleObj, this.props.state.draggingSupport),
|
|
2568
2572
|
promise = _updateScene.promise;
|
|
2569
2573
|
self.setState();
|
|
2570
2574
|
promise.then(function (p1Value) {
|
|
@@ -2576,8 +2580,8 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2576
2580
|
});
|
|
2577
2581
|
self.renderer.domElement.style.display = 'block';
|
|
2578
2582
|
});
|
|
2579
|
-
if (
|
|
2580
|
-
|
|
2583
|
+
if (this.props.state.getIn(['scene', 'isEndDragging'])) {
|
|
2584
|
+
this.props.state.setIn(['scene', 'isEndDragging'], false);
|
|
2581
2585
|
}
|
|
2582
2586
|
}
|
|
2583
2587
|
this.renderer.setSize(width, height);
|
|
@@ -315,18 +315,19 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
315
315
|
window.forRedo = [];
|
|
316
316
|
}
|
|
317
317
|
}, {
|
|
318
|
-
key: "
|
|
319
|
-
value: function
|
|
320
|
-
var
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
318
|
+
key: "componentDidUpdate",
|
|
319
|
+
value: function componentDidUpdate(prevProps) {
|
|
320
|
+
var _this$props = this.props,
|
|
321
|
+
stateExtractor = _this$props.stateExtractor,
|
|
322
|
+
state = _this$props.state,
|
|
323
|
+
projectActions = _this$props.projectActions,
|
|
324
|
+
catalog = _this$props.catalog,
|
|
325
|
+
externalEvent = _this$props.externalEvent,
|
|
326
|
+
onInternalEvent = _this$props.onInternalEvent;
|
|
326
327
|
|
|
327
328
|
// handle external events
|
|
328
|
-
if (
|
|
329
|
-
(0, _isolateEventHandler.handleExternalEvent)(
|
|
329
|
+
if (prevProps.externalEvent !== externalEvent) {
|
|
330
|
+
(0, _isolateEventHandler.handleExternalEvent)(this.props);
|
|
330
331
|
}
|
|
331
332
|
var plannerState = stateExtractor(state);
|
|
332
333
|
var catalogReady = plannerState.getIn(['catalog', 'ready']);
|
|
@@ -346,12 +347,12 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
346
347
|
key: "render",
|
|
347
348
|
value: function render() {
|
|
348
349
|
var _this2 = this;
|
|
349
|
-
var _this$
|
|
350
|
-
width = _this$
|
|
351
|
-
height = _this$
|
|
352
|
-
state = _this$
|
|
353
|
-
stateExtractor = _this$
|
|
354
|
-
props = (0, _objectWithoutProperties2["default"])(_this$
|
|
350
|
+
var _this$props2 = this.props,
|
|
351
|
+
width = _this$props2.width,
|
|
352
|
+
height = _this$props2.height,
|
|
353
|
+
state = _this$props2.state,
|
|
354
|
+
stateExtractor = _this$props2.stateExtractor,
|
|
355
|
+
props = (0, _objectWithoutProperties2["default"])(_this$props2, _excluded);
|
|
355
356
|
var actionsFromProps = (0, _objectsUtils.objectsMap)(_export["default"], function (ns) {
|
|
356
357
|
return _this2.props[ns];
|
|
357
358
|
});
|
|
@@ -38,26 +38,14 @@ var FormNumberInput = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
38
38
|
}
|
|
39
39
|
(0, _inherits2["default"])(FormNumberInput, _Component);
|
|
40
40
|
return (0, _createClass2["default"])(FormNumberInput, [{
|
|
41
|
-
key: "
|
|
42
|
-
value: function
|
|
43
|
-
if (this.
|
|
44
|
-
this.input.current.focus();
|
|
45
|
-
this.input.current.select();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, {
|
|
49
|
-
key: "componentWillReceiveProps",
|
|
50
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
51
|
-
if (this.props.value !== nextProps.value || this.props.focus !== nextProps.focus) {
|
|
41
|
+
key: "componentDidUpdate",
|
|
42
|
+
value: function componentDidUpdate(prevProps) {
|
|
43
|
+
if (this.props.value !== prevProps.value || this.props.focus !== prevProps.focus) {
|
|
52
44
|
this.setState({
|
|
53
|
-
showedValue:
|
|
54
|
-
focusOn:
|
|
45
|
+
showedValue: this.props.value,
|
|
46
|
+
focusOn: this.props.focus
|
|
55
47
|
});
|
|
56
48
|
}
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "componentDidUpdate",
|
|
60
|
-
value: function componentDidUpdate(prevProps, preprevState) {
|
|
61
49
|
if (this.props.value !== prevProps.value && prevProps.labelName !== 'Ceiling Height') {
|
|
62
50
|
this.input.current.focus();
|
|
63
51
|
this.input.current.select();
|
|
@@ -78,7 +66,6 @@ var FormNumberInput = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
78
66
|
});
|
|
79
67
|
}
|
|
80
68
|
}
|
|
81
|
-
return null;
|
|
82
69
|
}
|
|
83
70
|
}, {
|
|
84
71
|
key: "render",
|
|
@@ -28,16 +28,15 @@ var Scene = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
28
28
|
}
|
|
29
29
|
(0, _inherits2["default"])(Scene, _Component);
|
|
30
30
|
return (0, _createClass2["default"])(Scene, [{
|
|
31
|
-
key: "
|
|
31
|
+
key: "componentDidUpdate",
|
|
32
32
|
value: function () {
|
|
33
|
-
var
|
|
34
|
-
var scene, catalog, height, layers, selectedLayer, msg, isNotFoundInElements, itemType;
|
|
33
|
+
var _componentDidUpdate = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(prevProps) {
|
|
34
|
+
var _this$props, scene, catalog, height, layers, selectedLayer, msg, isNotFoundInElements, itemType;
|
|
35
35
|
return _regenerator["default"].wrap(function (_context) {
|
|
36
36
|
while (1) switch (_context.prev = _context.next) {
|
|
37
37
|
case 0:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
scene = nextProps.scene, catalog = nextProps.catalog;
|
|
38
|
+
if (this.props.scene.hashCode() !== prevProps.scene.hashCode()) {
|
|
39
|
+
_this$props = this.props, scene = _this$props.scene, catalog = _this$props.catalog;
|
|
41
40
|
height = scene.height, layers = scene.layers;
|
|
42
41
|
selectedLayer = layers.get(scene.selectedLayer);
|
|
43
42
|
msg = '';
|
|
@@ -69,10 +68,10 @@ var Scene = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
69
68
|
}
|
|
70
69
|
}, _callee, this);
|
|
71
70
|
}));
|
|
72
|
-
function
|
|
73
|
-
return
|
|
71
|
+
function componentDidUpdate(_x) {
|
|
72
|
+
return _componentDidUpdate.apply(this, arguments);
|
|
74
73
|
}
|
|
75
|
-
return
|
|
74
|
+
return componentDidUpdate;
|
|
76
75
|
}()
|
|
77
76
|
}, {
|
|
78
77
|
key: "shouldComponentUpdate",
|
|
@@ -83,10 +82,9 @@ var Scene = exports["default"] = /*#__PURE__*/function (_Component) {
|
|
|
83
82
|
key: "render",
|
|
84
83
|
value: function render() {
|
|
85
84
|
var _this = this;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
catalog = _this$props.catalog;
|
|
85
|
+
var _this$props2 = this.props,
|
|
86
|
+
scene = _this$props2.scene,
|
|
87
|
+
catalog = _this$props2.catalog;
|
|
90
88
|
var height = scene.height,
|
|
91
89
|
layers = scene.layers;
|
|
92
90
|
var selectedLayer = layers.get(scene.selectedLayer);
|
|
@@ -1459,6 +1459,9 @@ function Viewer2D(_ref) {
|
|
|
1459
1459
|
detectPinchGesture: false,
|
|
1460
1460
|
disableDoubleClickZoomWithToolAuto: true,
|
|
1461
1461
|
ref: Viewer,
|
|
1462
|
+
miniatureProps: {
|
|
1463
|
+
position: _reactSvgPanZoom.POSITION_NONE
|
|
1464
|
+
},
|
|
1462
1465
|
toolbarProps: {
|
|
1463
1466
|
position: _reactSvgPanZoom.POSITION_NONE
|
|
1464
1467
|
}
|
|
@@ -261,10 +261,12 @@ var Viewer3DFirstPerson = exports["default"] = /*#__PURE__*/function (_React$Com
|
|
|
261
261
|
this.renderer.renderLists.dispose();
|
|
262
262
|
}
|
|
263
263
|
}, {
|
|
264
|
-
key: "
|
|
265
|
-
value: function
|
|
266
|
-
var
|
|
267
|
-
|
|
264
|
+
key: "componentDidUpdate",
|
|
265
|
+
value: function componentDidUpdate(prevProps) {
|
|
266
|
+
var _this$props = this.props,
|
|
267
|
+
width = _this$props.width,
|
|
268
|
+
height = _this$props.height,
|
|
269
|
+
state = _this$props.state;
|
|
268
270
|
var camera = this.camera,
|
|
269
271
|
renderer = this.renderer,
|
|
270
272
|
scene3D = this.scene3D,
|
|
@@ -277,19 +279,27 @@ var Viewer3DFirstPerson = exports["default"] = /*#__PURE__*/function (_React$Com
|
|
|
277
279
|
linesActions: this.context.linesActions,
|
|
278
280
|
projectActions: this.context.projectActions
|
|
279
281
|
};
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
282
|
+
|
|
283
|
+
// Handle width/height changes
|
|
284
|
+
if (width !== prevProps.width || height !== prevProps.height) {
|
|
285
|
+
this.width = width;
|
|
286
|
+
this.height = height;
|
|
287
|
+
camera.aspect = width / height;
|
|
288
|
+
camera.updateProjectionMatrix();
|
|
289
|
+
renderer.setSize(width, height);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Handle scene changes
|
|
293
|
+
if (state.scene !== prevProps.state.scene) {
|
|
294
|
+
var changedValues = (0, _immutablediff["default"])(prevProps.state.scene, state.scene);
|
|
295
|
+
(0, _sceneCreator.updateScene)(planData, state.scene, prevProps.state.scene, changedValues.toJS(), actions, this.context.catalog);
|
|
287
296
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
renderer.
|
|
291
|
-
renderer.
|
|
292
|
-
renderer.
|
|
297
|
+
|
|
298
|
+
// Always re-render after updates
|
|
299
|
+
renderer.clear();
|
|
300
|
+
renderer.render(scene3D, camera);
|
|
301
|
+
renderer.clearDepth();
|
|
302
|
+
renderer.render(sceneOnTop, camera);
|
|
293
303
|
}
|
|
294
304
|
}, {
|
|
295
305
|
key: "render",
|
|
@@ -2451,14 +2451,18 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
2451
2451
|
this.renderer.renderLists.dispose();
|
|
2452
2452
|
}
|
|
2453
2453
|
}, {
|
|
2454
|
-
key: "
|
|
2455
|
-
value: function
|
|
2454
|
+
key: "componentDidUpdate",
|
|
2455
|
+
value: function componentDidUpdate(prevProps) {
|
|
2456
2456
|
var _this4 = this;
|
|
2457
|
-
if
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
var
|
|
2457
|
+
// Early return if downloadFlag and state are unchanged or scene is empty
|
|
2458
|
+
if (this.props.downloadFlag && (0, _immutablediff["default"])(prevProps.state, this.props.state).toJS().length == 0 || (0, _helper.isEmpty)(this.props.state.scene)) {
|
|
2459
|
+
return;
|
|
2460
|
+
}
|
|
2461
|
+
var _this$props = this.props,
|
|
2462
|
+
width = _this$props.width,
|
|
2463
|
+
height = _this$props.height;
|
|
2464
|
+
var selectedLayer = this.props.state.getIn(['scene', 'layers', this.props.state.scene.selectedLayer]);
|
|
2465
|
+
var ceilHeight = (0, _convertUnitsLite.convert)(selectedLayer.ceilHeight).from(selectedLayer.unit).to(this.props.state.scene.unit);
|
|
2462
2466
|
var actions = {
|
|
2463
2467
|
areaActions: this.context.areaActions,
|
|
2464
2468
|
holesActions: this.context.holesActions,
|
|
@@ -2468,7 +2472,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
2468
2472
|
projectActions: this.context.projectActions,
|
|
2469
2473
|
catalog: this.context.catalog
|
|
2470
2474
|
};
|
|
2471
|
-
var isLoadingCabinet =
|
|
2475
|
+
var isLoadingCabinet = this.props.state.scene.isLoadingCabinet;
|
|
2472
2476
|
if (this.state.isLoadingCabinet !== isLoadingCabinet) this.setState({
|
|
2473
2477
|
isLoadingCabinet: isLoadingCabinet
|
|
2474
2478
|
});
|
|
@@ -2479,7 +2483,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
2479
2483
|
var allItemRect;
|
|
2480
2484
|
|
|
2481
2485
|
// handle camera setting
|
|
2482
|
-
switch (
|
|
2486
|
+
switch (prevProps.state.mode) {
|
|
2483
2487
|
case _constants.MODE_ELEVATION_VIEW:
|
|
2484
2488
|
// when Elevation mode (camera: Orthographic)
|
|
2485
2489
|
var cameraRect = (0, _helper.handleCamRect)(width, height, ceilHeight, this.state.lineLength);
|
|
@@ -2497,12 +2501,12 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
2497
2501
|
break;
|
|
2498
2502
|
}
|
|
2499
2503
|
this.camera.updateProjectionMatrix();
|
|
2500
|
-
var data =
|
|
2504
|
+
var data = this.props.state.scene;
|
|
2501
2505
|
var layer = data.getIn(['layers', data.selectedLayer]);
|
|
2502
2506
|
var self = this;
|
|
2503
2507
|
function implementBacksplash() {
|
|
2504
|
-
if ((0, _helper.isElevationView)(self.props.state.mode)) return;
|
|
2505
|
-
var allItems = _export.GeometryUtils.getAllItemSpecified(
|
|
2508
|
+
if ((0, _helper.isElevationView)(self.props.state.mode)) return;
|
|
2509
|
+
var allItems = _export.GeometryUtils.getAllItemSpecified(self.props.state.scene, actions.catalog, _constants.BASE_CABINET_LAYOUTPOS);
|
|
2506
2510
|
var i,
|
|
2507
2511
|
items = [];
|
|
2508
2512
|
for (i = 0; i < allItems.others.length; i++) items.push(allItems.others[i]);
|
|
@@ -2511,7 +2515,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
2511
2515
|
var calcRect = _export.GeometryUtils.getCalcRectFromItem3D(items[i]);
|
|
2512
2516
|
var visible = _export.GeometryUtils.isSnappedLine(calcRect, allLineRects);
|
|
2513
2517
|
actions.itemsActions.setBacksplashVisible(items[i].itemInfo.id, visible);
|
|
2514
|
-
(0, _sceneCreator.createBacksplash)(items[i],
|
|
2518
|
+
(0, _sceneCreator.createBacksplash)(items[i], self.props.state.scene.getIn(['layers', self.props.state.scene.selectedLayer]), planData, self.props.state.scene);
|
|
2515
2519
|
}
|
|
2516
2520
|
}
|
|
2517
2521
|
function implementWarningBox() {
|
|
@@ -2539,10 +2543,10 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
2539
2543
|
showflag: false
|
|
2540
2544
|
});
|
|
2541
2545
|
}
|
|
2542
|
-
if (
|
|
2543
|
-
var changedValues = (0, _immutablediff["default"])(
|
|
2546
|
+
if (this.props.state.scene !== prevProps.state.scene || this.props.state.doorStyle && this.props.state.doorStyle.get('name') !== prevProps.state.doorStyle.get('name')) {
|
|
2547
|
+
var changedValues = (0, _immutablediff["default"])(prevProps.state.scene, this.props.state.scene);
|
|
2544
2548
|
prepareSnapSpec(layer);
|
|
2545
|
-
if (
|
|
2549
|
+
if (this.props.state.doorStyle && this.props.state.doorStyle.get('name') === prevProps.state.doorStyle.get('name')) {
|
|
2546
2550
|
self.setState({
|
|
2547
2551
|
isLoading: true
|
|
2548
2552
|
});
|
|
@@ -2561,7 +2565,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
2561
2565
|
}
|
|
2562
2566
|
self.renderer.domElement.style.display = 'none';
|
|
2563
2567
|
}
|
|
2564
|
-
if (
|
|
2568
|
+
if (this.props.state.scene.showfg == true) {
|
|
2565
2569
|
implementBacksplash();
|
|
2566
2570
|
implementWarningBox();
|
|
2567
2571
|
} else {
|
|
@@ -2570,7 +2574,7 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
2570
2574
|
var _this$state = this.state,
|
|
2571
2575
|
toolObj = _this$state.toolObj,
|
|
2572
2576
|
angleObj = _this$state.angleObj;
|
|
2573
|
-
var _updateScene = (0, _sceneCreator.updateScene)(this.planData,
|
|
2577
|
+
var _updateScene = (0, _sceneCreator.updateScene)(this.planData, this.props.state.scene, prevProps.state.scene, changedValues.toJS(), actions, this.context.catalog, this.props.state.mode, toolObj, angleObj, this.props.state.draggingSupport),
|
|
2574
2578
|
promise = _updateScene.promise;
|
|
2575
2579
|
self.setState();
|
|
2576
2580
|
promise.then(function (p1Value) {
|
|
@@ -2582,8 +2586,8 @@ var Scene3DViewer = exports["default"] = /*#__PURE__*/function (_React$Component
|
|
|
2582
2586
|
});
|
|
2583
2587
|
self.renderer.domElement.style.display = 'block';
|
|
2584
2588
|
});
|
|
2585
|
-
if (
|
|
2586
|
-
|
|
2589
|
+
if (this.props.state.getIn(['scene', 'isEndDragging'])) {
|
|
2590
|
+
this.props.state.setIn(['scene', 'isEndDragging'], false);
|
|
2587
2591
|
}
|
|
2588
2592
|
}
|
|
2589
2593
|
this.renderer.setSize(width, height);
|