kitchen-simulator 1.0.0-alin.33 → 1.0.0-alin.40
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 +13 -2
- package/es/LiteRenderer.js +13 -105
- package/es/catalog/catalog.js +4 -1
- package/es/components/viewer2d/item.js +5 -9
- package/es/devLiteRenderer.js +1 -1
- package/es/utils/geometry.js +6 -6
- package/es/utils/isolate-event-handler.js +0 -2
- package/lib/LiteKitchenConfigurator.js +13 -2
- package/lib/LiteRenderer.js +14 -106
- package/lib/catalog/catalog.js +4 -1
- package/lib/components/viewer2d/item.js +5 -9
- package/lib/devLiteRenderer.js +1 -1
- package/lib/utils/geometry.js +6 -6
- package/lib/utils/isolate-event-handler.js +0 -2
- package/package.json +1 -1
|
@@ -103,7 +103,8 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
103
103
|
redirectURL: '',
|
|
104
104
|
snackBarMessage: '',
|
|
105
105
|
isSaved: false,
|
|
106
|
-
isLeaving: false
|
|
106
|
+
isLeaving: false,
|
|
107
|
+
stateCatalog: _this.props.catalog
|
|
107
108
|
};
|
|
108
109
|
|
|
109
110
|
// For UTM tracking
|
|
@@ -467,6 +468,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
467
468
|
}, {
|
|
468
469
|
key: "componentWillReceiveProps",
|
|
469
470
|
value: function componentWillReceiveProps(nextProps) {
|
|
471
|
+
var _oldState$catalog, _plannerState$catalog;
|
|
470
472
|
var stateExtractor = nextProps.stateExtractor,
|
|
471
473
|
state = nextProps.state,
|
|
472
474
|
projectActions = nextProps.projectActions,
|
|
@@ -478,6 +480,15 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
478
480
|
handleExternalEvent(nextProps);
|
|
479
481
|
}
|
|
480
482
|
var plannerState = stateExtractor(state);
|
|
483
|
+
var oldState = stateExtractor(this.props.state);
|
|
484
|
+
if ((oldState === null || oldState === void 0 || (_oldState$catalog = oldState.catalog) === null || _oldState$catalog === void 0 ? void 0 : _oldState$catalog.elements) !== (plannerState === null || plannerState === void 0 || (_plannerState$catalog = plannerState.catalog) === null || _plannerState$catalog === void 0 ? void 0 : _plannerState$catalog.elements)) {
|
|
485
|
+
// copy state.catalog to the props.catalog
|
|
486
|
+
// let catalog = this.state.stateCatalog;
|
|
487
|
+
// console.log('111111', plannerState?.catalog?.elements.toJS());
|
|
488
|
+
// catalog.elements = plannerState?.catalog?.elements.toJS();
|
|
489
|
+
// console.log('222222', catalog);
|
|
490
|
+
// this.setState({ stateCatalog: catalog });
|
|
491
|
+
}
|
|
481
492
|
var catalogReady = plannerState.getIn(['catalog', 'ready']);
|
|
482
493
|
if (!catalogReady) {
|
|
483
494
|
projectActions.initCatalog(catalog);
|
|
@@ -573,7 +584,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
573
584
|
}, /*#__PURE__*/React.createElement(Content, _extends({
|
|
574
585
|
width: contentW,
|
|
575
586
|
height: contentH,
|
|
576
|
-
catalog: this.
|
|
587
|
+
catalog: this.state.stateCatalog,
|
|
577
588
|
state: extractedState,
|
|
578
589
|
toolBar: this.state.toolbar,
|
|
579
590
|
setToolbar: this.setToolbar,
|
package/es/LiteRenderer.js
CHANGED
|
@@ -249,8 +249,6 @@ export default function LiteRenderer(props) {
|
|
|
249
249
|
colorAlias = _ref.colorAlias,
|
|
250
250
|
subgroups = _ref.subgroups;
|
|
251
251
|
var _ref2 = dataBundle || {},
|
|
252
|
-
_ref2$data = _ref2.data,
|
|
253
|
-
data = _ref2$data === void 0 ? [] : _ref2$data,
|
|
254
252
|
_ref2$appliances = _ref2.appliances,
|
|
255
253
|
appliances = _ref2$appliances === void 0 ? [] : _ref2$appliances,
|
|
256
254
|
_ref2$furnishing = _ref2.furnishing,
|
|
@@ -262,14 +260,10 @@ export default function LiteRenderer(props) {
|
|
|
262
260
|
var id = configData.id,
|
|
263
261
|
logoImg = configData.logoImg,
|
|
264
262
|
companyUrl = configData.companyUrl;
|
|
265
|
-
var _React$useState = React.useState(
|
|
263
|
+
var _React$useState = React.useState(false),
|
|
266
264
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
var _React$useState3 = React.useState(false),
|
|
270
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
271
|
-
catalogInitiated = _React$useState4[0],
|
|
272
|
-
setCatalogInitiated = _React$useState4[1];
|
|
265
|
+
catalogInitiated = _React$useState2[0],
|
|
266
|
+
setCatalogInitiated = _React$useState2[1];
|
|
273
267
|
useEffect(function () {
|
|
274
268
|
var initMyCatalog = /*#__PURE__*/function () {
|
|
275
269
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
@@ -388,103 +382,27 @@ export default function LiteRenderer(props) {
|
|
|
388
382
|
return _ref4.apply(this, arguments);
|
|
389
383
|
};
|
|
390
384
|
}();
|
|
391
|
-
var loadSVGs = /*#__PURE__*/function () {
|
|
392
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
393
|
-
var svgLoadPromises, outlineData;
|
|
394
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
395
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
396
|
-
case 0:
|
|
397
|
-
svgLoadPromises = data.map(/*#__PURE__*/function () {
|
|
398
|
-
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(item) {
|
|
399
|
-
var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
|
|
400
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
401
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
402
|
-
case 0:
|
|
403
|
-
if (item.outline) {
|
|
404
|
-
_context3.next = 1;
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
return _context3.abrupt("return", null);
|
|
408
|
-
case 1:
|
|
409
|
-
_context3.prev = 1;
|
|
410
|
-
_context3.next = 2;
|
|
411
|
-
return fetch(item.outline, {
|
|
412
|
-
cache: 'no-store'
|
|
413
|
-
});
|
|
414
|
-
case 2:
|
|
415
|
-
response = _context3.sent;
|
|
416
|
-
_context3.next = 3;
|
|
417
|
-
return response.text();
|
|
418
|
-
case 3:
|
|
419
|
-
svgText = _context3.sent;
|
|
420
|
-
loader = new SVGLoader();
|
|
421
|
-
parsed = loader.parse(svgText);
|
|
422
|
-
if (!isEmpty(parsed.paths)) {
|
|
423
|
-
_context3.next = 4;
|
|
424
|
-
break;
|
|
425
|
-
}
|
|
426
|
-
return _context3.abrupt("return", null);
|
|
427
|
-
case 4:
|
|
428
|
-
return _context3.abrupt("return", {
|
|
429
|
-
paths: parsed.paths,
|
|
430
|
-
svgWidth: parseFloat(parsed.xml.getAttribute('width')) || ((_parsed$xml$viewBox = parsed.xml.viewBox) === null || _parsed$xml$viewBox === void 0 || (_parsed$xml$viewBox = _parsed$xml$viewBox.animVal) === null || _parsed$xml$viewBox === void 0 ? void 0 : _parsed$xml$viewBox.width) || 0,
|
|
431
|
-
svgHeight: parseFloat(parsed.xml.getAttribute('height')) || ((_parsed$xml$viewBox2 = parsed.xml.viewBox) === null || _parsed$xml$viewBox2 === void 0 || (_parsed$xml$viewBox2 = _parsed$xml$viewBox2.animVal) === null || _parsed$xml$viewBox2 === void 0 ? void 0 : _parsed$xml$viewBox2.height) || 0,
|
|
432
|
-
reverse: !parseFloat(parsed.xml.getAttribute('height'))
|
|
433
|
-
});
|
|
434
|
-
case 5:
|
|
435
|
-
_context3.prev = 5;
|
|
436
|
-
_t = _context3["catch"](1);
|
|
437
|
-
console.error('Failed to load SVG:', item.outline, _t);
|
|
438
|
-
return _context3.abrupt("return", null);
|
|
439
|
-
case 6:
|
|
440
|
-
case "end":
|
|
441
|
-
return _context3.stop();
|
|
442
|
-
}
|
|
443
|
-
}, _callee3, null, [[1, 5]]);
|
|
444
|
-
}));
|
|
445
|
-
return function (_x3) {
|
|
446
|
-
return _ref6.apply(this, arguments);
|
|
447
|
-
};
|
|
448
|
-
}());
|
|
449
|
-
_context4.next = 1;
|
|
450
|
-
return Promise.all(svgLoadPromises);
|
|
451
|
-
case 1:
|
|
452
|
-
outlineData = _context4.sent;
|
|
453
|
-
setOutlineSVGData(outlineData);
|
|
454
|
-
case 2:
|
|
455
|
-
case "end":
|
|
456
|
-
return _context4.stop();
|
|
457
|
-
}
|
|
458
|
-
}, _callee4);
|
|
459
|
-
}));
|
|
460
|
-
return function loadSVGs() {
|
|
461
|
-
return _ref5.apply(this, arguments);
|
|
462
|
-
};
|
|
463
|
-
}();
|
|
464
385
|
var initCatalog = /*#__PURE__*/function () {
|
|
465
|
-
var
|
|
466
|
-
return _regeneratorRuntime.wrap(function (
|
|
467
|
-
while (1) switch (
|
|
386
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
387
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
388
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
468
389
|
case 0:
|
|
469
390
|
setCatalogInitiated(false);
|
|
470
|
-
|
|
391
|
+
_context3.next = 1;
|
|
471
392
|
return initMyCatalog();
|
|
472
393
|
case 1:
|
|
473
|
-
|
|
394
|
+
_context3.next = 2;
|
|
474
395
|
return loadMoldings();
|
|
475
396
|
case 2:
|
|
476
|
-
_context5.next = 3;
|
|
477
|
-
return loadSVGs();
|
|
478
|
-
case 3:
|
|
479
397
|
setCatalogInitiated(true);
|
|
480
|
-
case
|
|
398
|
+
case 3:
|
|
481
399
|
case "end":
|
|
482
|
-
return
|
|
400
|
+
return _context3.stop();
|
|
483
401
|
}
|
|
484
|
-
},
|
|
402
|
+
}, _callee3);
|
|
485
403
|
}));
|
|
486
404
|
return function initCatalog() {
|
|
487
|
-
return
|
|
405
|
+
return _ref5.apply(this, arguments);
|
|
488
406
|
};
|
|
489
407
|
}();
|
|
490
408
|
initCatalog();
|
|
@@ -493,16 +411,7 @@ export default function LiteRenderer(props) {
|
|
|
493
411
|
|
|
494
412
|
// Register items once SVGs are loaded
|
|
495
413
|
useEffect(function () {
|
|
496
|
-
if (!outlineSVGData.length) return;
|
|
497
414
|
var Item = [];
|
|
498
|
-
data.forEach(function (obj, index) {
|
|
499
|
-
Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
|
|
500
|
-
type: 'cabinet',
|
|
501
|
-
outlineSVGData: outlineSVGData[index],
|
|
502
|
-
render2DItem: render2DItem,
|
|
503
|
-
render3DItem: render3DItem
|
|
504
|
-
})));
|
|
505
|
-
});
|
|
506
415
|
appliances.forEach(function (obj) {
|
|
507
416
|
Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
|
|
508
417
|
render2DItem: render2DItem,
|
|
@@ -525,7 +434,7 @@ export default function LiteRenderer(props) {
|
|
|
525
434
|
})));
|
|
526
435
|
});
|
|
527
436
|
for (var x in Item) MyCatalog.registerElement(Item[x]);
|
|
528
|
-
}, [
|
|
437
|
+
}, [appliances, furnishing, lighting]);
|
|
529
438
|
useEffect(function () {
|
|
530
439
|
if (projectElement.length === 0) return;
|
|
531
440
|
if (!catalogInitiated) return;
|
|
@@ -556,7 +465,6 @@ export default function LiteRenderer(props) {
|
|
|
556
465
|
return state.get('KitchenConfigurator');
|
|
557
466
|
},
|
|
558
467
|
categoryData: categoryData,
|
|
559
|
-
data: data,
|
|
560
468
|
configData: configData,
|
|
561
469
|
externalEvent: externalEvent
|
|
562
470
|
}, passThrough)))));
|
package/es/catalog/catalog.js
CHANGED
|
@@ -247,7 +247,10 @@ var Catalog = /*#__PURE__*/function () {
|
|
|
247
247
|
if (name === '') {
|
|
248
248
|
throw new Error('Category has empty name');
|
|
249
249
|
}
|
|
250
|
-
|
|
250
|
+
if (this.hasCategory(name)) {
|
|
251
|
+
throw new Error('Category has already been registered');
|
|
252
|
+
}
|
|
253
|
+
return true;
|
|
251
254
|
}
|
|
252
255
|
|
|
253
256
|
/**
|
|
@@ -6,6 +6,7 @@ import { convert } from "../../utils/convert-units-lite";
|
|
|
6
6
|
import { GeometryUtils } from "../../utils/export";
|
|
7
7
|
import { MODE_ROTATING_ITEM, WALL_CABINET_LAYOUTPOS } from "../../constants";
|
|
8
8
|
import { isEmpty, returnReplaceableDeepSearchType } from "./utils";
|
|
9
|
+
import { findCatalogElement } from "../../utils/geometry";
|
|
9
10
|
var STYLE_LINE = {
|
|
10
11
|
fill: '#0096fd',
|
|
11
12
|
stroke: '#0096fd'
|
|
@@ -21,6 +22,7 @@ var STYLE_CIRCLE2 = {
|
|
|
21
22
|
cursor: 'ew-resize'
|
|
22
23
|
};
|
|
23
24
|
export default function Item(_ref, _ref2) {
|
|
25
|
+
var _element$render2D;
|
|
24
26
|
var layer = _ref.layer,
|
|
25
27
|
item = _ref.item,
|
|
26
28
|
scene = _ref.scene,
|
|
@@ -117,12 +119,7 @@ export default function Item(_ref, _ref2) {
|
|
|
117
119
|
if (layer.selected.items.size > 0) {
|
|
118
120
|
selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
|
|
119
121
|
var catid = selectedItem.type;
|
|
120
|
-
var cat = catalog
|
|
121
|
-
if (!cat) cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
|
|
122
|
-
if (cat === undefined || cat === null) {
|
|
123
|
-
cat = catalog.getIn(['elements', catid]);
|
|
124
|
-
if (!cat) cat = catalog.getIn(['elements', returnReplaceableDeepSearchType(catid)]);
|
|
125
|
-
}
|
|
122
|
+
var cat = findCatalogElement(catalog, catid);
|
|
126
123
|
currentItem = {
|
|
127
124
|
selectedItem: selectedItem,
|
|
128
125
|
cat: cat
|
|
@@ -137,8 +134,7 @@ export default function Item(_ref, _ref2) {
|
|
|
137
134
|
rotRad: item.rotation / 180 * Math.PI
|
|
138
135
|
};
|
|
139
136
|
var catid = item.type;
|
|
140
|
-
var cat = catalog
|
|
141
|
-
if (!cat) cat = catalog.elements[returnReplaceableDeepSearchType(catid)];
|
|
137
|
+
var cat = findCatalogElement(catalog, catid);
|
|
142
138
|
var width = convert(item.properties.getIn(['width', '_length'])).from('in').to('cm');
|
|
143
139
|
var height = convert(item.properties.getIn(['depth', '_length'])).from('in').to('cm');
|
|
144
140
|
// let width = cat.info.sizeinfo.width;
|
|
@@ -314,7 +310,7 @@ export default function Item(_ref, _ref2) {
|
|
|
314
310
|
}
|
|
315
311
|
});
|
|
316
312
|
}
|
|
317
|
-
var renderedItem = element.render2D.call(element, item, layer, scene);
|
|
313
|
+
var renderedItem = element === null || element === void 0 || (_element$render2D = element.render2D) === null || _element$render2D === void 0 ? void 0 : _element$render2D.call(element, item, layer, scene);
|
|
318
314
|
var isSmall = false;
|
|
319
315
|
if (width < 40) isSmall = true;
|
|
320
316
|
var parts = [];
|
package/es/devLiteRenderer.js
CHANGED
|
@@ -4,7 +4,7 @@ import ContainerDimensions from 'react-container-dimensions';
|
|
|
4
4
|
import mockProps from "./mocks/mockProps.json";
|
|
5
5
|
import mockCategoryData from "./mocks/categoryData.json";
|
|
6
6
|
import mockDataBundle from "./mocks/dataBundle.json";
|
|
7
|
-
import cabinetPaylod from "./mocks/
|
|
7
|
+
import cabinetPaylod from "./mocks/cabinetPayload2.json";
|
|
8
8
|
import doorStylePaylod from "./mocks/doorStylePayload.json";
|
|
9
9
|
import oStylePaylod from "./mocks/oStylePayload.json";
|
|
10
10
|
import rectangleData from "./mocks/rectangleShape.json";
|
package/es/utils/geometry.js
CHANGED
|
@@ -873,18 +873,18 @@ export function getAllItemSnap(allItemRects) {
|
|
|
873
873
|
var snap4 = itemrectInfo(rect.rect[3].x + ox0, rect.rect[3].y + oy0, nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
|
|
874
874
|
var sizeinfo = otherItems[index].cat && otherItems[index].cat.info.sizeinfo;
|
|
875
875
|
if (sizeinfo) {
|
|
876
|
-
var
|
|
877
|
-
|
|
878
|
-
if (
|
|
879
|
-
var vx =
|
|
876
|
+
var left_blind_length = sizeinfo.left_blind_length,
|
|
877
|
+
right_blind_length = sizeinfo.right_blind_length;
|
|
878
|
+
if (left_blind_length > 0) {
|
|
879
|
+
var vx = left_blind_length - ch;
|
|
880
880
|
var vy = cw;
|
|
881
881
|
var dx = vx * cos + vy * sin;
|
|
882
882
|
var dy = vx * sin - vy * cos;
|
|
883
883
|
var snap6 = itemrectInfo(rect.rect[0].x + dx, rect.rect[0].y + dy, rect.rotRad + Math.PI / 2, cur && cur.size, rect.layoutpos, rect.is_corner);
|
|
884
884
|
allItemSnap.push(snap6);
|
|
885
885
|
}
|
|
886
|
-
if (
|
|
887
|
-
var _vx = ch -
|
|
886
|
+
if (right_blind_length > 0) {
|
|
887
|
+
var _vx = ch - right_blind_length;
|
|
888
888
|
var _vy = cw;
|
|
889
889
|
var _dx = _vx * cos + _vy * sin;
|
|
890
890
|
var _dy = _vx * sin - _vy * cos;
|
|
@@ -8,8 +8,6 @@ import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TO
|
|
|
8
8
|
import { isEmpty } from "./helper";
|
|
9
9
|
import exporter from "../catalog/utils/exporter";
|
|
10
10
|
import { render2DItem, render3DItem } from "../catalog/utils/item-loader";
|
|
11
|
-
import Catalog from "../catalog/catalog";
|
|
12
|
-
import { CatalogElement, safeLoadMapList } from "../models";
|
|
13
11
|
var loadSVGsByItem = /*#__PURE__*/function () {
|
|
14
12
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(item) {
|
|
15
13
|
var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
|
|
@@ -112,7 +112,8 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
112
112
|
redirectURL: '',
|
|
113
113
|
snackBarMessage: '',
|
|
114
114
|
isSaved: false,
|
|
115
|
-
isLeaving: false
|
|
115
|
+
isLeaving: false,
|
|
116
|
+
stateCatalog: _this.props.catalog
|
|
116
117
|
};
|
|
117
118
|
|
|
118
119
|
// For UTM tracking
|
|
@@ -476,6 +477,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
476
477
|
}, {
|
|
477
478
|
key: "componentWillReceiveProps",
|
|
478
479
|
value: function componentWillReceiveProps(nextProps) {
|
|
480
|
+
var _oldState$catalog, _plannerState$catalog;
|
|
479
481
|
var stateExtractor = nextProps.stateExtractor,
|
|
480
482
|
state = nextProps.state,
|
|
481
483
|
projectActions = nextProps.projectActions,
|
|
@@ -487,6 +489,15 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
487
489
|
(0, _isolateEventHandler.handleExternalEvent)(nextProps);
|
|
488
490
|
}
|
|
489
491
|
var plannerState = stateExtractor(state);
|
|
492
|
+
var oldState = stateExtractor(this.props.state);
|
|
493
|
+
if ((oldState === null || oldState === void 0 || (_oldState$catalog = oldState.catalog) === null || _oldState$catalog === void 0 ? void 0 : _oldState$catalog.elements) !== (plannerState === null || plannerState === void 0 || (_plannerState$catalog = plannerState.catalog) === null || _plannerState$catalog === void 0 ? void 0 : _plannerState$catalog.elements)) {
|
|
494
|
+
// copy state.catalog to the props.catalog
|
|
495
|
+
// let catalog = this.state.stateCatalog;
|
|
496
|
+
// console.log('111111', plannerState?.catalog?.elements.toJS());
|
|
497
|
+
// catalog.elements = plannerState?.catalog?.elements.toJS();
|
|
498
|
+
// console.log('222222', catalog);
|
|
499
|
+
// this.setState({ stateCatalog: catalog });
|
|
500
|
+
}
|
|
490
501
|
var catalogReady = plannerState.getIn(['catalog', 'ready']);
|
|
491
502
|
if (!catalogReady) {
|
|
492
503
|
projectActions.initCatalog(catalog);
|
|
@@ -582,7 +593,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
582
593
|
}, /*#__PURE__*/_react["default"].createElement(_export2.Content, (0, _extends2["default"])({
|
|
583
594
|
width: contentW,
|
|
584
595
|
height: contentH,
|
|
585
|
-
catalog: this.
|
|
596
|
+
catalog: this.state.stateCatalog,
|
|
586
597
|
state: extractedState,
|
|
587
598
|
toolBar: this.state.toolbar,
|
|
588
599
|
setToolbar: this.setToolbar,
|
package/lib/LiteRenderer.js
CHANGED
|
@@ -41,7 +41,7 @@ var _exporter = _interopRequireDefault(require("./catalog/utils/exporter"));
|
|
|
41
41
|
var THREE = _interopRequireWildcard(require("three"));
|
|
42
42
|
var _LiteKitchenConfigurator = _interopRequireDefault(require("./LiteKitchenConfigurator"));
|
|
43
43
|
var _excluded = ["width", "height", "projectElement", "categoryData", "dataBundle", "configData", "options", "user", "auth", "featureFlags", "sentry", "analytics", "externalEvent", "onError"];
|
|
44
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
44
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
45
45
|
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; }
|
|
46
46
|
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) { (0, _defineProperty2["default"])(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; }
|
|
47
47
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
@@ -258,8 +258,6 @@ function LiteRenderer(props) {
|
|
|
258
258
|
colorAlias = _ref.colorAlias,
|
|
259
259
|
subgroups = _ref.subgroups;
|
|
260
260
|
var _ref2 = dataBundle || {},
|
|
261
|
-
_ref2$data = _ref2.data,
|
|
262
|
-
data = _ref2$data === void 0 ? [] : _ref2$data,
|
|
263
261
|
_ref2$appliances = _ref2.appliances,
|
|
264
262
|
appliances = _ref2$appliances === void 0 ? [] : _ref2$appliances,
|
|
265
263
|
_ref2$furnishing = _ref2.furnishing,
|
|
@@ -271,14 +269,10 @@ function LiteRenderer(props) {
|
|
|
271
269
|
var id = configData.id,
|
|
272
270
|
logoImg = configData.logoImg,
|
|
273
271
|
companyUrl = configData.companyUrl;
|
|
274
|
-
var _React$useState = _react["default"].useState(
|
|
272
|
+
var _React$useState = _react["default"].useState(false),
|
|
275
273
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
var _React$useState3 = _react["default"].useState(false),
|
|
279
|
-
_React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
|
|
280
|
-
catalogInitiated = _React$useState4[0],
|
|
281
|
-
setCatalogInitiated = _React$useState4[1];
|
|
274
|
+
catalogInitiated = _React$useState2[0],
|
|
275
|
+
setCatalogInitiated = _React$useState2[1];
|
|
282
276
|
(0, _react.useEffect)(function () {
|
|
283
277
|
var initMyCatalog = /*#__PURE__*/function () {
|
|
284
278
|
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
@@ -397,103 +391,27 @@ function LiteRenderer(props) {
|
|
|
397
391
|
return _ref4.apply(this, arguments);
|
|
398
392
|
};
|
|
399
393
|
}();
|
|
400
|
-
var loadSVGs = /*#__PURE__*/function () {
|
|
401
|
-
var _ref5 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
402
|
-
var svgLoadPromises, outlineData;
|
|
403
|
-
return _regenerator["default"].wrap(function (_context4) {
|
|
404
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
405
|
-
case 0:
|
|
406
|
-
svgLoadPromises = data.map(/*#__PURE__*/function () {
|
|
407
|
-
var _ref6 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(item) {
|
|
408
|
-
var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
|
|
409
|
-
return _regenerator["default"].wrap(function (_context3) {
|
|
410
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
411
|
-
case 0:
|
|
412
|
-
if (item.outline) {
|
|
413
|
-
_context3.next = 1;
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
return _context3.abrupt("return", null);
|
|
417
|
-
case 1:
|
|
418
|
-
_context3.prev = 1;
|
|
419
|
-
_context3.next = 2;
|
|
420
|
-
return fetch(item.outline, {
|
|
421
|
-
cache: 'no-store'
|
|
422
|
-
});
|
|
423
|
-
case 2:
|
|
424
|
-
response = _context3.sent;
|
|
425
|
-
_context3.next = 3;
|
|
426
|
-
return response.text();
|
|
427
|
-
case 3:
|
|
428
|
-
svgText = _context3.sent;
|
|
429
|
-
loader = new _SVGLoader.SVGLoader();
|
|
430
|
-
parsed = loader.parse(svgText);
|
|
431
|
-
if (!(0, _helper.isEmpty)(parsed.paths)) {
|
|
432
|
-
_context3.next = 4;
|
|
433
|
-
break;
|
|
434
|
-
}
|
|
435
|
-
return _context3.abrupt("return", null);
|
|
436
|
-
case 4:
|
|
437
|
-
return _context3.abrupt("return", {
|
|
438
|
-
paths: parsed.paths,
|
|
439
|
-
svgWidth: parseFloat(parsed.xml.getAttribute('width')) || ((_parsed$xml$viewBox = parsed.xml.viewBox) === null || _parsed$xml$viewBox === void 0 || (_parsed$xml$viewBox = _parsed$xml$viewBox.animVal) === null || _parsed$xml$viewBox === void 0 ? void 0 : _parsed$xml$viewBox.width) || 0,
|
|
440
|
-
svgHeight: parseFloat(parsed.xml.getAttribute('height')) || ((_parsed$xml$viewBox2 = parsed.xml.viewBox) === null || _parsed$xml$viewBox2 === void 0 || (_parsed$xml$viewBox2 = _parsed$xml$viewBox2.animVal) === null || _parsed$xml$viewBox2 === void 0 ? void 0 : _parsed$xml$viewBox2.height) || 0,
|
|
441
|
-
reverse: !parseFloat(parsed.xml.getAttribute('height'))
|
|
442
|
-
});
|
|
443
|
-
case 5:
|
|
444
|
-
_context3.prev = 5;
|
|
445
|
-
_t = _context3["catch"](1);
|
|
446
|
-
console.error('Failed to load SVG:', item.outline, _t);
|
|
447
|
-
return _context3.abrupt("return", null);
|
|
448
|
-
case 6:
|
|
449
|
-
case "end":
|
|
450
|
-
return _context3.stop();
|
|
451
|
-
}
|
|
452
|
-
}, _callee3, null, [[1, 5]]);
|
|
453
|
-
}));
|
|
454
|
-
return function (_x3) {
|
|
455
|
-
return _ref6.apply(this, arguments);
|
|
456
|
-
};
|
|
457
|
-
}());
|
|
458
|
-
_context4.next = 1;
|
|
459
|
-
return Promise.all(svgLoadPromises);
|
|
460
|
-
case 1:
|
|
461
|
-
outlineData = _context4.sent;
|
|
462
|
-
setOutlineSVGData(outlineData);
|
|
463
|
-
case 2:
|
|
464
|
-
case "end":
|
|
465
|
-
return _context4.stop();
|
|
466
|
-
}
|
|
467
|
-
}, _callee4);
|
|
468
|
-
}));
|
|
469
|
-
return function loadSVGs() {
|
|
470
|
-
return _ref5.apply(this, arguments);
|
|
471
|
-
};
|
|
472
|
-
}();
|
|
473
394
|
var initCatalog = /*#__PURE__*/function () {
|
|
474
|
-
var
|
|
475
|
-
return _regenerator["default"].wrap(function (
|
|
476
|
-
while (1) switch (
|
|
395
|
+
var _ref5 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
396
|
+
return _regenerator["default"].wrap(function (_context3) {
|
|
397
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
477
398
|
case 0:
|
|
478
399
|
setCatalogInitiated(false);
|
|
479
|
-
|
|
400
|
+
_context3.next = 1;
|
|
480
401
|
return initMyCatalog();
|
|
481
402
|
case 1:
|
|
482
|
-
|
|
403
|
+
_context3.next = 2;
|
|
483
404
|
return loadMoldings();
|
|
484
405
|
case 2:
|
|
485
|
-
_context5.next = 3;
|
|
486
|
-
return loadSVGs();
|
|
487
|
-
case 3:
|
|
488
406
|
setCatalogInitiated(true);
|
|
489
|
-
case
|
|
407
|
+
case 3:
|
|
490
408
|
case "end":
|
|
491
|
-
return
|
|
409
|
+
return _context3.stop();
|
|
492
410
|
}
|
|
493
|
-
},
|
|
411
|
+
}, _callee3);
|
|
494
412
|
}));
|
|
495
413
|
return function initCatalog() {
|
|
496
|
-
return
|
|
414
|
+
return _ref5.apply(this, arguments);
|
|
497
415
|
};
|
|
498
416
|
}();
|
|
499
417
|
initCatalog();
|
|
@@ -502,16 +420,7 @@ function LiteRenderer(props) {
|
|
|
502
420
|
|
|
503
421
|
// Register items once SVGs are loaded
|
|
504
422
|
(0, _react.useEffect)(function () {
|
|
505
|
-
if (!outlineSVGData.length) return;
|
|
506
423
|
var Item = [];
|
|
507
|
-
data.forEach(function (obj, index) {
|
|
508
|
-
Item.push((0, _exporter["default"])(_objectSpread(_objectSpread({}, obj), {}, {
|
|
509
|
-
type: 'cabinet',
|
|
510
|
-
outlineSVGData: outlineSVGData[index],
|
|
511
|
-
render2DItem: _itemLoader.render2DItem,
|
|
512
|
-
render3DItem: _itemLoader.render3DItem
|
|
513
|
-
})));
|
|
514
|
-
});
|
|
515
424
|
appliances.forEach(function (obj) {
|
|
516
425
|
Item.push((0, _exporter["default"])(_objectSpread(_objectSpread({}, obj), {}, {
|
|
517
426
|
render2DItem: _itemLoader.render2DItem,
|
|
@@ -534,7 +443,7 @@ function LiteRenderer(props) {
|
|
|
534
443
|
})));
|
|
535
444
|
});
|
|
536
445
|
for (var x in Item) MyCatalog.registerElement(Item[x]);
|
|
537
|
-
}, [
|
|
446
|
+
}, [appliances, furnishing, lighting]);
|
|
538
447
|
(0, _react.useEffect)(function () {
|
|
539
448
|
if (projectElement.length === 0) return;
|
|
540
449
|
if (!catalogInitiated) return;
|
|
@@ -565,7 +474,6 @@ function LiteRenderer(props) {
|
|
|
565
474
|
return state.get('KitchenConfigurator');
|
|
566
475
|
},
|
|
567
476
|
categoryData: categoryData,
|
|
568
|
-
data: data,
|
|
569
477
|
configData: configData,
|
|
570
478
|
externalEvent: externalEvent
|
|
571
479
|
}, passThrough)))));
|
package/lib/catalog/catalog.js
CHANGED
|
@@ -254,7 +254,10 @@ var Catalog = exports["default"] = /*#__PURE__*/function () {
|
|
|
254
254
|
if (name === '') {
|
|
255
255
|
throw new Error('Category has empty name');
|
|
256
256
|
}
|
|
257
|
-
|
|
257
|
+
if (this.hasCategory(name)) {
|
|
258
|
+
throw new Error('Category has already been registered');
|
|
259
|
+
}
|
|
260
|
+
return true;
|
|
258
261
|
}
|
|
259
262
|
|
|
260
263
|
/**
|
|
@@ -14,6 +14,7 @@ var _convertUnitsLite = require("../../utils/convert-units-lite");
|
|
|
14
14
|
var _export = require("../../utils/export");
|
|
15
15
|
var _constants = require("../../constants");
|
|
16
16
|
var _utils = require("./utils");
|
|
17
|
+
var _geometry = require("../../utils/geometry");
|
|
17
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
18
19
|
var STYLE_LINE = {
|
|
19
20
|
fill: '#0096fd',
|
|
@@ -30,6 +31,7 @@ var STYLE_CIRCLE2 = {
|
|
|
30
31
|
cursor: 'ew-resize'
|
|
31
32
|
};
|
|
32
33
|
function Item(_ref, _ref2) {
|
|
34
|
+
var _element$render2D;
|
|
33
35
|
var layer = _ref.layer,
|
|
34
36
|
item = _ref.item,
|
|
35
37
|
scene = _ref.scene,
|
|
@@ -126,12 +128,7 @@ function Item(_ref, _ref2) {
|
|
|
126
128
|
if (layer.selected.items.size > 0) {
|
|
127
129
|
selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
|
|
128
130
|
var catid = selectedItem.type;
|
|
129
|
-
var cat = catalog
|
|
130
|
-
if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
|
|
131
|
-
if (cat === undefined || cat === null) {
|
|
132
|
-
cat = catalog.getIn(['elements', catid]);
|
|
133
|
-
if (!cat) cat = catalog.getIn(['elements', (0, _utils.returnReplaceableDeepSearchType)(catid)]);
|
|
134
|
-
}
|
|
131
|
+
var cat = (0, _geometry.findCatalogElement)(catalog, catid);
|
|
135
132
|
currentItem = {
|
|
136
133
|
selectedItem: selectedItem,
|
|
137
134
|
cat: cat
|
|
@@ -146,8 +143,7 @@ function Item(_ref, _ref2) {
|
|
|
146
143
|
rotRad: item.rotation / 180 * Math.PI
|
|
147
144
|
};
|
|
148
145
|
var catid = item.type;
|
|
149
|
-
var cat = catalog
|
|
150
|
-
if (!cat) cat = catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(catid)];
|
|
146
|
+
var cat = (0, _geometry.findCatalogElement)(catalog, catid);
|
|
151
147
|
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from('in').to('cm');
|
|
152
148
|
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from('in').to('cm');
|
|
153
149
|
// let width = cat.info.sizeinfo.width;
|
|
@@ -323,7 +319,7 @@ function Item(_ref, _ref2) {
|
|
|
323
319
|
}
|
|
324
320
|
});
|
|
325
321
|
}
|
|
326
|
-
var renderedItem = element.render2D.call(element, item, layer, scene);
|
|
322
|
+
var renderedItem = element === null || element === void 0 || (_element$render2D = element.render2D) === null || _element$render2D === void 0 ? void 0 : _element$render2D.call(element, item, layer, scene);
|
|
327
323
|
var isSmall = false;
|
|
328
324
|
if (width < 40) isSmall = true;
|
|
329
325
|
var parts = [];
|
package/lib/devLiteRenderer.js
CHANGED
|
@@ -8,7 +8,7 @@ var _reactContainerDimensions = _interopRequireDefault(require("react-container-
|
|
|
8
8
|
var _mockProps = _interopRequireDefault(require("./mocks/mockProps.json"));
|
|
9
9
|
var _categoryData = _interopRequireDefault(require("./mocks/categoryData.json"));
|
|
10
10
|
var _dataBundle = _interopRequireDefault(require("./mocks/dataBundle.json"));
|
|
11
|
-
var _cabinetPayload = _interopRequireDefault(require("./mocks/
|
|
11
|
+
var _cabinetPayload = _interopRequireDefault(require("./mocks/cabinetPayload2.json"));
|
|
12
12
|
var _doorStylePayload = _interopRequireDefault(require("./mocks/doorStylePayload.json"));
|
|
13
13
|
var _oStylePayload = _interopRequireDefault(require("./mocks/oStylePayload.json"));
|
|
14
14
|
var _rectangleShape = _interopRequireDefault(require("./mocks/rectangleShape.json"));
|
package/lib/utils/geometry.js
CHANGED
|
@@ -972,18 +972,18 @@ function getAllItemSnap(allItemRects) {
|
|
|
972
972
|
var snap4 = itemrectInfo(rect.rect[3].x + ox0, rect.rect[3].y + oy0, nrot, cur && cur.size, rect.layoutpos, rect.is_corner);
|
|
973
973
|
var sizeinfo = otherItems[index].cat && otherItems[index].cat.info.sizeinfo;
|
|
974
974
|
if (sizeinfo) {
|
|
975
|
-
var
|
|
976
|
-
|
|
977
|
-
if (
|
|
978
|
-
var vx =
|
|
975
|
+
var left_blind_length = sizeinfo.left_blind_length,
|
|
976
|
+
right_blind_length = sizeinfo.right_blind_length;
|
|
977
|
+
if (left_blind_length > 0) {
|
|
978
|
+
var vx = left_blind_length - ch;
|
|
979
979
|
var vy = cw;
|
|
980
980
|
var dx = vx * cos + vy * sin;
|
|
981
981
|
var dy = vx * sin - vy * cos;
|
|
982
982
|
var snap6 = itemrectInfo(rect.rect[0].x + dx, rect.rect[0].y + dy, rect.rotRad + Math.PI / 2, cur && cur.size, rect.layoutpos, rect.is_corner);
|
|
983
983
|
allItemSnap.push(snap6);
|
|
984
984
|
}
|
|
985
|
-
if (
|
|
986
|
-
var _vx = ch -
|
|
985
|
+
if (right_blind_length > 0) {
|
|
986
|
+
var _vx = ch - right_blind_length;
|
|
987
987
|
var _vy = cw;
|
|
988
988
|
var _dx = _vx * cos + _vy * sin;
|
|
989
989
|
var _dy = _vx * sin - _vy * cos;
|
|
@@ -13,8 +13,6 @@ var _constants = require("../constants");
|
|
|
13
13
|
var _helper = require("./helper");
|
|
14
14
|
var _exporter = _interopRequireDefault(require("../catalog/utils/exporter"));
|
|
15
15
|
var _itemLoader = require("../catalog/utils/item-loader");
|
|
16
|
-
var _catalog = _interopRequireDefault(require("../catalog/catalog"));
|
|
17
|
-
var _models = require("../models");
|
|
18
16
|
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; }
|
|
19
17
|
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) { (0, _defineProperty2["default"])(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; }
|
|
20
18
|
var loadSVGsByItem = /*#__PURE__*/function () {
|