kitchen-simulator 3.16.0 → 3.16.1-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 +106 -97
- package/es/LiteRenderer.js +156 -130
- package/es/utils/isolate-event-handler.js +265 -210
- package/lib/LiteKitchenConfigurator.js +106 -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,12 @@ 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._cachedViewer2DKey = null;
|
|
126
|
+
_this._cachedExtractedState = null;
|
|
127
127
|
return _this;
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
// Toolbar control functions
|
|
131
129
|
_inherits(LiteKitchenConfigurator, _Component);
|
|
132
130
|
return _createClass(LiteKitchenConfigurator, [{
|
|
133
131
|
key: "setToolbar",
|
|
@@ -211,26 +209,32 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
211
209
|
}, {
|
|
212
210
|
key: "openFloor",
|
|
213
211
|
value: function openFloor() {
|
|
212
|
+
var _el$parentElement;
|
|
214
213
|
this.setState({
|
|
215
214
|
floorOpened: true
|
|
216
215
|
});
|
|
217
|
-
document.getElementById('make_floorplan_inactive')
|
|
216
|
+
var el = document.getElementById('make_floorplan_inactive');
|
|
217
|
+
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
218
|
}
|
|
219
219
|
}, {
|
|
220
220
|
key: "openCabinet",
|
|
221
221
|
value: function openCabinet() {
|
|
222
|
+
var _el$parentElement2;
|
|
222
223
|
this.setState({
|
|
223
224
|
cabinetOpened: true
|
|
224
225
|
});
|
|
225
|
-
document.getElementById('add_cabinets_inactive')
|
|
226
|
+
var el = document.getElementById('add_cabinets_inactive');
|
|
227
|
+
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
228
|
}
|
|
227
229
|
}, {
|
|
228
230
|
key: "toggleDoorStyle",
|
|
229
231
|
value: function toggleDoorStyle(visible) {
|
|
232
|
+
var _el$parentElement3;
|
|
230
233
|
this.setState({
|
|
231
234
|
doorStyleOpen: visible
|
|
232
235
|
});
|
|
233
|
-
document.getElementById('select_doorstyle_inactive')
|
|
236
|
+
var el = document.getElementById('select_doorstyle_inactive');
|
|
237
|
+
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
238
|
}
|
|
235
239
|
}, {
|
|
236
240
|
key: "replaceCabinet",
|
|
@@ -242,70 +246,72 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
242
246
|
}, {
|
|
243
247
|
key: "openAppliance",
|
|
244
248
|
value: function openAppliance() {
|
|
249
|
+
var _el$parentElement4;
|
|
245
250
|
this.setState({
|
|
246
251
|
applianceOpened: true
|
|
247
252
|
});
|
|
248
|
-
document.getElementById('add_appliances_inactive')
|
|
253
|
+
var el = document.getElementById('add_appliances_inactive');
|
|
254
|
+
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
255
|
}
|
|
250
256
|
}, {
|
|
251
257
|
key: "openFinishing",
|
|
252
258
|
value: function openFinishing() {
|
|
259
|
+
var _el$parentElement5;
|
|
253
260
|
this.setState({
|
|
254
261
|
finishingOpened: true
|
|
255
262
|
});
|
|
256
|
-
document.getElementById('finishing_touches_inactive')
|
|
263
|
+
var el = document.getElementById('finishing_touches_inactive');
|
|
264
|
+
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
265
|
}
|
|
258
266
|
}, {
|
|
259
267
|
key: "onReviewQuoteClicked",
|
|
260
268
|
value: function onReviewQuoteClicked(visible) {
|
|
269
|
+
var _el$parentElement6;
|
|
261
270
|
this.setState({
|
|
262
271
|
reviewQuotePopupOpened: visible
|
|
263
272
|
});
|
|
264
|
-
document.getElementById('review_quote_inactive')
|
|
273
|
+
var el = document.getElementById('review_quote_inactive');
|
|
274
|
+
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
275
|
}
|
|
266
276
|
}, {
|
|
267
277
|
key: "closeFloorTB",
|
|
268
278
|
value: function closeFloorTB() {
|
|
279
|
+
var _el$parentElement7;
|
|
269
280
|
this.setState({
|
|
270
281
|
floorOpened: false
|
|
271
282
|
});
|
|
272
|
-
|
|
283
|
+
var el = document.getElementById('make_floorplan_inactive');
|
|
284
|
+
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
285
|
}
|
|
274
286
|
}, {
|
|
275
287
|
key: "closeCabinetTB",
|
|
276
288
|
value: function closeCabinetTB() {
|
|
289
|
+
var _el$parentElement8;
|
|
277
290
|
this.setState({
|
|
278
291
|
cabinetOpened: false
|
|
279
292
|
});
|
|
280
|
-
document.getElementById('add_cabinets_inactive')
|
|
293
|
+
var el = document.getElementById('add_cabinets_inactive');
|
|
294
|
+
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
295
|
}
|
|
282
296
|
}, {
|
|
283
297
|
key: "closeFinishingTB",
|
|
284
298
|
value: function closeFinishingTB() {
|
|
299
|
+
var _el$parentElement9;
|
|
285
300
|
this.setState({
|
|
286
301
|
finishingOpened: false
|
|
287
302
|
});
|
|
288
|
-
document.getElementById('finishing_touches_inactive')
|
|
303
|
+
var el = document.getElementById('finishing_touches_inactive');
|
|
304
|
+
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
305
|
}
|
|
290
306
|
}, {
|
|
291
307
|
key: "closeApplianceTB",
|
|
292
308
|
value: function closeApplianceTB() {
|
|
309
|
+
var _el$parentElement0;
|
|
293
310
|
this.setState({
|
|
294
311
|
applianceOpened: false
|
|
295
312
|
});
|
|
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;
|
|
313
|
+
var el = document.getElementById('add_appliances_inactive');
|
|
314
|
+
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
315
|
}
|
|
310
316
|
}, {
|
|
311
317
|
key: "getChildContext",
|
|
@@ -321,36 +327,36 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
321
327
|
}, {
|
|
322
328
|
key: "componentDidMount",
|
|
323
329
|
value: function componentDidMount() {
|
|
324
|
-
console.log('context =>', this.context);
|
|
325
330
|
window.forRedo = [];
|
|
326
331
|
var store = this.context.store;
|
|
327
332
|
var _this$props = this.props,
|
|
328
333
|
stateExtractor = _this$props.stateExtractor,
|
|
329
334
|
plugins = _this$props.plugins;
|
|
335
|
+
|
|
336
|
+
// keep old behavior: run plugins once on mount
|
|
330
337
|
var newplugins = _toConsumableArray(plugins);
|
|
331
338
|
newplugins.forEach(function (newplugin) {
|
|
332
339
|
return newplugin(store, stateExtractor);
|
|
333
340
|
});
|
|
334
341
|
}
|
|
335
342
|
}, {
|
|
336
|
-
key: "
|
|
337
|
-
value: function
|
|
338
|
-
var
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
343
|
+
key: "componentDidUpdate",
|
|
344
|
+
value: function componentDidUpdate(prevProps) {
|
|
345
|
+
var _extractedState$getIn;
|
|
346
|
+
var _this$props2 = this.props,
|
|
347
|
+
externalEvent = _this$props2.externalEvent,
|
|
348
|
+
extractedState = _this$props2.extractedState,
|
|
349
|
+
projectActions = _this$props2.projectActions,
|
|
350
|
+
catalog = _this$props2.catalog;
|
|
344
351
|
|
|
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);
|
|
352
|
+
// same behavior: handle external event when it changes
|
|
353
|
+
if (prevProps.externalEvent !== externalEvent) {
|
|
354
|
+
handleExternalEvent(this.props);
|
|
353
355
|
}
|
|
356
|
+
|
|
357
|
+
// same behavior: init catalog until ready
|
|
358
|
+
var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn = extractedState.getIn) === null || _extractedState$getIn === void 0 ? void 0 : _extractedState$getIn.call(extractedState, ['catalog', 'ready']);
|
|
359
|
+
if (!catalogReady) projectActions.initCatalog(catalog);
|
|
354
360
|
}
|
|
355
361
|
}, {
|
|
356
362
|
key: "isProjectEmpty",
|
|
@@ -360,16 +366,45 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
360
366
|
var layer = layers.get(selectedLayer);
|
|
361
367
|
return layer.areas.size + layer.lines.size + layer.holes.size + layer.items.size === 0;
|
|
362
368
|
}
|
|
369
|
+
}, {
|
|
370
|
+
key: "getExtractedStateWithViewer2DInit",
|
|
371
|
+
value: function getExtractedStateWithViewer2DInit(extractedState, width, height) {
|
|
372
|
+
if (!extractedState) return extractedState;
|
|
373
|
+
var _scene = extractedState.getIn(['scene']);
|
|
374
|
+
var len = convert(_scene.width).from(_scene.unit).to('cm');
|
|
375
|
+
var _viewer2D = extractedState.getIn(['viewer2D']);
|
|
376
|
+
if (!_viewer2D || _viewer2D.size <= 0) return extractedState;
|
|
377
|
+
var v = _viewer2D.toJS();
|
|
378
|
+
var cacheKey = "".concat(width, ":").concat(height, ":").concat(len, ":").concat(v.e, ":").concat(v.f, ":").concat(v.viewerWidth, ":").concat(v.viewerHeight, ":").concat(v.SVGWidth, ":").concat(v.SVGHeight, ":").concat(v.a, ":").concat(v.d);
|
|
379
|
+
if (this._cachedViewer2DKey === cacheKey && this._cachedExtractedState) {
|
|
380
|
+
return this._cachedExtractedState;
|
|
381
|
+
}
|
|
382
|
+
if (v.e === 0 && v.f === 0) {
|
|
383
|
+
_viewer2D = _viewer2D.merge({
|
|
384
|
+
e: v.viewerWidth / 2 - v.SVGWidth / 2,
|
|
385
|
+
f: v.viewerHeight / 2 - v.SVGHeight / 2,
|
|
386
|
+
a: 0.99,
|
|
387
|
+
d: 0.99
|
|
388
|
+
});
|
|
389
|
+
var merged = extractedState.merge({
|
|
390
|
+
viewer2D: _viewer2D
|
|
391
|
+
});
|
|
392
|
+
this._cachedViewer2DKey = cacheKey;
|
|
393
|
+
this._cachedExtractedState = merged;
|
|
394
|
+
return merged;
|
|
395
|
+
}
|
|
396
|
+
this._cachedViewer2DKey = cacheKey;
|
|
397
|
+
this._cachedExtractedState = extractedState;
|
|
398
|
+
return extractedState;
|
|
399
|
+
}
|
|
363
400
|
}, {
|
|
364
401
|
key: "render",
|
|
365
402
|
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);
|
|
403
|
+
var _this$props3 = this.props,
|
|
404
|
+
width = _this$props3.width,
|
|
405
|
+
height = _this$props3.height,
|
|
406
|
+
extractedState = _this$props3.extractedState,
|
|
407
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
373
408
|
var _this$state = this.state,
|
|
374
409
|
savePopupVisible = _this$state.savePopupVisible,
|
|
375
410
|
quotePopupVisible = _this$state.quotePopupVisible,
|
|
@@ -377,40 +412,10 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
377
412
|
signOpen = _this$state.signOpen,
|
|
378
413
|
myProjectsOpen = _this$state.myProjectsOpen;
|
|
379
414
|
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
415
|
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);
|
|
416
|
+
var extracted = this.getExtractedStateWithViewer2DInit(extractedState, width, height);
|
|
417
|
+
var firstVisit = this.state.wizardStepOpend && this.isProjectEmpty(extracted.scene);
|
|
391
418
|
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
419
|
return /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement("div", {
|
|
415
420
|
style: _objectSpread(_objectSpread({}, wrapperStyle), {}, {
|
|
416
421
|
height: height,
|
|
@@ -422,7 +427,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
422
427
|
width: contentW,
|
|
423
428
|
height: contentH,
|
|
424
429
|
catalog: this.props.catalog,
|
|
425
|
-
state:
|
|
430
|
+
state: extracted,
|
|
426
431
|
toolBar: this.state.toolbar,
|
|
427
432
|
setToolbar: this.setToolbar,
|
|
428
433
|
replaceCabinet: this.replaceCabinet,
|
|
@@ -459,12 +464,11 @@ LiteKitchenConfigurator.propTypes = {
|
|
|
459
464
|
width: PropTypes.number.isRequired,
|
|
460
465
|
height: PropTypes.number.isRequired,
|
|
461
466
|
stateExtractor: PropTypes.func.isRequired,
|
|
462
|
-
sidebarComponents: PropTypes.array,
|
|
463
|
-
footerbarComponents: PropTypes.array,
|
|
464
|
-
customContents: PropTypes.object,
|
|
465
|
-
softwareSignature: PropTypes.string,
|
|
466
467
|
configData: PropTypes.object,
|
|
467
|
-
onInternalEvent: PropTypes.func
|
|
468
|
+
onInternalEvent: PropTypes.func,
|
|
469
|
+
extractedState: PropTypes.object,
|
|
470
|
+
// ✅ injected by connect
|
|
471
|
+
externalEvent: PropTypes.object
|
|
468
472
|
};
|
|
469
473
|
LiteKitchenConfigurator.contextTypes = {
|
|
470
474
|
store: PropTypes.object.isRequired
|
|
@@ -487,10 +491,15 @@ LiteKitchenConfigurator.defaultProps = {
|
|
|
487
491
|
configData: {}
|
|
488
492
|
};
|
|
489
493
|
|
|
490
|
-
//
|
|
491
|
-
|
|
494
|
+
// ✅ Only select the slice you actually use.
|
|
495
|
+
// This preserves behavior but massively reduces rerenders.
|
|
496
|
+
function mapStateToProps(reduxState, ownProps) {
|
|
497
|
+
var stateExtractor = ownProps.stateExtractor || function (s) {
|
|
498
|
+
return s;
|
|
499
|
+
};
|
|
500
|
+
var extractedState = stateExtractor(reduxState);
|
|
492
501
|
return {
|
|
493
|
-
|
|
502
|
+
extractedState: extractedState
|
|
494
503
|
};
|
|
495
504
|
}
|
|
496
505
|
function mapDispatchToProps(dispatch) {
|