kitchen-simulator 1.0.0-alin.5 → 1.0.0-alin.51
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 +15 -133
- package/es/LiteRenderer.js +2 -26
- package/es/actions/items-actions.js +1 -2
- package/es/class/item.js +1 -1
- package/es/class/project.js +8 -1
- package/es/components/viewer2d/item.js +10 -10
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +20 -17
- package/es/components/viewer2d/viewer2d.js +20 -56
- package/es/components/viewer3d/viewer3d.js +0 -2
- package/es/constants.js +7 -1
- package/es/devLiteRenderer.js +70 -5
- package/es/index.js +13 -12
- package/es/reducers/items-reducer.js +1 -1
- package/es/utils/geometry.js +6 -6
- package/es/utils/isolate-event-handler.js +87 -17
- package/lib/LiteKitchenConfigurator.js +16 -134
- package/lib/LiteRenderer.js +1 -25
- package/lib/actions/items-actions.js +1 -2
- package/lib/class/item.js +1 -1
- package/lib/class/project.js +8 -1
- package/lib/components/viewer2d/item.js +10 -10
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +19 -16
- package/lib/components/viewer2d/viewer2d.js +19 -55
- package/lib/components/viewer3d/viewer3d.js +0 -2
- package/lib/constants.js +11 -5
- package/lib/devLiteRenderer.js +69 -4
- package/lib/index.js +13 -12
- package/lib/reducers/items-reducer.js +1 -1
- package/lib/utils/geometry.js +6 -6
- package/lib/utils/isolate-event-handler.js +86 -16
- package/package.json +3 -3
|
@@ -2559,7 +2559,6 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2559
2559
|
}));
|
|
2560
2560
|
} else {
|
|
2561
2561
|
document.getElementById('front') && (document.getElementById('front').style.display = 'none');
|
|
2562
|
-
document.getElementById('error').style.display = 'none';
|
|
2563
2562
|
this.renderer.domElement.style.display = 'none';
|
|
2564
2563
|
return /*#__PURE__*/React.createElement("div", {
|
|
2565
2564
|
style: {
|
|
@@ -2594,7 +2593,6 @@ var Scene3DViewer = /*#__PURE__*/function (_React$Component) {
|
|
|
2594
2593
|
alt: "img"
|
|
2595
2594
|
}));
|
|
2596
2595
|
} else {
|
|
2597
|
-
!this.props.downloadFlag && (document.getElementById('error').style.display = 'block');
|
|
2598
2596
|
this.renderer.domElement.style.pointerEvents = 'auto';
|
|
2599
2597
|
this.renderer.domElement.style.opacity = '1';
|
|
2600
2598
|
!this.props.downloadFlag && document.getElementById('front') && (document.getElementById('front').style.display = 'block');
|
package/es/constants.js
CHANGED
|
@@ -579,6 +579,7 @@ export var ANIMATE_OBJECT_OPEN_DOOR_ROTATION_UNIT = 0.1;
|
|
|
579
579
|
export var DIFFERENT_VALUES_PATH_LENGTH = 5;
|
|
580
580
|
export var MIN_ANGLE_DISALLOW_DRAW_WALL = 45;
|
|
581
581
|
export var UNIT_ANGLE = 5;
|
|
582
|
+
export var MAX_ANGLE_SCALE = 30;
|
|
582
583
|
export var HDR_URLS = ['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'];
|
|
583
584
|
export var SUBMIT_REQUEST_ASSIST = 'submit';
|
|
584
585
|
export var SUBMIT_ADD_CART = 'addCart';
|
|
@@ -650,4 +651,9 @@ export var EXTERNAL_EVENT_TOGGLE_TO_ELEVATION = 'EXTERNAL_EVENT_TOGGLE_TO_ELEVAT
|
|
|
650
651
|
export var EXTERNAL_EVENT_ADD_WALL = 'EXTERNAL_EVENT_ADD_WALL';
|
|
651
652
|
export var EXTERNAL_EVENT_ADD_ITEM = 'EXTERNAL_EVENT_ADD_ITEM';
|
|
652
653
|
export var EXTERNAL_EVENT_MOVE_PAN = 'EXTERNAL_EVENT_MOVE_PAN';
|
|
653
|
-
export var EXTERNAL_EVENT_NEW_PROJECT = 'EXTERNAL_EVENT_NEW_PROJECT';
|
|
654
|
+
export var EXTERNAL_EVENT_NEW_PROJECT = 'EXTERNAL_EVENT_NEW_PROJECT';
|
|
655
|
+
export var EXTERNAL_EVENT_CHANGE_DOORSTYLE = 'EXTERNAL_EVENT_CHANGE_DOORSTYLE';
|
|
656
|
+
export var EXTERNAL_EVENT_SET_INITIAL_DATA = 'EXTERNAL_EVENT_SET_INITIAL_DATA';
|
|
657
|
+
export var EXTERNAL_EVENT_ADD_ROOM_SHAPE = 'EXTERNAL_EVENT_ADD_ROOM_SHAPE';
|
|
658
|
+
export var EXTERNAL_EVENT_ZOOM_IN = 'EXTERNAL_EVENT_ZOOM_IN';
|
|
659
|
+
export var EXTERNAL_EVENT_ZOOM_OUT = 'EXTERNAL_EVENT_ZOOM_OUT';
|
package/es/devLiteRenderer.js
CHANGED
|
@@ -5,10 +5,13 @@ import mockProps from "./mocks/mockProps.json";
|
|
|
5
5
|
import mockCategoryData from "./mocks/categoryData.json";
|
|
6
6
|
import mockDataBundle from "./mocks/dataBundle.json";
|
|
7
7
|
import cabinetPaylod from "./mocks/cabinetPayload.json";
|
|
8
|
+
import doorStylePaylod from "./mocks/doorStylePayload.json";
|
|
9
|
+
import oStylePaylod from "./mocks/oStylePayload.json";
|
|
10
|
+
import rectangleData from "./mocks/rectangleShape.json";
|
|
8
11
|
import ReactDOM from 'react-dom';
|
|
9
12
|
import LiteRenderer from "./LiteRenderer";
|
|
10
13
|
import { Button } from 'antd';
|
|
11
|
-
import { LEFT, RIGHT, TOP, BOTTOM, EXTERNAL_EVENT_ADD_ITEM, EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, EXTERNAL_EVENT_NEW_PROJECT } from "./constants";
|
|
14
|
+
import { LEFT, RIGHT, TOP, BOTTOM, EXTERNAL_EVENT_ADD_ITEM, EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_SET_INITIAL_DATA, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT } from "./constants";
|
|
12
15
|
|
|
13
16
|
// --- renderer props ---
|
|
14
17
|
var options = {
|
|
@@ -22,6 +25,18 @@ function WorkSpace(props) {
|
|
|
22
25
|
externalEvent = _useState2[0],
|
|
23
26
|
setExternalEvent = _useState2[1];
|
|
24
27
|
var offset = 5;
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
var evt = {
|
|
30
|
+
type: EXTERNAL_EVENT_SET_INITIAL_DATA,
|
|
31
|
+
payload: {
|
|
32
|
+
doorStyle: {
|
|
33
|
+
doorStyle: doorStylePaylod,
|
|
34
|
+
oStyle: oStylePaylod
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
setExternalEvent(evt);
|
|
39
|
+
}, []);
|
|
25
40
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
41
|
className: "flex gap-4"
|
|
27
42
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -107,6 +122,28 @@ function WorkSpace(props) {
|
|
|
107
122
|
}
|
|
108
123
|
}, /*#__PURE__*/React.createElement("img", {
|
|
109
124
|
src: "/assets/img/svg/bottombar/arrow-right.svg"
|
|
125
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
126
|
+
actionType: "primary",
|
|
127
|
+
onClick: function onClick() {
|
|
128
|
+
var evt = {
|
|
129
|
+
type: EXTERNAL_EVENT_ZOOM_IN,
|
|
130
|
+
payload: {}
|
|
131
|
+
};
|
|
132
|
+
setExternalEvent(evt);
|
|
133
|
+
}
|
|
134
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
135
|
+
src: "/assets/img/svg/bottombar/arrow-minus.svg"
|
|
136
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
137
|
+
actionType: "primary",
|
|
138
|
+
onClick: function onClick() {
|
|
139
|
+
var evt = {
|
|
140
|
+
type: EXTERNAL_EVENT_ZOOM_OUT,
|
|
141
|
+
payload: {}
|
|
142
|
+
};
|
|
143
|
+
setExternalEvent(evt);
|
|
144
|
+
}
|
|
145
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
146
|
+
src: "/assets/img/svg/bottombar/arrow-plus.svg"
|
|
110
147
|
})), /*#__PURE__*/React.createElement(Button, {
|
|
111
148
|
actionType: "primary",
|
|
112
149
|
onClick: function onClick() {
|
|
@@ -134,9 +171,30 @@ function WorkSpace(props) {
|
|
|
134
171
|
};
|
|
135
172
|
setExternalEvent(evt);
|
|
136
173
|
}
|
|
137
|
-
}, "Add B12 Cabinet"), /*#__PURE__*/React.createElement(
|
|
138
|
-
|
|
139
|
-
|
|
174
|
+
}, "Add B12 Cabinet"), /*#__PURE__*/React.createElement(Button, {
|
|
175
|
+
actionType: "danger",
|
|
176
|
+
onClick: function onClick() {
|
|
177
|
+
var evt = {
|
|
178
|
+
type: EXTERNAL_EVENT_CHANGE_DOORSTYLE,
|
|
179
|
+
payload: {
|
|
180
|
+
doorStyle: doorStylePaylod,
|
|
181
|
+
isAll: true
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
setExternalEvent(evt);
|
|
185
|
+
}
|
|
186
|
+
}, "DoorStyle (Change into Midtown White Shaker)"), /*#__PURE__*/React.createElement(Button, {
|
|
187
|
+
actionType: "danger",
|
|
188
|
+
onClick: function onClick() {
|
|
189
|
+
var evt = {
|
|
190
|
+
type: EXTERNAL_EVENT_ADD_ROOM_SHAPE,
|
|
191
|
+
payload: rectangleData
|
|
192
|
+
};
|
|
193
|
+
setExternalEvent(evt);
|
|
194
|
+
}
|
|
195
|
+
}, "Add Room shape(rectangle)"), /*#__PURE__*/React.createElement(LiteRenderer, {
|
|
196
|
+
width: props.width,
|
|
197
|
+
height: props.height,
|
|
140
198
|
projectElement: mockProps.projectElement,
|
|
141
199
|
categoryData: mockCategoryData,
|
|
142
200
|
dataBundle: mockDataBundle,
|
|
@@ -158,4 +216,11 @@ function WorkSpace(props) {
|
|
|
158
216
|
}
|
|
159
217
|
}));
|
|
160
218
|
}
|
|
161
|
-
ReactDOM.render(/*#__PURE__*/React.createElement(
|
|
219
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(ContainerDimensions, null, function (_ref) {
|
|
220
|
+
var width = _ref.width,
|
|
221
|
+
height = _ref.height;
|
|
222
|
+
return /*#__PURE__*/React.createElement(WorkSpace, {
|
|
223
|
+
width: width,
|
|
224
|
+
height: height
|
|
225
|
+
});
|
|
226
|
+
}), document.getElementById('app'));
|
package/es/index.js
CHANGED
|
@@ -7,19 +7,20 @@ import LiteRenderer from "./LiteRenderer";
|
|
|
7
7
|
export function renderKitchenSimulator(container) {
|
|
8
8
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9
9
|
var currentProps = props;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
render(props);
|
|
10
|
+
|
|
11
|
+
// Initial render
|
|
12
|
+
var root = ReactDOM.render(/*#__PURE__*/React.createElement(LiteRenderer, props), container);
|
|
14
13
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
root: root,
|
|
15
|
+
updateExternalEvent: function updateExternalEvent(newExternalEvent) {
|
|
16
|
+
var prevEvent = currentProps.externalEvent;
|
|
17
|
+
var isSameEvent = prevEvent && newExternalEvent && prevEvent.type === newExternalEvent.type && JSON.stringify(prevEvent.payload) === JSON.stringify(newExternalEvent.payload);
|
|
18
|
+
if (!isSameEvent) {
|
|
19
|
+
currentProps = _objectSpread(_objectSpread({}, currentProps), {}, {
|
|
20
|
+
externalEvent: newExternalEvent
|
|
21
|
+
});
|
|
22
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(LiteRenderer, currentProps), container);
|
|
23
|
+
}
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
26
|
}
|
|
@@ -105,7 +105,7 @@ export default function (state, action) {
|
|
|
105
105
|
case SELECT_TOOL_DRAWING_ITEM_3D:
|
|
106
106
|
return Item.selectToolDrawingItem3D(state, action.sceneComponentType).updatedState;
|
|
107
107
|
case SET_DOOR_STYLE:
|
|
108
|
-
return Item.setDoorStyle(state, action.doorStyle, action.
|
|
108
|
+
return Item.setDoorStyle(state, action.doorStyle, action.isAll).updatedState;
|
|
109
109
|
case SET_HANDLE_MATERIAL:
|
|
110
110
|
return Item.setHandleMaterial(state, action.material).updatedState;
|
|
111
111
|
case SET_DOOR_HANDLE:
|
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;
|
|
@@ -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 _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import { fromJS, List, Map, Record } from 'immutable';
|
|
7
|
-
import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT } from "../constants";
|
|
7
|
+
import { EXTERNAL_EVENT_ADD_WALL, EXTERNAL_EVENT_TOGGLE_TO_3D, EXTERNAL_EVENT_TOGGLE_TO_2D, EXTERNAL_EVENT_TOGGLE_TO_ELEVATION, EXTERNAL_EVENT_MOVE_PAN, MODE_IDLE, MODE_2D_PAN, EXTERNAL_EVENT_ADD_ITEM, ARRAY_3D_MODES, MODE_IDLE_3D, MODE_ELEVATION_VIEW, TOP, BOTTOM, LEFT, RIGHT, EXTERNAL_EVENT_NEW_PROJECT, EXTERNAL_EVENT_CHANGE_DOORSTYLE, EXTERNAL_EVENT_SET_INITIAL_DATA, EXTERNAL_EVENT_ADD_ROOM_SHAPE, EXTERNAL_EVENT_ZOOM_IN, EXTERNAL_EVENT_ZOOM_OUT, ZOOM_VARIABLE } from "../constants";
|
|
8
8
|
import { isEmpty } from "./helper";
|
|
9
9
|
import exporter from "../catalog/utils/exporter";
|
|
10
10
|
import { render2DItem, render3DItem } from "../catalog/utils/item-loader";
|
|
@@ -62,42 +62,46 @@ var loadSVGsByItem = /*#__PURE__*/function () {
|
|
|
62
62
|
return _ref.apply(this, arguments);
|
|
63
63
|
};
|
|
64
64
|
}();
|
|
65
|
-
|
|
65
|
+
var compareSVGRect = function compareSVGRect(value) {
|
|
66
|
+
return value.e <= 10 && value.e + value.a * value.SVGWidth + 10 >= value.viewerWidth && value.f <= 80 && value.f + value.d * value.SVGHeight + 10 >= value.viewerHeight ? true : false;
|
|
67
|
+
};
|
|
68
|
+
export function handleExternalEvent(_x2) {
|
|
66
69
|
return _handleExternalEvent.apply(this, arguments);
|
|
67
70
|
}
|
|
68
71
|
function _handleExternalEvent() {
|
|
69
|
-
_handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(
|
|
70
|
-
var state, sLineCnt, element, catalog, outlineSVGData, catalogInstance, elementJs, _evt$payload, moveType, moveValue, value, defaulTitle, _t2, _t3;
|
|
72
|
+
_handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(props) {
|
|
73
|
+
var evt, state, sLineCnt, element, catalog, outlineSVGData, catalogInstance, elementJs, _evt$payload, moveType, moveValue, value, defaulTitle, _evt$payload2, doorStyle, isAll, _doorStyle, _value, _zoomValue, _value2, _zoomValue2, _t2, _t3;
|
|
71
74
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
72
75
|
while (1) switch (_context2.prev = _context2.next) {
|
|
73
76
|
case 0:
|
|
74
|
-
|
|
77
|
+
evt = props.externalEvent;
|
|
78
|
+
state = props.state.get('KitchenConfigurator');
|
|
75
79
|
_t2 = evt === null || evt === void 0 ? void 0 : evt.type;
|
|
76
|
-
_context2.next = _t2 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 1 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 2 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 3 : _t2 === EXTERNAL_EVENT_ADD_WALL ? 4 : _t2 === EXTERNAL_EVENT_ADD_ITEM ? 5 : _t2 === EXTERNAL_EVENT_MOVE_PAN ? 9 : _t2 === EXTERNAL_EVENT_NEW_PROJECT ? 15 : 16;
|
|
80
|
+
_context2.next = _t2 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 1 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 2 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 3 : _t2 === EXTERNAL_EVENT_ADD_WALL ? 4 : _t2 === EXTERNAL_EVENT_ADD_ITEM ? 5 : _t2 === EXTERNAL_EVENT_MOVE_PAN ? 9 : _t2 === EXTERNAL_EVENT_NEW_PROJECT ? 15 : _t2 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 16 : _t2 === EXTERNAL_EVENT_SET_INITIAL_DATA ? 17 : _t2 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 18 : _t2 === EXTERNAL_EVENT_ZOOM_IN ? 19 : _t2 === EXTERNAL_EVENT_ZOOM_OUT ? 22 : 25;
|
|
77
81
|
break;
|
|
78
82
|
case 1:
|
|
79
83
|
props.projectActions.setMode(MODE_IDLE_3D);
|
|
80
|
-
return _context2.abrupt("continue",
|
|
84
|
+
return _context2.abrupt("continue", 25);
|
|
81
85
|
case 2:
|
|
82
86
|
props.projectActions.setMode(MODE_IDLE);
|
|
83
|
-
return _context2.abrupt("continue",
|
|
87
|
+
return _context2.abrupt("continue", 25);
|
|
84
88
|
case 3:
|
|
85
|
-
sLineCnt = state.getIn(['
|
|
89
|
+
sLineCnt = state.getIn(['scene', 'layers', 'layer-1', 'selected', 'lines']).size;
|
|
86
90
|
if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW);
|
|
87
|
-
return _context2.abrupt("continue",
|
|
91
|
+
return _context2.abrupt("continue", 25);
|
|
88
92
|
case 4:
|
|
89
93
|
if (state.mode === MODE_IDLE || state.mode === MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
90
94
|
props.projectActions.setMode(MODE_IDLE);
|
|
91
95
|
props.linesActions.selectToolDrawingLine('wall');
|
|
92
96
|
}
|
|
93
|
-
return _context2.abrupt("continue",
|
|
97
|
+
return _context2.abrupt("continue", 25);
|
|
94
98
|
case 5:
|
|
95
99
|
if (isEmpty(evt === null || evt === void 0 ? void 0 : evt.payload)) {
|
|
96
100
|
_context2.next = 8;
|
|
97
101
|
break;
|
|
98
102
|
}
|
|
99
103
|
element = evt.payload;
|
|
100
|
-
catalog = state.getIn(['
|
|
104
|
+
catalog = state.getIn(['catalog']).toJS(); // add item to catalog of state
|
|
101
105
|
if (!isEmpty(catalog === null || catalog === void 0 ? void 0 : catalog.elements[element.name])) {
|
|
102
106
|
_context2.next = 7;
|
|
103
107
|
break;
|
|
@@ -114,6 +118,7 @@ function _handleExternalEvent() {
|
|
|
114
118
|
render3DItem: render3DItem
|
|
115
119
|
}));
|
|
116
120
|
if (catalogInstance !== null && catalogInstance !== void 0 && catalogInstance.validateElement(elementJs)) {
|
|
121
|
+
catalogInstance.registerElement(elementJs);
|
|
117
122
|
props.projectActions.addElementToCatalog(elementJs);
|
|
118
123
|
}
|
|
119
124
|
case 7:
|
|
@@ -122,10 +127,10 @@ function _handleExternalEvent() {
|
|
|
122
127
|
props.projectActions.pushLastSelectedCatalogElementToHistory(element);
|
|
123
128
|
props.projectActions.setIsCabinetDrawing(true);
|
|
124
129
|
case 8:
|
|
125
|
-
return _context2.abrupt("continue",
|
|
130
|
+
return _context2.abrupt("continue", 25);
|
|
126
131
|
case 9:
|
|
127
132
|
_evt$payload = evt.payload, moveType = _evt$payload.moveType, moveValue = _evt$payload.moveValue;
|
|
128
|
-
value = state.getIn(['
|
|
133
|
+
value = state.getIn(['viewer2D']).toJS();
|
|
129
134
|
_t3 = moveType;
|
|
130
135
|
_context2.next = _t3 === TOP ? 10 : _t3 === BOTTOM ? 11 : _t3 === RIGHT ? 12 : _t3 === LEFT ? 13 : 14;
|
|
131
136
|
break;
|
|
@@ -142,14 +147,79 @@ function _handleExternalEvent() {
|
|
|
142
147
|
value.e -= moveValue;
|
|
143
148
|
return _context2.abrupt("continue", 14);
|
|
144
149
|
case 14:
|
|
145
|
-
if (value
|
|
146
|
-
return _context2.abrupt("continue",
|
|
150
|
+
if (compareSVGRect(value)) props.viewer2DActions.updateCameraView(value);
|
|
151
|
+
return _context2.abrupt("continue", 25);
|
|
147
152
|
case 15:
|
|
148
153
|
defaulTitle = 'Untitle';
|
|
149
154
|
props.projectActions.newProject();
|
|
150
155
|
props.projectActions.rename(defaulTitle);
|
|
151
|
-
return _context2.abrupt("continue",
|
|
156
|
+
return _context2.abrupt("continue", 25);
|
|
152
157
|
case 16:
|
|
158
|
+
_evt$payload2 = evt.payload, doorStyle = _evt$payload2.doorStyle, isAll = _evt$payload2.isAll;
|
|
159
|
+
props.itemsActions.setDoorStyle(doorStyle, isAll);
|
|
160
|
+
return _context2.abrupt("continue", 25);
|
|
161
|
+
case 17:
|
|
162
|
+
_doorStyle = evt.payload.doorStyle;
|
|
163
|
+
props.itemsActions.setInitialDoorStyle(_doorStyle.doorStyle, _doorStyle.oStyle);
|
|
164
|
+
return _context2.abrupt("continue", 25);
|
|
165
|
+
case 18:
|
|
166
|
+
props.projectActions.loadProject(evt.payload, props.categoryData);
|
|
167
|
+
return _context2.abrupt("continue", 25);
|
|
168
|
+
case 19:
|
|
169
|
+
_value = state.getIn(['viewer2D']).toJS();
|
|
170
|
+
_value.a -= 0.1;
|
|
171
|
+
_value.d -= 0.1;
|
|
172
|
+
_value.e += _value.SVGWidth * 0.1 / 2;
|
|
173
|
+
_value.f += _value.SVGHeight * 0.1 / 2;
|
|
174
|
+
_zoomValue = parseInt((_value.a - 0.5) / ZOOM_VARIABLE);
|
|
175
|
+
if (!(_zoomValue > 404)) {
|
|
176
|
+
_context2.next = 20;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
return _context2.abrupt("return");
|
|
180
|
+
case 20:
|
|
181
|
+
if (!(_zoomValue < 35 || Number.isNaN(_zoomValue))) {
|
|
182
|
+
_context2.next = 21;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
return _context2.abrupt("return");
|
|
186
|
+
case 21:
|
|
187
|
+
while (!(_value.e <= 10)) {
|
|
188
|
+
_value.e -= 0.1;
|
|
189
|
+
}
|
|
190
|
+
while (!(_value.e + _value.a * _value.SVGWidth + 10 >= _value.viewerWidth)) {
|
|
191
|
+
_value.e += 0.1;
|
|
192
|
+
}
|
|
193
|
+
while (!(_value.f <= 80)) {
|
|
194
|
+
_value.f -= 0.1;
|
|
195
|
+
}
|
|
196
|
+
while (!(_value.f + _value.a * _value.SVGHeight + 10 >= _value.viewerHeight)) {
|
|
197
|
+
_value.f += 0.1;
|
|
198
|
+
}
|
|
199
|
+
if (compareSVGRect(_value)) props.viewer2DActions.updateCameraView(_value);
|
|
200
|
+
return _context2.abrupt("continue", 25);
|
|
201
|
+
case 22:
|
|
202
|
+
_value2 = state.getIn(['viewer2D']).toJS();
|
|
203
|
+
_value2.a += 0.1;
|
|
204
|
+
_value2.d += 0.1;
|
|
205
|
+
_value2.e -= _value2.SVGWidth * 0.1 / 2;
|
|
206
|
+
_value2.f -= _value2.SVGHeight * 0.1 / 2;
|
|
207
|
+
_zoomValue2 = parseInt((_value2.a - 0.5) / ZOOM_VARIABLE);
|
|
208
|
+
if (!(_zoomValue2 > 404)) {
|
|
209
|
+
_context2.next = 23;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
return _context2.abrupt("return");
|
|
213
|
+
case 23:
|
|
214
|
+
if (!(_zoomValue2 < 35 || Number.isNaN(_zoomValue2))) {
|
|
215
|
+
_context2.next = 24;
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
return _context2.abrupt("return");
|
|
219
|
+
case 24:
|
|
220
|
+
if (compareSVGRect(_value2)) props.viewer2DActions.updateCameraView(_value2);
|
|
221
|
+
return _context2.abrupt("continue", 25);
|
|
222
|
+
case 25:
|
|
153
223
|
case "end":
|
|
154
224
|
return _context2.stop();
|
|
155
225
|
}
|
|
@@ -8,15 +8,13 @@ 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"));
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
13
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
16
15
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
18
17
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
18
|
var _axios = _interopRequireDefault(require("axios"));
|
|
21
19
|
var _convertUnitsLite = require("./utils/convert-units-lite");
|
|
22
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -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)); }
|
|
@@ -51,23 +49,6 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
51
49
|
_this = _callSuper(this, LiteKitchenConfigurator, [props]);
|
|
52
50
|
|
|
53
51
|
// utm tracking
|
|
54
|
-
(0, _defineProperty2["default"])(_this, "handleBeforeUnload", function (e) {
|
|
55
|
-
var areas = _this.props.stateExtractor(_this.props.state).getIn(['scene', 'layers', _this.props.stateExtractor(_this.props.state).scene.selectedLayer, 'areas']);
|
|
56
|
-
if (!_this.state.isSaved && areas.size > 0) {
|
|
57
|
-
setTimeout(function () {
|
|
58
|
-
_this.setState({
|
|
59
|
-
savePromptVisible: true,
|
|
60
|
-
isLeaving: true
|
|
61
|
-
});
|
|
62
|
-
}, 500);
|
|
63
|
-
_this.saveProjectToStorage();
|
|
64
|
-
|
|
65
|
-
// This line is required to trigger the browser confirmation dialog
|
|
66
|
-
e.preventDefault();
|
|
67
|
-
e.returnValue = '';
|
|
68
|
-
return '';
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
52
|
var utmDetailParams = new URLSearchParams(_this.props.location && _this.props.location.search);
|
|
72
53
|
var utmStrEncoded = utmDetailParams.get('details');
|
|
73
54
|
var utmRequestData = null;
|
|
@@ -112,7 +93,8 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
112
93
|
redirectURL: '',
|
|
113
94
|
snackBarMessage: '',
|
|
114
95
|
isSaved: false,
|
|
115
|
-
isLeaving: false
|
|
96
|
+
isLeaving: false,
|
|
97
|
+
stateCatalog: _this.props.catalog
|
|
116
98
|
};
|
|
117
99
|
|
|
118
100
|
// For UTM tracking
|
|
@@ -353,129 +335,20 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
353
335
|
}, {
|
|
354
336
|
key: "componentDidMount",
|
|
355
337
|
value: function componentDidMount() {
|
|
356
|
-
var _this3 = this;
|
|
357
|
-
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
358
|
-
console.log('context =>', this.context);
|
|
359
338
|
window.forRedo = [];
|
|
360
339
|
var store = this.context.store;
|
|
361
340
|
var _this$props2 = this.props,
|
|
362
|
-
projectActions = _this$props2.projectActions,
|
|
363
|
-
catalog = _this$props2.catalog,
|
|
364
341
|
stateExtractor = _this$props2.stateExtractor,
|
|
365
|
-
state = _this$props2.state,
|
|
366
342
|
plugins = _this$props2.plugins;
|
|
367
|
-
projectActions.initCatalog(catalog);
|
|
368
|
-
var match = this.props.match;
|
|
369
|
-
if (sessionStorage.getItem(window.location.href)) {
|
|
370
|
-
var jsonData = sessionStorage.getItem(window.location.href);
|
|
371
|
-
projectActions.loadProject(JSON.parse(jsonData), this.props.categoryData);
|
|
372
|
-
sessionStorage.removeItem(window.location.href);
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
343
|
var newplugins = (0, _toConsumableArray2["default"])(plugins);
|
|
376
344
|
newplugins.forEach(function (newplugin) {
|
|
377
345
|
return newplugin(store, stateExtractor);
|
|
378
346
|
});
|
|
379
|
-
if (match && match.params.pid === undefined) {
|
|
380
|
-
projectActions.newProject();
|
|
381
|
-
sessionStorage.setItem('projectTitle', 'Untitled');
|
|
382
|
-
projectActions.rename('Untitled');
|
|
383
|
-
sessionStorage.removeItem('projectId');
|
|
384
|
-
sessionStorage.removeItem('email');
|
|
385
|
-
sessionStorage.removeItem('firstName');
|
|
386
|
-
sessionStorage.removeItem('lastName');
|
|
387
|
-
sessionStorage.removeItem('usedObjects');
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
if (match && match.params.pid !== undefined) {
|
|
391
|
-
if (match.params.pid === 'new') {
|
|
392
|
-
projectActions.newProject();
|
|
393
|
-
sessionStorage.setItem('projectTitle', 'Untitled');
|
|
394
|
-
projectActions.rename('Untitled');
|
|
395
|
-
sessionStorage.removeItem('projectId');
|
|
396
|
-
sessionStorage.removeItem('email');
|
|
397
|
-
sessionStorage.removeItem('firstName');
|
|
398
|
-
sessionStorage.removeItem('lastName');
|
|
399
|
-
sessionStorage.removeItem('usedObjects');
|
|
400
|
-
} else {
|
|
401
|
-
_axios["default"].post("".concat(constants.API_SERVER_URL, "/api/project/loadPidProject"), {
|
|
402
|
-
pid: match.params.pid,
|
|
403
|
-
visualizerName: sessionStorage.getItem('visualizerName')
|
|
404
|
-
}).then(/*#__PURE__*/function () {
|
|
405
|
-
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(response) {
|
|
406
|
-
var projectElement, jsonData, _t;
|
|
407
|
-
return _regenerator["default"].wrap(function (_context) {
|
|
408
|
-
while (1) switch (_context.prev = _context.next) {
|
|
409
|
-
case 0:
|
|
410
|
-
projectElement = response.data.projectElement;
|
|
411
|
-
if (!(projectElement.length === 0)) {
|
|
412
|
-
_context.next = 1;
|
|
413
|
-
break;
|
|
414
|
-
}
|
|
415
|
-
return _context.abrupt("return");
|
|
416
|
-
case 1:
|
|
417
|
-
sessionStorage.setItem('projectTitle', projectElement[0].title);
|
|
418
|
-
projectActions.rename(projectElement[0].title);
|
|
419
|
-
sessionStorage.setItem('projectId', projectElement[0].id);
|
|
420
|
-
sessionStorage.setItem('email', projectElement[0].email);
|
|
421
|
-
sessionStorage.setItem('firstName', projectElement[0].firstName);
|
|
422
|
-
sessionStorage.setItem('lastName', projectElement[0].lastName);
|
|
423
|
-
sessionStorage.setItem('phone', projectElement[0].phone);
|
|
424
|
-
if (!projectElement[0].project_data) {
|
|
425
|
-
_context.next = 2;
|
|
426
|
-
break;
|
|
427
|
-
}
|
|
428
|
-
jsonData = JSON.parse(projectElement[0].project_data);
|
|
429
|
-
_context.next = 5;
|
|
430
|
-
break;
|
|
431
|
-
case 2:
|
|
432
|
-
_context.prev = 2;
|
|
433
|
-
_context.next = 3;
|
|
434
|
-
return _axios["default"].post("".concat(constants.API_SERVER_URL, "/api/project/loadPidData"), {
|
|
435
|
-
pid: match.params.pid
|
|
436
|
-
}).data.data;
|
|
437
|
-
case 3:
|
|
438
|
-
jsonData = _context.sent;
|
|
439
|
-
_context.next = 5;
|
|
440
|
-
break;
|
|
441
|
-
case 4:
|
|
442
|
-
_context.prev = 4;
|
|
443
|
-
_t = _context["catch"](2);
|
|
444
|
-
_this3.setState({
|
|
445
|
-
isSnackBarOpen: true,
|
|
446
|
-
snackBarMessage: _t
|
|
447
|
-
});
|
|
448
|
-
case 5:
|
|
449
|
-
jsonData.isLoadingCabinet = false;
|
|
450
|
-
projectActions.loadProject(jsonData, _this3.props.categoryData);
|
|
451
|
-
case 6:
|
|
452
|
-
case "end":
|
|
453
|
-
return _context.stop();
|
|
454
|
-
}
|
|
455
|
-
}, _callee, null, [[2, 4]]);
|
|
456
|
-
}));
|
|
457
|
-
return function (_x) {
|
|
458
|
-
return _ref.apply(this, arguments);
|
|
459
|
-
};
|
|
460
|
-
}());
|
|
461
|
-
}
|
|
462
|
-
sessionStorage.removeItem('user_type');
|
|
463
|
-
sessionStorage.removeItem('project_type');
|
|
464
|
-
sessionStorage.removeItem('project_timeline');
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}, {
|
|
468
|
-
key: "componentWillUnmount",
|
|
469
|
-
value: function componentWillUnmount() {
|
|
470
|
-
window.addEventListener('beforeunload', this.handleBeforeUnload);
|
|
471
|
-
window.onbeforeunload = null;
|
|
472
347
|
}
|
|
473
|
-
}, {
|
|
474
|
-
key: "componentWillMount",
|
|
475
|
-
value: function componentWillMount() {}
|
|
476
348
|
}, {
|
|
477
349
|
key: "componentWillReceiveProps",
|
|
478
350
|
value: function componentWillReceiveProps(nextProps) {
|
|
351
|
+
var _oldState$catalog, _plannerState$catalog;
|
|
479
352
|
var stateExtractor = nextProps.stateExtractor,
|
|
480
353
|
state = nextProps.state,
|
|
481
354
|
projectActions = nextProps.projectActions,
|
|
@@ -484,9 +357,18 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
484
357
|
|
|
485
358
|
// handle external events
|
|
486
359
|
if (this.props.externalEvent !== externalEvent) {
|
|
487
|
-
(0, _isolateEventHandler.handleExternalEvent)(
|
|
360
|
+
(0, _isolateEventHandler.handleExternalEvent)(nextProps);
|
|
488
361
|
}
|
|
489
362
|
var plannerState = stateExtractor(state);
|
|
363
|
+
var oldState = stateExtractor(this.props.state);
|
|
364
|
+
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)) {
|
|
365
|
+
// copy state.catalog to the props.catalog
|
|
366
|
+
// let catalog = this.state.stateCatalog;
|
|
367
|
+
// console.log('111111', plannerState?.catalog?.elements.toJS());
|
|
368
|
+
// catalog.elements = plannerState?.catalog?.elements.toJS();
|
|
369
|
+
// console.log('222222', catalog);
|
|
370
|
+
// this.setState({ stateCatalog: catalog });
|
|
371
|
+
}
|
|
490
372
|
var catalogReady = plannerState.getIn(['catalog', 'ready']);
|
|
491
373
|
if (!catalogReady) {
|
|
492
374
|
projectActions.initCatalog(catalog);
|
|
@@ -582,7 +464,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
582
464
|
}, /*#__PURE__*/_react["default"].createElement(_export2.Content, (0, _extends2["default"])({
|
|
583
465
|
width: contentW,
|
|
584
466
|
height: contentH,
|
|
585
|
-
catalog: this.
|
|
467
|
+
catalog: this.state.stateCatalog,
|
|
586
468
|
state: extractedState,
|
|
587
469
|
toolBar: this.state.toolbar,
|
|
588
470
|
setToolbar: this.setToolbar,
|