kitchen-simulator 1.0.0-alin.40 → 1.0.0-alin.46
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 +0 -101
- package/es/LiteRenderer.js +114 -15
- package/es/catalog/catalog.js +1 -4
- package/es/components/viewer2d/viewer2d.js +5 -4
- package/es/devLiteRenderer.js +1 -1
- package/es/utils/isolate-event-handler.js +3 -0
- package/lib/LiteKitchenConfigurator.js +1 -102
- package/lib/LiteRenderer.js +114 -15
- package/lib/catalog/catalog.js +1 -4
- package/lib/components/viewer2d/viewer2d.js +4 -3
- package/lib/devLiteRenderer.js +1 -1
- package/lib/utils/isolate-event-handler.js +3 -0
- package/package.json +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
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";
|
|
5
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
5
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
@@ -9,7 +8,6 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
|
9
8
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
10
9
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
11
10
|
var _excluded = ["width", "height", "state", "stateExtractor"];
|
|
12
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
11
|
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
12
|
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
13
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -345,116 +343,17 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
345
343
|
}, {
|
|
346
344
|
key: "componentDidMount",
|
|
347
345
|
value: function componentDidMount() {
|
|
348
|
-
var _this3 = this;
|
|
349
346
|
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
350
347
|
console.log('context =>', this.context);
|
|
351
348
|
window.forRedo = [];
|
|
352
349
|
var store = this.context.store;
|
|
353
350
|
var _this$props2 = this.props,
|
|
354
|
-
projectActions = _this$props2.projectActions,
|
|
355
|
-
catalog = _this$props2.catalog,
|
|
356
351
|
stateExtractor = _this$props2.stateExtractor,
|
|
357
|
-
state = _this$props2.state,
|
|
358
352
|
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
|
-
}
|
|
367
353
|
var newplugins = _toConsumableArray(plugins);
|
|
368
354
|
newplugins.forEach(function (newplugin) {
|
|
369
355
|
return newplugin(store, stateExtractor);
|
|
370
356
|
});
|
|
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
357
|
}
|
|
459
358
|
}, {
|
|
460
359
|
key: "componentWillUnmount",
|
package/es/LiteRenderer.js
CHANGED
|
@@ -33,7 +33,7 @@ import { render2DItem, render3DApplianceItem, render3DItem, render3DLightingItem
|
|
|
33
33
|
import { ConsoleDebugger, Keyboard } from "./plugins/export";
|
|
34
34
|
import { Map } from 'immutable';
|
|
35
35
|
import * as Sentry from '@sentry/react';
|
|
36
|
-
import { loadProject, rename } from "./actions/project-actions";
|
|
36
|
+
import { initCatalog, loadProject, rename } from "./actions/project-actions";
|
|
37
37
|
import exporter from "./catalog/utils/exporter";
|
|
38
38
|
import * as THREE from 'three';
|
|
39
39
|
import LiteKitchenConfigurator from "./LiteKitchenConfigurator";
|
|
@@ -249,6 +249,8 @@ 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,
|
|
252
254
|
_ref2$appliances = _ref2.appliances,
|
|
253
255
|
appliances = _ref2$appliances === void 0 ? [] : _ref2$appliances,
|
|
254
256
|
_ref2$furnishing = _ref2.furnishing,
|
|
@@ -260,10 +262,14 @@ export default function LiteRenderer(props) {
|
|
|
260
262
|
var id = configData.id,
|
|
261
263
|
logoImg = configData.logoImg,
|
|
262
264
|
companyUrl = configData.companyUrl;
|
|
263
|
-
var _React$useState = React.useState(
|
|
265
|
+
var _React$useState = React.useState([]),
|
|
264
266
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
265
|
-
|
|
266
|
-
|
|
267
|
+
outlineSVGData = _React$useState2[0],
|
|
268
|
+
setOutlineSVGData = _React$useState2[1];
|
|
269
|
+
var _React$useState3 = React.useState(false),
|
|
270
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
271
|
+
catalogInitiated = _React$useState4[0],
|
|
272
|
+
setCatalogInitiated = _React$useState4[1];
|
|
267
273
|
useEffect(function () {
|
|
268
274
|
var initMyCatalog = /*#__PURE__*/function () {
|
|
269
275
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
@@ -382,36 +388,121 @@ export default function LiteRenderer(props) {
|
|
|
382
388
|
return _ref4.apply(this, arguments);
|
|
383
389
|
};
|
|
384
390
|
}();
|
|
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
|
+
}();
|
|
385
464
|
var initCatalog = /*#__PURE__*/function () {
|
|
386
|
-
var
|
|
387
|
-
return _regeneratorRuntime.wrap(function (
|
|
388
|
-
while (1) switch (
|
|
465
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
466
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
467
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
389
468
|
case 0:
|
|
390
469
|
setCatalogInitiated(false);
|
|
391
|
-
|
|
470
|
+
_context5.next = 1;
|
|
392
471
|
return initMyCatalog();
|
|
393
472
|
case 1:
|
|
394
|
-
|
|
473
|
+
_context5.next = 2;
|
|
395
474
|
return loadMoldings();
|
|
396
475
|
case 2:
|
|
397
|
-
|
|
476
|
+
_context5.next = 3;
|
|
477
|
+
return loadSVGs();
|
|
398
478
|
case 3:
|
|
479
|
+
setCatalogInitiated(true);
|
|
480
|
+
case 4:
|
|
399
481
|
case "end":
|
|
400
|
-
return
|
|
482
|
+
return _context5.stop();
|
|
401
483
|
}
|
|
402
|
-
},
|
|
484
|
+
}, _callee5);
|
|
403
485
|
}));
|
|
404
486
|
return function initCatalog() {
|
|
405
|
-
return
|
|
487
|
+
return _ref7.apply(this, arguments);
|
|
406
488
|
};
|
|
407
489
|
}();
|
|
408
490
|
initCatalog();
|
|
409
491
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
410
|
-
}, []);
|
|
492
|
+
}, [categoryData, data, id, catalogs, colorAlias, subgroups]);
|
|
411
493
|
|
|
412
494
|
// Register items once SVGs are loaded
|
|
413
495
|
useEffect(function () {
|
|
496
|
+
if (!outlineSVGData.length) return;
|
|
414
497
|
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
|
+
});
|
|
415
506
|
appliances.forEach(function (obj) {
|
|
416
507
|
Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
|
|
417
508
|
render2DItem: render2DItem,
|
|
@@ -434,10 +525,17 @@ export default function LiteRenderer(props) {
|
|
|
434
525
|
})));
|
|
435
526
|
});
|
|
436
527
|
for (var x in Item) MyCatalog.registerElement(Item[x]);
|
|
437
|
-
}, [appliances, furnishing, lighting]);
|
|
528
|
+
}, [outlineSVGData, data, appliances, furnishing, lighting]);
|
|
438
529
|
useEffect(function () {
|
|
439
530
|
if (projectElement.length === 0) return;
|
|
440
531
|
if (!catalogInitiated) return;
|
|
532
|
+
store.dispatch(initCatalog(MyCatalog));
|
|
533
|
+
if (sessionStorage.getItem(window.location.href)) {
|
|
534
|
+
var _jsonData = sessionStorage.getItem(window.location.href);
|
|
535
|
+
store.dispatch(loadProject(JSON.parse(_jsonData), categoryData));
|
|
536
|
+
sessionStorage.removeItem(window.location.href);
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
441
539
|
sessionStorage.setItem('projectTitle', projectElement[0].title);
|
|
442
540
|
store.dispatch(rename(projectElement[0].title));
|
|
443
541
|
sessionStorage.setItem('projectId', projectElement[0].id);
|
|
@@ -465,6 +563,7 @@ export default function LiteRenderer(props) {
|
|
|
465
563
|
return state.get('KitchenConfigurator');
|
|
466
564
|
},
|
|
467
565
|
categoryData: categoryData,
|
|
566
|
+
data: data,
|
|
468
567
|
configData: configData,
|
|
469
568
|
externalEvent: externalEvent
|
|
470
569
|
}, passThrough)))));
|
package/es/catalog/catalog.js
CHANGED
|
@@ -247,10 +247,7 @@ var Catalog = /*#__PURE__*/function () {
|
|
|
247
247
|
if (name === '') {
|
|
248
248
|
throw new Error('Category has empty name');
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
throw new Error('Category has already been registered');
|
|
252
|
-
}
|
|
253
|
-
return true;
|
|
250
|
+
return !this.hasCategory(name);
|
|
254
251
|
}
|
|
255
252
|
|
|
256
253
|
/**
|
|
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
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; }
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { ReactSVGPanZoom, TOOL_AUTO, TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT,
|
|
7
|
+
import { INITIAL_VALUE, ReactSVGPanZoom, TOOL_AUTO, TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT, POSITION_NONE } from 'react-svg-pan-zoom';
|
|
8
8
|
import * as constants from "../../constants";
|
|
9
9
|
import { DECIMAL_PLACES_2, LINE_THICKNESS, MIN_ANGLE_DISALLOW_DRAW_WALL, MODE_ELEVATION_VIEW, MODE_IDLE, UNIT_ANGLE } from "../../constants";
|
|
10
10
|
import State from "./state";
|
|
@@ -1309,7 +1309,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1309
1309
|
},
|
|
1310
1310
|
width: width - rulerSize,
|
|
1311
1311
|
height: height - rulerSize,
|
|
1312
|
-
value: viewer2D.isEmpty() ?
|
|
1312
|
+
value: viewer2D.isEmpty() ? INITIAL_VALUE : viewer2D.toJS(),
|
|
1313
1313
|
onChangeValue: onChangeValue,
|
|
1314
1314
|
tool: mode2Tool(mode),
|
|
1315
1315
|
onChangeTool: onChangeTool,
|
|
@@ -1317,8 +1317,9 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1317
1317
|
onMouseDown: onMouseDown,
|
|
1318
1318
|
onMouseMove: onMouseMove,
|
|
1319
1319
|
onMouseUp: onMouseUp,
|
|
1320
|
-
|
|
1321
|
-
|
|
1320
|
+
toolbarProps: {
|
|
1321
|
+
position: POSITION_NONE
|
|
1322
|
+
},
|
|
1322
1323
|
detectPinchGesture: false,
|
|
1323
1324
|
disableDoubleClickZoomWithToolAuto: true,
|
|
1324
1325
|
ref: Viewer
|
package/es/devLiteRenderer.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
3
3
|
import ContainerDimensions from 'react-container-dimensions';
|
|
4
4
|
import mockProps from "./mocks/mockProps.json";
|
|
5
5
|
import mockCategoryData from "./mocks/categoryData.json";
|
|
6
|
-
import mockDataBundle from "./mocks/
|
|
6
|
+
import mockDataBundle from "./mocks/dataBundle2.json";
|
|
7
7
|
import cabinetPaylod from "./mocks/cabinetPayload2.json";
|
|
8
8
|
import doorStylePaylod from "./mocks/doorStylePayload.json";
|
|
9
9
|
import oStylePaylod from "./mocks/oStylePayload.json";
|
|
@@ -8,6 +8,8 @@ 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";
|
|
11
13
|
var loadSVGsByItem = /*#__PURE__*/function () {
|
|
12
14
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(item) {
|
|
13
15
|
var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
|
|
@@ -116,6 +118,7 @@ function _handleExternalEvent() {
|
|
|
116
118
|
render3DItem: render3DItem
|
|
117
119
|
}));
|
|
118
120
|
if (catalogInstance !== null && catalogInstance !== void 0 && catalogInstance.validateElement(elementJs)) {
|
|
121
|
+
catalogInstance.registerElement(elementJs);
|
|
119
122
|
props.projectActions.addElementToCatalog(elementJs);
|
|
120
123
|
}
|
|
121
124
|
case 7:
|
|
@@ -8,8 +8,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
14
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -33,7 +31,7 @@ var _objectsUtils = require("./utils/objects-utils");
|
|
|
33
31
|
var _version = require("./version");
|
|
34
32
|
var _isolateEventHandler = require("./utils/isolate-event-handler");
|
|
35
33
|
var _excluded = ["width", "height", "state", "stateExtractor"];
|
|
36
|
-
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
|
|
34
|
+
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); }
|
|
37
35
|
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; }
|
|
38
36
|
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; }
|
|
39
37
|
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)); }
|
|
@@ -354,116 +352,17 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
354
352
|
}, {
|
|
355
353
|
key: "componentDidMount",
|
|
356
354
|
value: function componentDidMount() {
|
|
357
|
-
var _this3 = this;
|
|
358
355
|
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
359
356
|
console.log('context =>', this.context);
|
|
360
357
|
window.forRedo = [];
|
|
361
358
|
var store = this.context.store;
|
|
362
359
|
var _this$props2 = this.props,
|
|
363
|
-
projectActions = _this$props2.projectActions,
|
|
364
|
-
catalog = _this$props2.catalog,
|
|
365
360
|
stateExtractor = _this$props2.stateExtractor,
|
|
366
|
-
state = _this$props2.state,
|
|
367
361
|
plugins = _this$props2.plugins;
|
|
368
|
-
projectActions.initCatalog(catalog);
|
|
369
|
-
var match = this.props.match;
|
|
370
|
-
if (sessionStorage.getItem(window.location.href)) {
|
|
371
|
-
var jsonData = sessionStorage.getItem(window.location.href);
|
|
372
|
-
projectActions.loadProject(JSON.parse(jsonData), this.props.categoryData);
|
|
373
|
-
sessionStorage.removeItem(window.location.href);
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
362
|
var newplugins = (0, _toConsumableArray2["default"])(plugins);
|
|
377
363
|
newplugins.forEach(function (newplugin) {
|
|
378
364
|
return newplugin(store, stateExtractor);
|
|
379
365
|
});
|
|
380
|
-
if (match && match.params.pid === undefined) {
|
|
381
|
-
projectActions.newProject();
|
|
382
|
-
sessionStorage.setItem('projectTitle', 'Untitled');
|
|
383
|
-
projectActions.rename('Untitled');
|
|
384
|
-
sessionStorage.removeItem('projectId');
|
|
385
|
-
sessionStorage.removeItem('email');
|
|
386
|
-
sessionStorage.removeItem('firstName');
|
|
387
|
-
sessionStorage.removeItem('lastName');
|
|
388
|
-
sessionStorage.removeItem('usedObjects');
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
if (match && match.params.pid !== undefined) {
|
|
392
|
-
if (match.params.pid === 'new') {
|
|
393
|
-
projectActions.newProject();
|
|
394
|
-
sessionStorage.setItem('projectTitle', 'Untitled');
|
|
395
|
-
projectActions.rename('Untitled');
|
|
396
|
-
sessionStorage.removeItem('projectId');
|
|
397
|
-
sessionStorage.removeItem('email');
|
|
398
|
-
sessionStorage.removeItem('firstName');
|
|
399
|
-
sessionStorage.removeItem('lastName');
|
|
400
|
-
sessionStorage.removeItem('usedObjects');
|
|
401
|
-
} else {
|
|
402
|
-
_axios["default"].post("".concat(constants.API_SERVER_URL, "/api/project/loadPidProject"), {
|
|
403
|
-
pid: match.params.pid,
|
|
404
|
-
visualizerName: sessionStorage.getItem('visualizerName')
|
|
405
|
-
}).then(/*#__PURE__*/function () {
|
|
406
|
-
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(response) {
|
|
407
|
-
var projectElement, jsonData, _t;
|
|
408
|
-
return _regenerator["default"].wrap(function (_context) {
|
|
409
|
-
while (1) switch (_context.prev = _context.next) {
|
|
410
|
-
case 0:
|
|
411
|
-
projectElement = response.data.projectElement;
|
|
412
|
-
if (!(projectElement.length === 0)) {
|
|
413
|
-
_context.next = 1;
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
return _context.abrupt("return");
|
|
417
|
-
case 1:
|
|
418
|
-
sessionStorage.setItem('projectTitle', projectElement[0].title);
|
|
419
|
-
projectActions.rename(projectElement[0].title);
|
|
420
|
-
sessionStorage.setItem('projectId', projectElement[0].id);
|
|
421
|
-
sessionStorage.setItem('email', projectElement[0].email);
|
|
422
|
-
sessionStorage.setItem('firstName', projectElement[0].firstName);
|
|
423
|
-
sessionStorage.setItem('lastName', projectElement[0].lastName);
|
|
424
|
-
sessionStorage.setItem('phone', projectElement[0].phone);
|
|
425
|
-
if (!projectElement[0].project_data) {
|
|
426
|
-
_context.next = 2;
|
|
427
|
-
break;
|
|
428
|
-
}
|
|
429
|
-
jsonData = JSON.parse(projectElement[0].project_data);
|
|
430
|
-
_context.next = 5;
|
|
431
|
-
break;
|
|
432
|
-
case 2:
|
|
433
|
-
_context.prev = 2;
|
|
434
|
-
_context.next = 3;
|
|
435
|
-
return _axios["default"].post("".concat(constants.API_SERVER_URL, "/api/project/loadPidData"), {
|
|
436
|
-
pid: match.params.pid
|
|
437
|
-
}).data.data;
|
|
438
|
-
case 3:
|
|
439
|
-
jsonData = _context.sent;
|
|
440
|
-
_context.next = 5;
|
|
441
|
-
break;
|
|
442
|
-
case 4:
|
|
443
|
-
_context.prev = 4;
|
|
444
|
-
_t = _context["catch"](2);
|
|
445
|
-
_this3.setState({
|
|
446
|
-
isSnackBarOpen: true,
|
|
447
|
-
snackBarMessage: _t
|
|
448
|
-
});
|
|
449
|
-
case 5:
|
|
450
|
-
jsonData.isLoadingCabinet = false;
|
|
451
|
-
projectActions.loadProject(jsonData, _this3.props.categoryData);
|
|
452
|
-
case 6:
|
|
453
|
-
case "end":
|
|
454
|
-
return _context.stop();
|
|
455
|
-
}
|
|
456
|
-
}, _callee, null, [[2, 4]]);
|
|
457
|
-
}));
|
|
458
|
-
return function (_x) {
|
|
459
|
-
return _ref.apply(this, arguments);
|
|
460
|
-
};
|
|
461
|
-
}());
|
|
462
|
-
}
|
|
463
|
-
sessionStorage.removeItem('user_type');
|
|
464
|
-
sessionStorage.removeItem('project_type');
|
|
465
|
-
sessionStorage.removeItem('project_timeline');
|
|
466
|
-
}
|
|
467
366
|
}
|
|
468
367
|
}, {
|
|
469
368
|
key: "componentWillUnmount",
|
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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); 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,6 +258,8 @@ 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,
|
|
261
263
|
_ref2$appliances = _ref2.appliances,
|
|
262
264
|
appliances = _ref2$appliances === void 0 ? [] : _ref2$appliances,
|
|
263
265
|
_ref2$furnishing = _ref2.furnishing,
|
|
@@ -269,10 +271,14 @@ function LiteRenderer(props) {
|
|
|
269
271
|
var id = configData.id,
|
|
270
272
|
logoImg = configData.logoImg,
|
|
271
273
|
companyUrl = configData.companyUrl;
|
|
272
|
-
var _React$useState = _react["default"].useState(
|
|
274
|
+
var _React$useState = _react["default"].useState([]),
|
|
273
275
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
274
|
-
|
|
275
|
-
|
|
276
|
+
outlineSVGData = _React$useState2[0],
|
|
277
|
+
setOutlineSVGData = _React$useState2[1];
|
|
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];
|
|
276
282
|
(0, _react.useEffect)(function () {
|
|
277
283
|
var initMyCatalog = /*#__PURE__*/function () {
|
|
278
284
|
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
@@ -391,36 +397,121 @@ function LiteRenderer(props) {
|
|
|
391
397
|
return _ref4.apply(this, arguments);
|
|
392
398
|
};
|
|
393
399
|
}();
|
|
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
|
+
}();
|
|
394
473
|
var initCatalog = /*#__PURE__*/function () {
|
|
395
|
-
var
|
|
396
|
-
return _regenerator["default"].wrap(function (
|
|
397
|
-
while (1) switch (
|
|
474
|
+
var _ref7 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
475
|
+
return _regenerator["default"].wrap(function (_context5) {
|
|
476
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
398
477
|
case 0:
|
|
399
478
|
setCatalogInitiated(false);
|
|
400
|
-
|
|
479
|
+
_context5.next = 1;
|
|
401
480
|
return initMyCatalog();
|
|
402
481
|
case 1:
|
|
403
|
-
|
|
482
|
+
_context5.next = 2;
|
|
404
483
|
return loadMoldings();
|
|
405
484
|
case 2:
|
|
406
|
-
|
|
485
|
+
_context5.next = 3;
|
|
486
|
+
return loadSVGs();
|
|
407
487
|
case 3:
|
|
488
|
+
setCatalogInitiated(true);
|
|
489
|
+
case 4:
|
|
408
490
|
case "end":
|
|
409
|
-
return
|
|
491
|
+
return _context5.stop();
|
|
410
492
|
}
|
|
411
|
-
},
|
|
493
|
+
}, _callee5);
|
|
412
494
|
}));
|
|
413
495
|
return function initCatalog() {
|
|
414
|
-
return
|
|
496
|
+
return _ref7.apply(this, arguments);
|
|
415
497
|
};
|
|
416
498
|
}();
|
|
417
499
|
initCatalog();
|
|
418
500
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
419
|
-
}, []);
|
|
501
|
+
}, [categoryData, data, id, catalogs, colorAlias, subgroups]);
|
|
420
502
|
|
|
421
503
|
// Register items once SVGs are loaded
|
|
422
504
|
(0, _react.useEffect)(function () {
|
|
505
|
+
if (!outlineSVGData.length) return;
|
|
423
506
|
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
|
+
});
|
|
424
515
|
appliances.forEach(function (obj) {
|
|
425
516
|
Item.push((0, _exporter["default"])(_objectSpread(_objectSpread({}, obj), {}, {
|
|
426
517
|
render2DItem: _itemLoader.render2DItem,
|
|
@@ -443,10 +534,17 @@ function LiteRenderer(props) {
|
|
|
443
534
|
})));
|
|
444
535
|
});
|
|
445
536
|
for (var x in Item) MyCatalog.registerElement(Item[x]);
|
|
446
|
-
}, [appliances, furnishing, lighting]);
|
|
537
|
+
}, [outlineSVGData, data, appliances, furnishing, lighting]);
|
|
447
538
|
(0, _react.useEffect)(function () {
|
|
448
539
|
if (projectElement.length === 0) return;
|
|
449
540
|
if (!catalogInitiated) return;
|
|
541
|
+
store.dispatch((0, _projectActions.initCatalog)(MyCatalog));
|
|
542
|
+
if (sessionStorage.getItem(window.location.href)) {
|
|
543
|
+
var _jsonData = sessionStorage.getItem(window.location.href);
|
|
544
|
+
store.dispatch((0, _projectActions.loadProject)(JSON.parse(_jsonData), categoryData));
|
|
545
|
+
sessionStorage.removeItem(window.location.href);
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
450
548
|
sessionStorage.setItem('projectTitle', projectElement[0].title);
|
|
451
549
|
store.dispatch((0, _projectActions.rename)(projectElement[0].title));
|
|
452
550
|
sessionStorage.setItem('projectId', projectElement[0].id);
|
|
@@ -474,6 +572,7 @@ function LiteRenderer(props) {
|
|
|
474
572
|
return state.get('KitchenConfigurator');
|
|
475
573
|
},
|
|
476
574
|
categoryData: categoryData,
|
|
575
|
+
data: data,
|
|
477
576
|
configData: configData,
|
|
478
577
|
externalEvent: externalEvent
|
|
479
578
|
}, passThrough)))));
|
package/lib/catalog/catalog.js
CHANGED
|
@@ -254,10 +254,7 @@ var Catalog = exports["default"] = /*#__PURE__*/function () {
|
|
|
254
254
|
if (name === '') {
|
|
255
255
|
throw new Error('Category has empty name');
|
|
256
256
|
}
|
|
257
|
-
|
|
258
|
-
throw new Error('Category has already been registered');
|
|
259
|
-
}
|
|
260
|
-
return true;
|
|
257
|
+
return !this.hasCategory(name);
|
|
261
258
|
}
|
|
262
259
|
|
|
263
260
|
/**
|
|
@@ -1319,7 +1319,7 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1319
1319
|
},
|
|
1320
1320
|
width: width - rulerSize,
|
|
1321
1321
|
height: height - rulerSize,
|
|
1322
|
-
value: viewer2D.isEmpty() ?
|
|
1322
|
+
value: viewer2D.isEmpty() ? _reactSvgPanZoom.INITIAL_VALUE : viewer2D.toJS(),
|
|
1323
1323
|
onChangeValue: onChangeValue,
|
|
1324
1324
|
tool: mode2Tool(mode),
|
|
1325
1325
|
onChangeTool: onChangeTool,
|
|
@@ -1327,8 +1327,9 @@ function Viewer2D(_ref, _ref2) {
|
|
|
1327
1327
|
onMouseDown: onMouseDown,
|
|
1328
1328
|
onMouseMove: onMouseMove,
|
|
1329
1329
|
onMouseUp: onMouseUp,
|
|
1330
|
-
|
|
1331
|
-
|
|
1330
|
+
toolbarProps: {
|
|
1331
|
+
position: _reactSvgPanZoom.POSITION_NONE
|
|
1332
|
+
},
|
|
1332
1333
|
detectPinchGesture: false,
|
|
1333
1334
|
disableDoubleClickZoomWithToolAuto: true,
|
|
1334
1335
|
ref: Viewer
|
package/lib/devLiteRenderer.js
CHANGED
|
@@ -7,7 +7,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
var _reactContainerDimensions = _interopRequireDefault(require("react-container-dimensions"));
|
|
8
8
|
var _mockProps = _interopRequireDefault(require("./mocks/mockProps.json"));
|
|
9
9
|
var _categoryData = _interopRequireDefault(require("./mocks/categoryData.json"));
|
|
10
|
-
var _dataBundle = _interopRequireDefault(require("./mocks/
|
|
10
|
+
var _dataBundle = _interopRequireDefault(require("./mocks/dataBundle2.json"));
|
|
11
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"));
|
|
@@ -13,6 +13,8 @@ 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");
|
|
16
18
|
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; }
|
|
17
19
|
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; }
|
|
18
20
|
var loadSVGsByItem = /*#__PURE__*/function () {
|
|
@@ -123,6 +125,7 @@ function _handleExternalEvent() {
|
|
|
123
125
|
render3DItem: _itemLoader.render3DItem
|
|
124
126
|
}));
|
|
125
127
|
if (catalogInstance !== null && catalogInstance !== void 0 && catalogInstance.validateElement(elementJs)) {
|
|
128
|
+
catalogInstance.registerElement(elementJs);
|
|
126
129
|
props.projectActions.addElementToCatalog(elementJs);
|
|
127
130
|
}
|
|
128
131
|
case 7:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kitchen-simulator",
|
|
3
|
-
"version": "1.0.0-alin.
|
|
3
|
+
"version": "1.0.0-alin.46",
|
|
4
4
|
"description": "It is a kitchen simulator (self-contained micro-frontend).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"react-hotjar": "^1.0.11",
|
|
83
83
|
"react-icons": "3.5.0",
|
|
84
84
|
"react-redux": "5.0.7",
|
|
85
|
-
"react-svg-pan-zoom": "
|
|
85
|
+
"react-svg-pan-zoom": "^3.13.1",
|
|
86
86
|
"redux": "4.0.1",
|
|
87
87
|
"three": "0.166.0",
|
|
88
88
|
"moment": "^2.30.1",
|