kitchen-simulator 4.0.0-queuedEvents → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/LiteKitchenConfigurator.js +141 -288
- package/es/LiteRenderer.js +159 -398
- package/es/actions/items-actions.js +10 -6
- package/es/actions/lines-actions.js +3 -1
- package/es/actions/project-actions.js +15 -5
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/areas/area/planner-element.js +10 -5
- package/es/catalog/catalog.js +1 -4
- package/es/catalog/factories/area-factory-3d.js +2 -1
- package/es/catalog/factories/wall-factory-3d.js +2 -2
- package/es/catalog/factories/wall-factory.js +8 -8
- package/es/catalog/lines/wall/planner-element.js +18 -9
- package/es/catalog/utils/exporter.js +7 -3
- package/es/catalog/utils/item-loader.js +24 -14
- package/es/catalog/utils/mtl-loader.js +2 -2
- package/es/catalog/utils/obj-loader.js +2 -2
- package/es/class/hole.js +0 -2
- package/es/class/item.js +183 -184
- package/es/class/line.js +11 -3
- package/es/class/project.js +165 -48
- package/es/components/content.js +19 -6
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/item.js +84 -51
- package/es/components/viewer2d/line.js +315 -243
- package/es/components/viewer2d/ruler.js +20 -38
- package/es/components/viewer2d/rulerDist.js +48 -78
- package/es/components/viewer2d/utils.js +6 -0
- package/es/components/viewer2d/viewer2d.js +298 -220
- package/es/components/viewer3d/front3D.js +3 -2
- package/es/components/viewer3d/libs/mtl-loader.js +2 -2
- package/es/components/viewer3d/libs/obj-loader.js +2 -2
- package/es/components/viewer3d/libs/orbit-controls.js +3 -4
- package/es/components/viewer3d/libs/pointer-lock-controls.js +6 -7
- package/es/components/viewer3d/scene-creator.js +51 -15
- package/es/components/viewer3d/viewer3d.js +121 -82
- package/es/constants.js +111 -3
- package/es/devLiteRenderer.js +688 -31
- package/es/index.js +567 -87
- package/es/models.js +9 -5
- package/es/plugins/SVGLoader.js +7 -5
- package/es/plugins/console-debugger.js +0 -2
- package/es/plugins/keyboard.js +15 -6
- package/es/reducers/items-reducer.js +5 -5
- package/es/reducers/lines-reducer.js +1 -1
- package/es/reducers/project-reducer.js +5 -3
- package/es/shared-style.js +4 -4
- package/es/utils/geometry.js +163 -2
- package/es/utils/get-edges-of-subgraphs.js +1 -1
- package/es/utils/graph-cycles.js +1 -1
- package/es/utils/graph.js +1 -1
- package/es/utils/helper.js +105 -3
- package/es/utils/isolate-event-handler.js +1542 -164
- package/es/utils/molding.js +461 -11
- package/lib/LiteKitchenConfigurator.js +141 -289
- package/lib/LiteRenderer.js +159 -399
- package/lib/actions/items-actions.js +10 -6
- package/lib/actions/lines-actions.js +3 -1
- package/lib/actions/project-actions.js +15 -4
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/areas/area/planner-element.js +11 -5
- package/lib/catalog/catalog.js +1 -4
- package/lib/catalog/factories/area-factory-3d.js +2 -1
- package/lib/catalog/factories/wall-factory-3d.js +2 -2
- package/lib/catalog/factories/wall-factory.js +8 -8
- package/lib/catalog/lines/wall/planner-element.js +19 -9
- package/lib/catalog/utils/exporter.js +7 -3
- package/lib/catalog/utils/item-loader.js +24 -14
- package/lib/catalog/utils/mtl-loader.js +9 -2
- package/lib/catalog/utils/obj-loader.js +10 -2
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +180 -181
- package/lib/class/line.js +9 -1
- package/lib/class/project.js +164 -47
- package/lib/components/content.js +19 -6
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/item.js +83 -50
- package/lib/components/viewer2d/line.js +315 -242
- package/lib/components/viewer2d/ruler.js +19 -37
- package/lib/components/viewer2d/rulerDist.js +48 -78
- package/lib/components/viewer2d/utils.js +7 -0
- package/lib/components/viewer2d/viewer2d.js +296 -219
- package/lib/components/viewer3d/front3D.js +3 -2
- package/lib/components/viewer3d/libs/mtl-loader.js +9 -2
- package/lib/components/viewer3d/libs/obj-loader.js +9 -2
- package/lib/components/viewer3d/libs/orbit-controls.js +11 -5
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +13 -7
- package/lib/components/viewer3d/scene-creator.js +49 -13
- package/lib/components/viewer3d/viewer3d.js +119 -80
- package/lib/constants.js +116 -7
- package/lib/devLiteRenderer.js +687 -30
- package/lib/index.js +567 -87
- package/lib/models.js +9 -5
- package/lib/plugins/SVGLoader.js +7 -5
- package/lib/plugins/console-debugger.js +0 -2
- package/lib/plugins/keyboard.js +15 -6
- package/lib/reducers/items-reducer.js +5 -5
- package/lib/reducers/lines-reducer.js +1 -1
- package/lib/reducers/project-reducer.js +4 -2
- package/lib/shared-style.js +4 -4
- package/lib/utils/geometry.js +164 -2
- package/lib/utils/get-edges-of-subgraphs.js +6 -1
- package/lib/utils/graph-cycles.js +7 -8
- package/lib/utils/graph.js +6 -1
- package/lib/utils/helper.js +108 -2
- package/lib/utils/isolate-event-handler.js +1538 -159
- package/lib/utils/molding.js +463 -9
- package/package.json +1 -1
- package/es/assets/Window.hdr +0 -2100
- package/es/assets/img/1.jpg +0 -0
- package/lib/assets/Window.hdr +0 -2100
- package/lib/assets/img/1.jpg +0 -0
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
5
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
6
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
9
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
10
|
-
import
|
|
11
|
-
var _excluded = ["width", "height", "
|
|
12
|
-
|
|
10
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
11
|
+
var _excluded = ["width", "height", "extractedState"];
|
|
12
|
+
var _templateObject, _templateObject2;
|
|
13
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
15
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
16
16
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
|
-
|
|
17
|
+
// LiteKitchenConfigurator.jsx
|
|
18
|
+
import styled from 'styled-components';
|
|
18
19
|
import { convert } from "./utils/convert-units-lite";
|
|
19
20
|
import PropTypes from 'prop-types';
|
|
20
21
|
import React, { Component } from 'react';
|
|
@@ -34,32 +35,16 @@ var wrapperStyle = {
|
|
|
34
35
|
display: 'flex',
|
|
35
36
|
flexFlow: 'row nowrap'
|
|
36
37
|
};
|
|
38
|
+
var WarningItem = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n opacity: 0.8;\n position: absolute;\n border-radius: 6px;\n z-index: 11;\n background-color: #ff7400;\n width: max-content;\n align-items: center;\n padding: 10px;\n display: none;\n box-shadow:\n 0px 3px 5px -1px rgba(0, 0, 0, 0.2),\n 0px 6px 10px 0px rgba(0, 0, 0, 0.39),\n 0px 1px 18px 0px rgba(0, 0, 0, 0.12);\n top: -50px;\n left: 5px;\n color: white;\n"])));
|
|
39
|
+
var SubCategoryItemImage = styled.img(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: ", ";\n height: 30px;\n width: 30px;\n -webkit-mask-image: url(", ");\n -webkit-mask-size: calc(100% - 2px) calc(100% - 2px);\n -webkit-mask-repeat: no-repeat;\n -webkit-mask-position: 1px 1px;\n"])), constants.SECONDARY_PURPLE_COLOR, function (props) {
|
|
40
|
+
return props.maskImage + '?nocache=2025';
|
|
41
|
+
});
|
|
37
42
|
var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
38
43
|
function LiteKitchenConfigurator(props) {
|
|
39
44
|
var _utmRequestData2, _utmRequestData3, _utmRequestData4, _utmRequestData5, _utmRequestData6, _utmRequestData7, _utmRequestData8, _utmRequestData9, _utmRequestData0;
|
|
40
45
|
var _this;
|
|
41
46
|
_classCallCheck(this, LiteKitchenConfigurator);
|
|
42
47
|
_this = _callSuper(this, LiteKitchenConfigurator, [props]);
|
|
43
|
-
|
|
44
|
-
// utm tracking
|
|
45
|
-
_defineProperty(_this, "lastProcessedExternalEventId", null);
|
|
46
|
-
_defineProperty(_this, "handleBeforeUnload", function (e) {
|
|
47
|
-
var areas = _this.props.stateExtractor(_this.props.state).getIn(['scene', 'layers', _this.props.stateExtractor(_this.props.state).scene.selectedLayer, 'areas']);
|
|
48
|
-
if (!_this.state.isSaved && areas.size > 0) {
|
|
49
|
-
setTimeout(function () {
|
|
50
|
-
_this.setState({
|
|
51
|
-
savePromptVisible: true,
|
|
52
|
-
isLeaving: true
|
|
53
|
-
});
|
|
54
|
-
}, 500);
|
|
55
|
-
_this.saveProjectToStorage();
|
|
56
|
-
|
|
57
|
-
// This line is required to trigger the browser confirmation dialog
|
|
58
|
-
e.preventDefault();
|
|
59
|
-
e.returnValue = '';
|
|
60
|
-
return '';
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
48
|
var utmDetailParams = new URLSearchParams(_this.props.location && _this.props.location.search);
|
|
64
49
|
var utmStrEncoded = utmDetailParams.get('details');
|
|
65
50
|
var utmRequestData = null;
|
|
@@ -69,7 +54,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
69
54
|
utmRequestData = JSON.parse(base64Decode(utmStrEncoded));
|
|
70
55
|
utmRequestData = JSON.parse((_utmRequestData = utmRequestData) === null || _utmRequestData === void 0 ? void 0 : _utmRequestData.utm);
|
|
71
56
|
} catch (e) {
|
|
72
|
-
console.error('Cannot parse utm parameter: ',
|
|
57
|
+
console.error('Cannot parse utm parameter: ', e);
|
|
73
58
|
utmRequestData = null;
|
|
74
59
|
}
|
|
75
60
|
}
|
|
@@ -88,7 +73,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
88
73
|
myProjectsOpen: false,
|
|
89
74
|
myProjectsToLogin: false,
|
|
90
75
|
downloadPopupVisible: false,
|
|
91
|
-
// For Toolbar Item
|
|
92
76
|
toolbar: '',
|
|
93
77
|
reviewQuotePopupOpened: false,
|
|
94
78
|
floorOpened: false,
|
|
@@ -106,8 +90,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
106
90
|
isSaved: false,
|
|
107
91
|
isLeaving: false
|
|
108
92
|
};
|
|
109
|
-
|
|
110
|
-
// For UTM tracking
|
|
111
93
|
_this.utm = {
|
|
112
94
|
utm_source: ((_utmRequestData2 = utmRequestData) === null || _utmRequestData2 === void 0 ? void 0 : _utmRequestData2.source) || 'source',
|
|
113
95
|
utm_medium: ((_utmRequestData3 = utmRequestData) === null || _utmRequestData3 === void 0 ? void 0 : _utmRequestData3.medium) || 'medium',
|
|
@@ -138,10 +120,13 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
138
120
|
_this.setDownloadPopupVisible = _this.setDownloadPopupVisible.bind(_this);
|
|
139
121
|
_this.neverShowInput = /*#__PURE__*/React.createRef(null);
|
|
140
122
|
_this.setShowProperty = _this.setShowProperty.bind(_this);
|
|
123
|
+
|
|
124
|
+
// cache for viewer2D init so we don't allocate merges every render
|
|
125
|
+
_this._lastExtractedStateRef = null;
|
|
126
|
+
_this._cachedViewer2DKey = null;
|
|
127
|
+
_this._cachedExtractedState = null;
|
|
141
128
|
return _this;
|
|
142
129
|
}
|
|
143
|
-
|
|
144
|
-
// Toolbar control functions
|
|
145
130
|
_inherits(LiteKitchenConfigurator, _Component);
|
|
146
131
|
return _createClass(LiteKitchenConfigurator, [{
|
|
147
132
|
key: "setToolbar",
|
|
@@ -225,26 +210,32 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
225
210
|
}, {
|
|
226
211
|
key: "openFloor",
|
|
227
212
|
value: function openFloor() {
|
|
213
|
+
var _el$parentElement;
|
|
228
214
|
this.setState({
|
|
229
215
|
floorOpened: true
|
|
230
216
|
});
|
|
231
|
-
document.getElementById('make_floorplan_inactive')
|
|
217
|
+
var el = document.getElementById('make_floorplan_inactive');
|
|
218
|
+
if (el !== null && el !== void 0 && (_el$parentElement = el.parentElement) !== null && _el$parentElement !== void 0 && _el$parentElement.parentElement) el.parentElement.parentElement.style.zIndex = 999;
|
|
232
219
|
}
|
|
233
220
|
}, {
|
|
234
221
|
key: "openCabinet",
|
|
235
222
|
value: function openCabinet() {
|
|
223
|
+
var _el$parentElement2;
|
|
236
224
|
this.setState({
|
|
237
225
|
cabinetOpened: true
|
|
238
226
|
});
|
|
239
|
-
document.getElementById('add_cabinets_inactive')
|
|
227
|
+
var el = document.getElementById('add_cabinets_inactive');
|
|
228
|
+
if (el !== null && el !== void 0 && (_el$parentElement2 = el.parentElement) !== null && _el$parentElement2 !== void 0 && _el$parentElement2.parentElement) el.parentElement.parentElement.style.zIndex = 999;
|
|
240
229
|
}
|
|
241
230
|
}, {
|
|
242
231
|
key: "toggleDoorStyle",
|
|
243
232
|
value: function toggleDoorStyle(visible) {
|
|
233
|
+
var _el$parentElement3;
|
|
244
234
|
this.setState({
|
|
245
235
|
doorStyleOpen: visible
|
|
246
236
|
});
|
|
247
|
-
document.getElementById('select_doorstyle_inactive')
|
|
237
|
+
var el = document.getElementById('select_doorstyle_inactive');
|
|
238
|
+
if (el !== null && el !== void 0 && (_el$parentElement3 = el.parentElement) !== null && _el$parentElement3 !== void 0 && _el$parentElement3.parentElement) el.parentElement.parentElement.style.zIndex = visible ? 999 : 6;
|
|
248
239
|
}
|
|
249
240
|
}, {
|
|
250
241
|
key: "replaceCabinet",
|
|
@@ -256,70 +247,72 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
256
247
|
}, {
|
|
257
248
|
key: "openAppliance",
|
|
258
249
|
value: function openAppliance() {
|
|
250
|
+
var _el$parentElement4;
|
|
259
251
|
this.setState({
|
|
260
252
|
applianceOpened: true
|
|
261
253
|
});
|
|
262
|
-
document.getElementById('add_appliances_inactive')
|
|
254
|
+
var el = document.getElementById('add_appliances_inactive');
|
|
255
|
+
if (el !== null && el !== void 0 && (_el$parentElement4 = el.parentElement) !== null && _el$parentElement4 !== void 0 && _el$parentElement4.parentElement) el.parentElement.parentElement.style.zIndex = 999;
|
|
263
256
|
}
|
|
264
257
|
}, {
|
|
265
258
|
key: "openFinishing",
|
|
266
259
|
value: function openFinishing() {
|
|
260
|
+
var _el$parentElement5;
|
|
267
261
|
this.setState({
|
|
268
262
|
finishingOpened: true
|
|
269
263
|
});
|
|
270
|
-
document.getElementById('finishing_touches_inactive')
|
|
264
|
+
var el = document.getElementById('finishing_touches_inactive');
|
|
265
|
+
if (el !== null && el !== void 0 && (_el$parentElement5 = el.parentElement) !== null && _el$parentElement5 !== void 0 && _el$parentElement5.parentElement) el.parentElement.parentElement.style.zIndex = 999;
|
|
271
266
|
}
|
|
272
267
|
}, {
|
|
273
268
|
key: "onReviewQuoteClicked",
|
|
274
269
|
value: function onReviewQuoteClicked(visible) {
|
|
270
|
+
var _el$parentElement6;
|
|
275
271
|
this.setState({
|
|
276
272
|
reviewQuotePopupOpened: visible
|
|
277
273
|
});
|
|
278
|
-
document.getElementById('review_quote_inactive')
|
|
274
|
+
var el = document.getElementById('review_quote_inactive');
|
|
275
|
+
if (el !== null && el !== void 0 && (_el$parentElement6 = el.parentElement) !== null && _el$parentElement6 !== void 0 && _el$parentElement6.parentElement) el.parentElement.parentElement.style.zIndex = visible ? 999 : 6;
|
|
279
276
|
}
|
|
280
277
|
}, {
|
|
281
278
|
key: "closeFloorTB",
|
|
282
279
|
value: function closeFloorTB() {
|
|
280
|
+
var _el$parentElement7;
|
|
283
281
|
this.setState({
|
|
284
282
|
floorOpened: false
|
|
285
283
|
});
|
|
286
|
-
|
|
284
|
+
var el = document.getElementById('make_floorplan_inactive');
|
|
285
|
+
if (el !== null && el !== void 0 && (_el$parentElement7 = el.parentElement) !== null && _el$parentElement7 !== void 0 && _el$parentElement7.parentElement) el.parentElement.parentElement.style.zIndex = 6;
|
|
287
286
|
}
|
|
288
287
|
}, {
|
|
289
288
|
key: "closeCabinetTB",
|
|
290
289
|
value: function closeCabinetTB() {
|
|
290
|
+
var _el$parentElement8;
|
|
291
291
|
this.setState({
|
|
292
292
|
cabinetOpened: false
|
|
293
293
|
});
|
|
294
|
-
document.getElementById('add_cabinets_inactive')
|
|
294
|
+
var el = document.getElementById('add_cabinets_inactive');
|
|
295
|
+
if (el !== null && el !== void 0 && (_el$parentElement8 = el.parentElement) !== null && _el$parentElement8 !== void 0 && _el$parentElement8.parentElement) el.parentElement.parentElement.style.zIndex = 6;
|
|
295
296
|
}
|
|
296
297
|
}, {
|
|
297
298
|
key: "closeFinishingTB",
|
|
298
299
|
value: function closeFinishingTB() {
|
|
300
|
+
var _el$parentElement9;
|
|
299
301
|
this.setState({
|
|
300
302
|
finishingOpened: false
|
|
301
303
|
});
|
|
302
|
-
document.getElementById('finishing_touches_inactive')
|
|
304
|
+
var el = document.getElementById('finishing_touches_inactive');
|
|
305
|
+
if (el !== null && el !== void 0 && (_el$parentElement9 = el.parentElement) !== null && _el$parentElement9 !== void 0 && _el$parentElement9.parentElement) el.parentElement.parentElement.style.zIndex = 6;
|
|
303
306
|
}
|
|
304
307
|
}, {
|
|
305
308
|
key: "closeApplianceTB",
|
|
306
309
|
value: function closeApplianceTB() {
|
|
310
|
+
var _el$parentElement0;
|
|
307
311
|
this.setState({
|
|
308
312
|
applianceOpened: false
|
|
309
313
|
});
|
|
310
|
-
document.getElementById('add_appliances_inactive')
|
|
311
|
-
|
|
312
|
-
}, {
|
|
313
|
-
key: "closeDoorstyle",
|
|
314
|
-
value: function closeDoorstyle() {
|
|
315
|
-
this.setState({});
|
|
316
|
-
document.getElementById('select_doorstyle_inactive').parentElement.parentElement.style.zIndex = 6;
|
|
317
|
-
}
|
|
318
|
-
}, {
|
|
319
|
-
key: "closeReviewQuote",
|
|
320
|
-
value: function closeReviewQuote() {
|
|
321
|
-
this.setState({});
|
|
322
|
-
document.getElementById('review_quote_inactive').parentElement.parentElement.style.zIndex = 6;
|
|
314
|
+
var el = document.getElementById('add_appliances_inactive');
|
|
315
|
+
if (el !== null && el !== void 0 && (_el$parentElement0 = el.parentElement) !== null && _el$parentElement0 !== void 0 && _el$parentElement0.parentElement) el.parentElement.parentElement.style.zIndex = 6;
|
|
323
316
|
}
|
|
324
317
|
}, {
|
|
325
318
|
key: "getChildContext",
|
|
@@ -332,181 +325,39 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
332
325
|
catalog: this.props.catalog
|
|
333
326
|
});
|
|
334
327
|
}
|
|
335
|
-
}, {
|
|
336
|
-
key: "saveProjectToStorage",
|
|
337
|
-
value: function saveProjectToStorage() {
|
|
338
|
-
var _this$props = this.props,
|
|
339
|
-
state = _this$props.state,
|
|
340
|
-
stateExtractor = _this$props.stateExtractor;
|
|
341
|
-
var extractedState = stateExtractor(state);
|
|
342
|
-
var projectData = JSON.stringify(extractedState.get('scene').toJS());
|
|
343
|
-
sessionStorage.setItem(window.location.href, projectData);
|
|
344
|
-
}
|
|
345
328
|
}, {
|
|
346
329
|
key: "componentDidMount",
|
|
347
330
|
value: function componentDidMount() {
|
|
348
|
-
var _this3 = this;
|
|
349
|
-
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
350
|
-
console.log('context =>', this.context);
|
|
351
331
|
window.forRedo = [];
|
|
352
332
|
var store = this.context.store;
|
|
353
|
-
var _this$
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
plugins = _this$props2.plugins;
|
|
359
|
-
projectActions.initCatalog(catalog);
|
|
360
|
-
var match = this.props.match;
|
|
361
|
-
if (sessionStorage.getItem(window.location.href)) {
|
|
362
|
-
var jsonData = sessionStorage.getItem(window.location.href);
|
|
363
|
-
projectActions.loadProject(JSON.parse(jsonData), this.props.categoryData);
|
|
364
|
-
sessionStorage.removeItem(window.location.href);
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
333
|
+
var _this$props = this.props,
|
|
334
|
+
stateExtractor = _this$props.stateExtractor,
|
|
335
|
+
plugins = _this$props.plugins;
|
|
336
|
+
|
|
337
|
+
// keep old behavior: run plugins once on mount
|
|
367
338
|
var newplugins = _toConsumableArray(plugins);
|
|
368
339
|
newplugins.forEach(function (newplugin) {
|
|
369
340
|
return newplugin(store, stateExtractor);
|
|
370
341
|
});
|
|
371
|
-
if (match && match.params.pid === undefined) {
|
|
372
|
-
projectActions.newProject();
|
|
373
|
-
sessionStorage.setItem('projectTitle', 'Untitled');
|
|
374
|
-
projectActions.rename('Untitled');
|
|
375
|
-
sessionStorage.removeItem('projectId');
|
|
376
|
-
sessionStorage.removeItem('email');
|
|
377
|
-
sessionStorage.removeItem('firstName');
|
|
378
|
-
sessionStorage.removeItem('lastName');
|
|
379
|
-
sessionStorage.removeItem('usedObjects');
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
if (match && match.params.pid !== undefined) {
|
|
383
|
-
if (match.params.pid === 'new') {
|
|
384
|
-
projectActions.newProject();
|
|
385
|
-
sessionStorage.setItem('projectTitle', 'Untitled');
|
|
386
|
-
projectActions.rename('Untitled');
|
|
387
|
-
sessionStorage.removeItem('projectId');
|
|
388
|
-
sessionStorage.removeItem('email');
|
|
389
|
-
sessionStorage.removeItem('firstName');
|
|
390
|
-
sessionStorage.removeItem('lastName');
|
|
391
|
-
sessionStorage.removeItem('usedObjects');
|
|
392
|
-
} else {
|
|
393
|
-
axios.post("".concat(constants.API_SERVER_URL, "/api/project/loadPidProject"), {
|
|
394
|
-
pid: match.params.pid,
|
|
395
|
-
visualizerName: sessionStorage.getItem('visualizerName')
|
|
396
|
-
}).then(/*#__PURE__*/function () {
|
|
397
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
|
|
398
|
-
var projectElement, jsonData, _t;
|
|
399
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
400
|
-
while (1) switch (_context.prev = _context.next) {
|
|
401
|
-
case 0:
|
|
402
|
-
projectElement = response.data.projectElement;
|
|
403
|
-
if (!(projectElement.length === 0)) {
|
|
404
|
-
_context.next = 1;
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
return _context.abrupt("return");
|
|
408
|
-
case 1:
|
|
409
|
-
sessionStorage.setItem('projectTitle', projectElement[0].title);
|
|
410
|
-
projectActions.rename(projectElement[0].title);
|
|
411
|
-
sessionStorage.setItem('projectId', projectElement[0].id);
|
|
412
|
-
sessionStorage.setItem('email', projectElement[0].email);
|
|
413
|
-
sessionStorage.setItem('firstName', projectElement[0].firstName);
|
|
414
|
-
sessionStorage.setItem('lastName', projectElement[0].lastName);
|
|
415
|
-
sessionStorage.setItem('phone', projectElement[0].phone);
|
|
416
|
-
if (!projectElement[0].project_data) {
|
|
417
|
-
_context.next = 2;
|
|
418
|
-
break;
|
|
419
|
-
}
|
|
420
|
-
jsonData = JSON.parse(projectElement[0].project_data);
|
|
421
|
-
_context.next = 5;
|
|
422
|
-
break;
|
|
423
|
-
case 2:
|
|
424
|
-
_context.prev = 2;
|
|
425
|
-
_context.next = 3;
|
|
426
|
-
return axios.post("".concat(constants.API_SERVER_URL, "/api/project/loadPidData"), {
|
|
427
|
-
pid: match.params.pid
|
|
428
|
-
}).data.data;
|
|
429
|
-
case 3:
|
|
430
|
-
jsonData = _context.sent;
|
|
431
|
-
_context.next = 5;
|
|
432
|
-
break;
|
|
433
|
-
case 4:
|
|
434
|
-
_context.prev = 4;
|
|
435
|
-
_t = _context["catch"](2);
|
|
436
|
-
_this3.setState({
|
|
437
|
-
isSnackBarOpen: true,
|
|
438
|
-
snackBarMessage: _t
|
|
439
|
-
});
|
|
440
|
-
case 5:
|
|
441
|
-
jsonData.isLoadingCabinet = false;
|
|
442
|
-
projectActions.loadProject(jsonData, _this3.props.categoryData);
|
|
443
|
-
case 6:
|
|
444
|
-
case "end":
|
|
445
|
-
return _context.stop();
|
|
446
|
-
}
|
|
447
|
-
}, _callee, null, [[2, 4]]);
|
|
448
|
-
}));
|
|
449
|
-
return function (_x) {
|
|
450
|
-
return _ref.apply(this, arguments);
|
|
451
|
-
};
|
|
452
|
-
}());
|
|
453
|
-
}
|
|
454
|
-
sessionStorage.removeItem('user_type');
|
|
455
|
-
sessionStorage.removeItem('project_type');
|
|
456
|
-
sessionStorage.removeItem('project_timeline');
|
|
457
|
-
}
|
|
458
342
|
}
|
|
459
343
|
}, {
|
|
460
|
-
key: "
|
|
461
|
-
value: function
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}, {
|
|
469
|
-
key: "componentWillReceiveProps",
|
|
470
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
471
|
-
var _this4 = this;
|
|
472
|
-
var stateExtractor = nextProps.stateExtractor,
|
|
473
|
-
state = nextProps.state,
|
|
474
|
-
projectActions = nextProps.projectActions,
|
|
475
|
-
catalog = nextProps.catalog,
|
|
476
|
-
externalEvent = nextProps.externalEvent;
|
|
344
|
+
key: "componentDidUpdate",
|
|
345
|
+
value: function componentDidUpdate(prevProps) {
|
|
346
|
+
var _extractedState$getIn;
|
|
347
|
+
var _this$props2 = this.props,
|
|
348
|
+
externalEvent = _this$props2.externalEvent,
|
|
349
|
+
extractedState = _this$props2.extractedState,
|
|
350
|
+
projectActions = _this$props2.projectActions,
|
|
351
|
+
catalog = _this$props2.catalog;
|
|
477
352
|
|
|
478
|
-
// handle external
|
|
479
|
-
if (
|
|
480
|
-
|
|
481
|
-
if (eventId == null) return;
|
|
482
|
-
if (this.lastProcessedExternalEventId === eventId) {
|
|
483
|
-
return; // already processed
|
|
484
|
-
}
|
|
485
|
-
this.lastProcessedExternalEventId = eventId;
|
|
486
|
-
try {
|
|
487
|
-
var result = handleExternalEvent(nextProps);
|
|
488
|
-
if (result && typeof result.then === 'function') {
|
|
489
|
-
result.then(function () {
|
|
490
|
-
var _this4$props$onExtern, _this4$props;
|
|
491
|
-
return (_this4$props$onExtern = (_this4$props = _this4.props).onExternalEventProcessed) === null || _this4$props$onExtern === void 0 ? void 0 : _this4$props$onExtern.call(_this4$props, eventId);
|
|
492
|
-
})["catch"](function () {
|
|
493
|
-
var _this4$props$onExtern2, _this4$props2;
|
|
494
|
-
return (_this4$props$onExtern2 = (_this4$props2 = _this4.props).onExternalEventProcessed) === null || _this4$props$onExtern2 === void 0 ? void 0 : _this4$props$onExtern2.call(_this4$props2, eventId);
|
|
495
|
-
});
|
|
496
|
-
} else {
|
|
497
|
-
var _this$props$onExterna, _this$props3;
|
|
498
|
-
(_this$props$onExterna = (_this$props3 = this.props).onExternalEventProcessed) === null || _this$props$onExterna === void 0 || _this$props$onExterna.call(_this$props3, eventId);
|
|
499
|
-
}
|
|
500
|
-
} catch (e) {
|
|
501
|
-
var _this$props$onExterna2, _this$props4;
|
|
502
|
-
(_this$props$onExterna2 = (_this$props4 = this.props).onExternalEventProcessed) === null || _this$props$onExterna2 === void 0 || _this$props$onExterna2.call(_this$props4, eventId);
|
|
503
|
-
throw e;
|
|
504
|
-
}
|
|
505
|
-
var plannerState = stateExtractor(state);
|
|
506
|
-
var catalogReady = plannerState.getIn(['catalog', 'ready']);
|
|
507
|
-
if (!catalogReady) {
|
|
508
|
-
projectActions.initCatalog(catalog);
|
|
353
|
+
// same behavior: handle external event when it changes
|
|
354
|
+
if (prevProps.externalEvent !== externalEvent) {
|
|
355
|
+
handleExternalEvent(this.props);
|
|
509
356
|
}
|
|
357
|
+
|
|
358
|
+
// same behavior: init catalog until ready
|
|
359
|
+
var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn = extractedState.getIn) === null || _extractedState$getIn === void 0 ? void 0 : _extractedState$getIn.call(extractedState, ['catalog', 'ready']);
|
|
360
|
+
if (!catalogReady) projectActions.initCatalog(catalog);
|
|
510
361
|
}
|
|
511
362
|
}, {
|
|
512
363
|
key: "isProjectEmpty",
|
|
@@ -516,15 +367,51 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
516
367
|
var layer = layers.get(selectedLayer);
|
|
517
368
|
return layer.areas.size + layer.lines.size + layer.holes.size + layer.items.size === 0;
|
|
518
369
|
}
|
|
370
|
+
}, {
|
|
371
|
+
key: "getExtractedStateWithViewer2DInit",
|
|
372
|
+
value: function getExtractedStateWithViewer2DInit(extractedState, width, height) {
|
|
373
|
+
if (!extractedState) return extractedState;
|
|
374
|
+
|
|
375
|
+
// ✅ If the extractedState reference changed, drop cache immediately.
|
|
376
|
+
if (this._lastExtractedStateRef !== extractedState) {
|
|
377
|
+
this._lastExtractedStateRef = extractedState;
|
|
378
|
+
this._cachedViewer2DKey = null;
|
|
379
|
+
this._cachedExtractedState = null;
|
|
380
|
+
}
|
|
381
|
+
var _viewer2D = extractedState.getIn(['viewer2D']);
|
|
382
|
+
if (!_viewer2D || _viewer2D.size <= 0) return extractedState;
|
|
383
|
+
var v = _viewer2D.toJS();
|
|
384
|
+
|
|
385
|
+
// Only do the "center viewer2D if e/f are zero" logic.
|
|
386
|
+
// ✅ No need to build keys from unrelated parts of state.
|
|
387
|
+
if (v.e !== 0 || v.f !== 0) return extractedState;
|
|
388
|
+
|
|
389
|
+
// Build a cache key ONLY for this viewer2D-centering computation.
|
|
390
|
+
var cacheKey = "".concat(width, ":").concat(height, ":").concat(v.viewerWidth, ":").concat(v.viewerHeight, ":").concat(v.SVGWidth, ":").concat(v.SVGHeight);
|
|
391
|
+
if (this._cachedViewer2DKey === cacheKey && this._cachedExtractedState) {
|
|
392
|
+
return this._cachedExtractedState;
|
|
393
|
+
}
|
|
394
|
+
var centeredViewer2D = _viewer2D.merge({
|
|
395
|
+
e: v.viewerWidth / 2 - v.SVGWidth / 2,
|
|
396
|
+
f: v.viewerHeight / 2 - v.SVGHeight / 2,
|
|
397
|
+
a: 0.99,
|
|
398
|
+
d: 0.99
|
|
399
|
+
});
|
|
400
|
+
var merged = extractedState.merge({
|
|
401
|
+
viewer2D: centeredViewer2D
|
|
402
|
+
});
|
|
403
|
+
this._cachedViewer2DKey = cacheKey;
|
|
404
|
+
this._cachedExtractedState = merged;
|
|
405
|
+
return merged;
|
|
406
|
+
}
|
|
519
407
|
}, {
|
|
520
408
|
key: "render",
|
|
521
409
|
value: function render() {
|
|
522
|
-
var _this$
|
|
523
|
-
width = _this$
|
|
524
|
-
height = _this$
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
props = _objectWithoutProperties(_this$props5, _excluded);
|
|
410
|
+
var _this$props3 = this.props,
|
|
411
|
+
width = _this$props3.width,
|
|
412
|
+
height = _this$props3.height,
|
|
413
|
+
extractedState = _this$props3.extractedState,
|
|
414
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
528
415
|
var _this$state = this.state,
|
|
529
416
|
savePopupVisible = _this$state.savePopupVisible,
|
|
530
417
|
quotePopupVisible = _this$state.quotePopupVisible,
|
|
@@ -532,74 +419,22 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
532
419
|
signOpen = _this$state.signOpen,
|
|
533
420
|
myProjectsOpen = _this$state.myProjectsOpen;
|
|
534
421
|
var contentW = width - toolbarW;
|
|
535
|
-
var categoryData = this.props.categoryData;
|
|
536
|
-
// console.log(categoryData);
|
|
537
|
-
// let contentW = width - toolbarW - sidebarW;
|
|
538
|
-
// let toolbarH = height - footerBarH;
|
|
539
|
-
// let contentH = height - footerBarH;
|
|
540
|
-
// let sidebarH = height - footerBarH;
|
|
541
|
-
var toolbarH = height;
|
|
542
422
|
var contentH = height;
|
|
543
|
-
var
|
|
544
|
-
var
|
|
545
|
-
var headerH = 60;
|
|
546
|
-
var extractedState = stateExtractor(state);
|
|
547
|
-
var doorStyle = extractedState.get('doorStyle');
|
|
548
|
-
if (extractedState.getIn(['scene', 'layers', extractedState.scene.selectedLayer, 'doorStyle']) !== undefined && extractedState.getIn(['scene', 'layers', extractedState.scene.selectedLayer, 'doorStyle']) !== null) {
|
|
549
|
-
var extractedStateData = extractedState.getIn(['scene', 'layers', extractedState.scene.selectedLayer, 'doorStyle']);
|
|
550
|
-
var doorIdAvailable = false;
|
|
551
|
-
if (this.props.categoryData.doorStyles && this.props.categoryData.doorStyles.items) {
|
|
552
|
-
this.props.categoryData.doorStyles.items.find(function (category) {
|
|
553
|
-
doorIdAvailable = category.items.find(function (style) {
|
|
554
|
-
var item = style.items.find(function (it) {
|
|
555
|
-
return it.id === extractedStateData.id;
|
|
556
|
-
});
|
|
557
|
-
if (item) {
|
|
558
|
-
colorItem = item;
|
|
559
|
-
return true;
|
|
560
|
-
} else {
|
|
561
|
-
return false;
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
if (doorIdAvailable) doorStyle = extractedStateData;
|
|
567
|
-
}
|
|
568
|
-
var firstVisit = this.state.wizardStepOpend && this.isProjectEmpty(extractedState.scene);
|
|
423
|
+
var extracted = this.getExtractedStateWithViewer2DInit(extractedState, width, height);
|
|
424
|
+
var firstVisit = this.state.wizardStepOpend && this.isProjectEmpty(extracted.scene);
|
|
569
425
|
var allVisible = firstVisit || signOpen || myProjectsOpen;
|
|
570
|
-
var _scene = extractedState.getIn(['scene']);
|
|
571
|
-
var len = convert(_scene.width).from(_scene.unit).to('cm');
|
|
572
|
-
var _viewer2D = extractedState.getIn(['viewer2D']);
|
|
573
|
-
if (_viewer2D.size > 0) {
|
|
574
|
-
var scaleX = width / len * 3;
|
|
575
|
-
var scaleY = height / len * 3;
|
|
576
|
-
var scale = scaleX > scaleY ? scaleY : scaleX;
|
|
577
|
-
var _e = width - len * scale,
|
|
578
|
-
_f = height - len * scale;
|
|
579
|
-
var viewer = _viewer2D.toJS();
|
|
580
|
-
if (viewer.e === 0 && viewer.f === 0) {
|
|
581
|
-
_viewer2D = _viewer2D.merge({
|
|
582
|
-
e: viewer.viewerWidth / 2 - viewer.SVGWidth / 2,
|
|
583
|
-
f: viewer.viewerHeight / 2 - viewer.SVGHeight / 2,
|
|
584
|
-
a: 0.99,
|
|
585
|
-
d: 0.99
|
|
586
|
-
});
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
extractedState = extractedState.merge({
|
|
590
|
-
viewer2D: _viewer2D
|
|
591
|
-
});
|
|
592
426
|
return /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement("div", {
|
|
593
427
|
style: _objectSpread(_objectSpread({}, wrapperStyle), {}, {
|
|
594
428
|
height: height,
|
|
595
429
|
display: 'flex',
|
|
596
|
-
justifyContent: 'center'
|
|
430
|
+
justifyContent: 'center',
|
|
431
|
+
position: 'relative'
|
|
597
432
|
})
|
|
598
433
|
}, /*#__PURE__*/React.createElement(Content, _extends({
|
|
599
434
|
width: contentW,
|
|
600
435
|
height: contentH,
|
|
601
436
|
catalog: this.props.catalog,
|
|
602
|
-
state:
|
|
437
|
+
state: extracted,
|
|
603
438
|
toolBar: this.state.toolbar,
|
|
604
439
|
setToolbar: this.setToolbar,
|
|
605
440
|
replaceCabinet: this.replaceCabinet,
|
|
@@ -607,8 +442,22 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
607
442
|
}, props, {
|
|
608
443
|
onWheel: function onWheel(event) {
|
|
609
444
|
return event.preventDefault();
|
|
445
|
+
},
|
|
446
|
+
onInternalEvent: this.props.onInternalEvent
|
|
447
|
+
})), /*#__PURE__*/React.createElement(WarningItem, {
|
|
448
|
+
id: "warning_box_2d",
|
|
449
|
+
style: {
|
|
450
|
+
display: 'none'
|
|
451
|
+
}
|
|
452
|
+
}, /*#__PURE__*/React.createElement(SubCategoryItemImage, {
|
|
453
|
+
maskImage: "/assets/img/svg/3d_item_warning_info.svg",
|
|
454
|
+
style: {
|
|
455
|
+
backgroundColor: constants.BG_COLOR_1,
|
|
456
|
+
marginRight: 10,
|
|
457
|
+
height: 30,
|
|
458
|
+
width: 30
|
|
610
459
|
}
|
|
611
|
-
}))));
|
|
460
|
+
}), "This item is not available in the current door style. Replace it with another one.")));
|
|
612
461
|
}
|
|
613
462
|
}]);
|
|
614
463
|
}(Component);
|
|
@@ -622,13 +471,11 @@ LiteKitchenConfigurator.propTypes = {
|
|
|
622
471
|
width: PropTypes.number.isRequired,
|
|
623
472
|
height: PropTypes.number.isRequired,
|
|
624
473
|
stateExtractor: PropTypes.func.isRequired,
|
|
625
|
-
sidebarComponents: PropTypes.array,
|
|
626
|
-
footerbarComponents: PropTypes.array,
|
|
627
|
-
customContents: PropTypes.object,
|
|
628
|
-
softwareSignature: PropTypes.string,
|
|
629
474
|
configData: PropTypes.object,
|
|
630
|
-
|
|
631
|
-
|
|
475
|
+
onInternalEvent: PropTypes.func,
|
|
476
|
+
extractedState: PropTypes.object,
|
|
477
|
+
// ✅ injected by connect
|
|
478
|
+
externalEvent: PropTypes.object
|
|
632
479
|
};
|
|
633
480
|
LiteKitchenConfigurator.contextTypes = {
|
|
634
481
|
store: PropTypes.object.isRequired
|
|
@@ -651,10 +498,16 @@ LiteKitchenConfigurator.defaultProps = {
|
|
|
651
498
|
configData: {}
|
|
652
499
|
};
|
|
653
500
|
|
|
654
|
-
//
|
|
655
|
-
|
|
501
|
+
// ✅ Only select the slice you actually use.
|
|
502
|
+
// This preserves behavior but massively reduces rerenders.
|
|
503
|
+
function mapStateToProps(reduxState, ownProps) {
|
|
504
|
+
var stateExtractor = ownProps.stateExtractor || function (s) {
|
|
505
|
+
return s;
|
|
506
|
+
};
|
|
507
|
+
var extractedState = stateExtractor(reduxState);
|
|
656
508
|
return {
|
|
657
|
-
|
|
509
|
+
extractedState: extractedState,
|
|
510
|
+
state: extractedState
|
|
658
511
|
};
|
|
659
512
|
}
|
|
660
513
|
function mapDispatchToProps(dispatch) {
|