kitchen-simulator 3.16.0 → 3.16.2-test-renderer-fix
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 +114 -97
- package/es/LiteRenderer.js +156 -130
- package/es/utils/isolate-event-handler.js +265 -210
- package/lib/LiteKitchenConfigurator.js +114 -98
- package/lib/LiteRenderer.js +155 -130
- package/lib/utils/isolate-event-handler.js +266 -210
- package/package.json +1 -1
|
@@ -8,12 +8,13 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
9
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
10
10
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
11
|
-
var _excluded = ["width", "height", "
|
|
11
|
+
var _excluded = ["width", "height", "extractedState"];
|
|
12
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
|
+
// LiteKitchenConfigurator.jsx
|
|
17
18
|
import styled from 'styled-components';
|
|
18
19
|
import { convert } from "./utils/convert-units-lite";
|
|
19
20
|
import PropTypes from 'prop-types';
|
|
@@ -34,7 +35,7 @@ var wrapperStyle = {
|
|
|
34
35
|
display: 'flex',
|
|
35
36
|
flexFlow: 'row nowrap'
|
|
36
37
|
};
|
|
37
|
-
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
|
|
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"])));
|
|
38
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) {
|
|
39
40
|
return props.maskImage + '?nocache=2025';
|
|
40
41
|
});
|
|
@@ -44,8 +45,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
44
45
|
var _this;
|
|
45
46
|
_classCallCheck(this, LiteKitchenConfigurator);
|
|
46
47
|
_this = _callSuper(this, LiteKitchenConfigurator, [props]);
|
|
47
|
-
|
|
48
|
-
// utm tracking
|
|
49
48
|
var utmDetailParams = new URLSearchParams(_this.props.location && _this.props.location.search);
|
|
50
49
|
var utmStrEncoded = utmDetailParams.get('details');
|
|
51
50
|
var utmRequestData = null;
|
|
@@ -55,7 +54,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
55
54
|
utmRequestData = JSON.parse(base64Decode(utmStrEncoded));
|
|
56
55
|
utmRequestData = JSON.parse((_utmRequestData = utmRequestData) === null || _utmRequestData === void 0 ? void 0 : _utmRequestData.utm);
|
|
57
56
|
} catch (e) {
|
|
58
|
-
console.error('Cannot parse utm parameter: ',
|
|
57
|
+
console.error('Cannot parse utm parameter: ', e);
|
|
59
58
|
utmRequestData = null;
|
|
60
59
|
}
|
|
61
60
|
}
|
|
@@ -74,7 +73,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
74
73
|
myProjectsOpen: false,
|
|
75
74
|
myProjectsToLogin: false,
|
|
76
75
|
downloadPopupVisible: false,
|
|
77
|
-
// For Toolbar Item
|
|
78
76
|
toolbar: '',
|
|
79
77
|
reviewQuotePopupOpened: false,
|
|
80
78
|
floorOpened: false,
|
|
@@ -92,8 +90,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
92
90
|
isSaved: false,
|
|
93
91
|
isLeaving: false
|
|
94
92
|
};
|
|
95
|
-
|
|
96
|
-
// For UTM tracking
|
|
97
93
|
_this.utm = {
|
|
98
94
|
utm_source: ((_utmRequestData2 = utmRequestData) === null || _utmRequestData2 === void 0 ? void 0 : _utmRequestData2.source) || 'source',
|
|
99
95
|
utm_medium: ((_utmRequestData3 = utmRequestData) === null || _utmRequestData3 === void 0 ? void 0 : _utmRequestData3.medium) || 'medium',
|
|
@@ -124,10 +120,13 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
124
120
|
_this.setDownloadPopupVisible = _this.setDownloadPopupVisible.bind(_this);
|
|
125
121
|
_this.neverShowInput = /*#__PURE__*/React.createRef(null);
|
|
126
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;
|
|
127
128
|
return _this;
|
|
128
129
|
}
|
|
129
|
-
|
|
130
|
-
// Toolbar control functions
|
|
131
130
|
_inherits(LiteKitchenConfigurator, _Component);
|
|
132
131
|
return _createClass(LiteKitchenConfigurator, [{
|
|
133
132
|
key: "setToolbar",
|
|
@@ -211,26 +210,32 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
211
210
|
}, {
|
|
212
211
|
key: "openFloor",
|
|
213
212
|
value: function openFloor() {
|
|
213
|
+
var _el$parentElement;
|
|
214
214
|
this.setState({
|
|
215
215
|
floorOpened: true
|
|
216
216
|
});
|
|
217
|
-
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;
|
|
218
219
|
}
|
|
219
220
|
}, {
|
|
220
221
|
key: "openCabinet",
|
|
221
222
|
value: function openCabinet() {
|
|
223
|
+
var _el$parentElement2;
|
|
222
224
|
this.setState({
|
|
223
225
|
cabinetOpened: true
|
|
224
226
|
});
|
|
225
|
-
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;
|
|
226
229
|
}
|
|
227
230
|
}, {
|
|
228
231
|
key: "toggleDoorStyle",
|
|
229
232
|
value: function toggleDoorStyle(visible) {
|
|
233
|
+
var _el$parentElement3;
|
|
230
234
|
this.setState({
|
|
231
235
|
doorStyleOpen: visible
|
|
232
236
|
});
|
|
233
|
-
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;
|
|
234
239
|
}
|
|
235
240
|
}, {
|
|
236
241
|
key: "replaceCabinet",
|
|
@@ -242,70 +247,72 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
242
247
|
}, {
|
|
243
248
|
key: "openAppliance",
|
|
244
249
|
value: function openAppliance() {
|
|
250
|
+
var _el$parentElement4;
|
|
245
251
|
this.setState({
|
|
246
252
|
applianceOpened: true
|
|
247
253
|
});
|
|
248
|
-
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;
|
|
249
256
|
}
|
|
250
257
|
}, {
|
|
251
258
|
key: "openFinishing",
|
|
252
259
|
value: function openFinishing() {
|
|
260
|
+
var _el$parentElement5;
|
|
253
261
|
this.setState({
|
|
254
262
|
finishingOpened: true
|
|
255
263
|
});
|
|
256
|
-
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;
|
|
257
266
|
}
|
|
258
267
|
}, {
|
|
259
268
|
key: "onReviewQuoteClicked",
|
|
260
269
|
value: function onReviewQuoteClicked(visible) {
|
|
270
|
+
var _el$parentElement6;
|
|
261
271
|
this.setState({
|
|
262
272
|
reviewQuotePopupOpened: visible
|
|
263
273
|
});
|
|
264
|
-
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;
|
|
265
276
|
}
|
|
266
277
|
}, {
|
|
267
278
|
key: "closeFloorTB",
|
|
268
279
|
value: function closeFloorTB() {
|
|
280
|
+
var _el$parentElement7;
|
|
269
281
|
this.setState({
|
|
270
282
|
floorOpened: false
|
|
271
283
|
});
|
|
272
|
-
|
|
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;
|
|
273
286
|
}
|
|
274
287
|
}, {
|
|
275
288
|
key: "closeCabinetTB",
|
|
276
289
|
value: function closeCabinetTB() {
|
|
290
|
+
var _el$parentElement8;
|
|
277
291
|
this.setState({
|
|
278
292
|
cabinetOpened: false
|
|
279
293
|
});
|
|
280
|
-
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;
|
|
281
296
|
}
|
|
282
297
|
}, {
|
|
283
298
|
key: "closeFinishingTB",
|
|
284
299
|
value: function closeFinishingTB() {
|
|
300
|
+
var _el$parentElement9;
|
|
285
301
|
this.setState({
|
|
286
302
|
finishingOpened: false
|
|
287
303
|
});
|
|
288
|
-
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;
|
|
289
306
|
}
|
|
290
307
|
}, {
|
|
291
308
|
key: "closeApplianceTB",
|
|
292
309
|
value: function closeApplianceTB() {
|
|
310
|
+
var _el$parentElement0;
|
|
293
311
|
this.setState({
|
|
294
312
|
applianceOpened: false
|
|
295
313
|
});
|
|
296
|
-
document.getElementById('add_appliances_inactive')
|
|
297
|
-
|
|
298
|
-
}, {
|
|
299
|
-
key: "closeDoorstyle",
|
|
300
|
-
value: function closeDoorstyle() {
|
|
301
|
-
this.setState({});
|
|
302
|
-
document.getElementById('select_doorstyle_inactive').parentElement.parentElement.style.zIndex = 6;
|
|
303
|
-
}
|
|
304
|
-
}, {
|
|
305
|
-
key: "closeReviewQuote",
|
|
306
|
-
value: function closeReviewQuote() {
|
|
307
|
-
this.setState({});
|
|
308
|
-
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;
|
|
309
316
|
}
|
|
310
317
|
}, {
|
|
311
318
|
key: "getChildContext",
|
|
@@ -321,36 +328,36 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
321
328
|
}, {
|
|
322
329
|
key: "componentDidMount",
|
|
323
330
|
value: function componentDidMount() {
|
|
324
|
-
console.log('context =>', this.context);
|
|
325
331
|
window.forRedo = [];
|
|
326
332
|
var store = this.context.store;
|
|
327
333
|
var _this$props = this.props,
|
|
328
334
|
stateExtractor = _this$props.stateExtractor,
|
|
329
335
|
plugins = _this$props.plugins;
|
|
336
|
+
|
|
337
|
+
// keep old behavior: run plugins once on mount
|
|
330
338
|
var newplugins = _toConsumableArray(plugins);
|
|
331
339
|
newplugins.forEach(function (newplugin) {
|
|
332
340
|
return newplugin(store, stateExtractor);
|
|
333
341
|
});
|
|
334
342
|
}
|
|
335
343
|
}, {
|
|
336
|
-
key: "
|
|
337
|
-
value: function
|
|
338
|
-
var
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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;
|
|
344
352
|
|
|
345
|
-
// handle external
|
|
346
|
-
if (
|
|
347
|
-
handleExternalEvent(
|
|
348
|
-
}
|
|
349
|
-
var plannerState = stateExtractor(state);
|
|
350
|
-
var catalogReady = plannerState.getIn(['catalog', 'ready']);
|
|
351
|
-
if (!catalogReady) {
|
|
352
|
-
projectActions.initCatalog(catalog);
|
|
353
|
+
// same behavior: handle external event when it changes
|
|
354
|
+
if (prevProps.externalEvent !== externalEvent) {
|
|
355
|
+
handleExternalEvent(this.props);
|
|
353
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);
|
|
354
361
|
}
|
|
355
362
|
}, {
|
|
356
363
|
key: "isProjectEmpty",
|
|
@@ -360,16 +367,51 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
360
367
|
var layer = layers.get(selectedLayer);
|
|
361
368
|
return layer.areas.size + layer.lines.size + layer.holes.size + layer.items.size === 0;
|
|
362
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
|
+
}
|
|
363
407
|
}, {
|
|
364
408
|
key: "render",
|
|
365
409
|
value: function render() {
|
|
366
|
-
var _this$
|
|
367
|
-
width = _this$
|
|
368
|
-
height = _this$
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
measurementUnit = _this$props2.measurementUnit,
|
|
372
|
-
props = _objectWithoutProperties(_this$props2, _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);
|
|
373
415
|
var _this$state = this.state,
|
|
374
416
|
savePopupVisible = _this$state.savePopupVisible,
|
|
375
417
|
quotePopupVisible = _this$state.quotePopupVisible,
|
|
@@ -377,40 +419,10 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
377
419
|
signOpen = _this$state.signOpen,
|
|
378
420
|
myProjectsOpen = _this$state.myProjectsOpen;
|
|
379
421
|
var contentW = width - toolbarW;
|
|
380
|
-
// let contentW = width - toolbarW - sidebarW;
|
|
381
|
-
// let toolbarH = height - footerBarH;
|
|
382
|
-
// let contentH = height - footerBarH;
|
|
383
|
-
// let sidebarH = height - footerBarH;
|
|
384
|
-
var toolbarH = height;
|
|
385
422
|
var contentH = height;
|
|
386
|
-
var
|
|
387
|
-
var
|
|
388
|
-
var headerH = 60;
|
|
389
|
-
var extractedState = stateExtractor(state);
|
|
390
|
-
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);
|
|
391
425
|
var allVisible = firstVisit || signOpen || myProjectsOpen;
|
|
392
|
-
var _scene = extractedState.getIn(['scene']);
|
|
393
|
-
var len = convert(_scene.width).from(_scene.unit).to('cm');
|
|
394
|
-
var _viewer2D = extractedState.getIn(['viewer2D']);
|
|
395
|
-
if (_viewer2D.size > 0) {
|
|
396
|
-
var scaleX = width / len * 3;
|
|
397
|
-
var scaleY = height / len * 3;
|
|
398
|
-
var scale = scaleX > scaleY ? scaleY : scaleX;
|
|
399
|
-
var _e = width - len * scale,
|
|
400
|
-
_f = height - len * scale;
|
|
401
|
-
var viewer = _viewer2D.toJS();
|
|
402
|
-
if (viewer.e === 0 && viewer.f === 0) {
|
|
403
|
-
_viewer2D = _viewer2D.merge({
|
|
404
|
-
e: viewer.viewerWidth / 2 - viewer.SVGWidth / 2,
|
|
405
|
-
f: viewer.viewerHeight / 2 - viewer.SVGHeight / 2,
|
|
406
|
-
a: 0.99,
|
|
407
|
-
d: 0.99
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
extractedState = extractedState.merge({
|
|
412
|
-
viewer2D: _viewer2D
|
|
413
|
-
});
|
|
414
426
|
return /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement("div", {
|
|
415
427
|
style: _objectSpread(_objectSpread({}, wrapperStyle), {}, {
|
|
416
428
|
height: height,
|
|
@@ -422,7 +434,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
422
434
|
width: contentW,
|
|
423
435
|
height: contentH,
|
|
424
436
|
catalog: this.props.catalog,
|
|
425
|
-
state:
|
|
437
|
+
state: extracted,
|
|
426
438
|
toolBar: this.state.toolbar,
|
|
427
439
|
setToolbar: this.setToolbar,
|
|
428
440
|
replaceCabinet: this.replaceCabinet,
|
|
@@ -459,12 +471,11 @@ LiteKitchenConfigurator.propTypes = {
|
|
|
459
471
|
width: PropTypes.number.isRequired,
|
|
460
472
|
height: PropTypes.number.isRequired,
|
|
461
473
|
stateExtractor: PropTypes.func.isRequired,
|
|
462
|
-
sidebarComponents: PropTypes.array,
|
|
463
|
-
footerbarComponents: PropTypes.array,
|
|
464
|
-
customContents: PropTypes.object,
|
|
465
|
-
softwareSignature: PropTypes.string,
|
|
466
474
|
configData: PropTypes.object,
|
|
467
|
-
onInternalEvent: PropTypes.func
|
|
475
|
+
onInternalEvent: PropTypes.func,
|
|
476
|
+
extractedState: PropTypes.object,
|
|
477
|
+
// ✅ injected by connect
|
|
478
|
+
externalEvent: PropTypes.object
|
|
468
479
|
};
|
|
469
480
|
LiteKitchenConfigurator.contextTypes = {
|
|
470
481
|
store: PropTypes.object.isRequired
|
|
@@ -487,10 +498,16 @@ LiteKitchenConfigurator.defaultProps = {
|
|
|
487
498
|
configData: {}
|
|
488
499
|
};
|
|
489
500
|
|
|
490
|
-
//
|
|
491
|
-
|
|
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);
|
|
492
508
|
return {
|
|
493
|
-
|
|
509
|
+
extractedState: extractedState,
|
|
510
|
+
state: extractedState
|
|
494
511
|
};
|
|
495
512
|
}
|
|
496
513
|
function mapDispatchToProps(dispatch) {
|