kitchen-simulator 1.0.0-alin.4 → 1.0.0-alin.45
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 +14 -104
- package/es/LiteRenderer.js +9 -2
- package/es/actions/items-actions.js +1 -2
- package/es/catalog/catalog.js +4 -1
- 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 +24 -59
- package/es/components/viewer3d/viewer3d.js +0 -2
- package/es/constants.js +7 -1
- package/es/devLiteRenderer.js +72 -7
- package/es/index.js +15 -13
- 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 +15 -105
- package/lib/LiteRenderer.js +8 -1
- package/lib/actions/items-actions.js +1 -2
- package/lib/catalog/catalog.js +4 -1
- 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 +23 -58
- package/lib/components/viewer3d/viewer3d.js +0 -2
- package/lib/constants.js +11 -5
- package/lib/devLiteRenderer.js +71 -6
- package/lib/index.js +16 -13
- 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 +2 -2
|
@@ -69,42 +69,46 @@ var loadSVGsByItem = /*#__PURE__*/function () {
|
|
|
69
69
|
return _ref.apply(this, arguments);
|
|
70
70
|
};
|
|
71
71
|
}();
|
|
72
|
-
function
|
|
72
|
+
var compareSVGRect = function compareSVGRect(value) {
|
|
73
|
+
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;
|
|
74
|
+
};
|
|
75
|
+
function handleExternalEvent(_x2) {
|
|
73
76
|
return _handleExternalEvent.apply(this, arguments);
|
|
74
77
|
}
|
|
75
78
|
function _handleExternalEvent() {
|
|
76
|
-
_handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(
|
|
77
|
-
var state, sLineCnt, element, catalog, outlineSVGData, catalogInstance, elementJs, _evt$payload, moveType, moveValue, value, defaulTitle, _t2, _t3;
|
|
79
|
+
_handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(props) {
|
|
80
|
+
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;
|
|
78
81
|
return _regenerator["default"].wrap(function (_context2) {
|
|
79
82
|
while (1) switch (_context2.prev = _context2.next) {
|
|
80
83
|
case 0:
|
|
81
|
-
|
|
84
|
+
evt = props.externalEvent;
|
|
85
|
+
state = props.state.get('KitchenConfigurator');
|
|
82
86
|
_t2 = evt === null || evt === void 0 ? void 0 : evt.type;
|
|
83
|
-
_context2.next = _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 1 : _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 2 : _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 3 : _t2 === _constants.EXTERNAL_EVENT_ADD_WALL ? 4 : _t2 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 5 : _t2 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 9 : _t2 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 15 : 16;
|
|
87
|
+
_context2.next = _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 1 : _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 2 : _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 3 : _t2 === _constants.EXTERNAL_EVENT_ADD_WALL ? 4 : _t2 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 5 : _t2 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 9 : _t2 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 15 : _t2 === _constants.EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 16 : _t2 === _constants.EXTERNAL_EVENT_SET_INITIAL_DATA ? 17 : _t2 === _constants.EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 18 : _t2 === _constants.EXTERNAL_EVENT_ZOOM_IN ? 19 : _t2 === _constants.EXTERNAL_EVENT_ZOOM_OUT ? 22 : 25;
|
|
84
88
|
break;
|
|
85
89
|
case 1:
|
|
86
90
|
props.projectActions.setMode(_constants.MODE_IDLE_3D);
|
|
87
|
-
return _context2.abrupt("continue",
|
|
91
|
+
return _context2.abrupt("continue", 25);
|
|
88
92
|
case 2:
|
|
89
93
|
props.projectActions.setMode(_constants.MODE_IDLE);
|
|
90
|
-
return _context2.abrupt("continue",
|
|
94
|
+
return _context2.abrupt("continue", 25);
|
|
91
95
|
case 3:
|
|
92
|
-
sLineCnt = state.getIn(['
|
|
96
|
+
sLineCnt = state.getIn(['scene', 'layers', 'layer-1', 'selected', 'lines']).size;
|
|
93
97
|
if (sLineCnt > 0) props.projectActions.setMode(_constants.MODE_ELEVATION_VIEW);
|
|
94
|
-
return _context2.abrupt("continue",
|
|
98
|
+
return _context2.abrupt("continue", 25);
|
|
95
99
|
case 4:
|
|
96
100
|
if (state.mode === _constants.MODE_IDLE || state.mode === _constants.MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
97
101
|
props.projectActions.setMode(_constants.MODE_IDLE);
|
|
98
102
|
props.linesActions.selectToolDrawingLine('wall');
|
|
99
103
|
}
|
|
100
|
-
return _context2.abrupt("continue",
|
|
104
|
+
return _context2.abrupt("continue", 25);
|
|
101
105
|
case 5:
|
|
102
106
|
if ((0, _helper.isEmpty)(evt === null || evt === void 0 ? void 0 : evt.payload)) {
|
|
103
107
|
_context2.next = 8;
|
|
104
108
|
break;
|
|
105
109
|
}
|
|
106
110
|
element = evt.payload;
|
|
107
|
-
catalog = state.getIn(['
|
|
111
|
+
catalog = state.getIn(['catalog']).toJS(); // add item to catalog of state
|
|
108
112
|
if (!(0, _helper.isEmpty)(catalog === null || catalog === void 0 ? void 0 : catalog.elements[element.name])) {
|
|
109
113
|
_context2.next = 7;
|
|
110
114
|
break;
|
|
@@ -121,6 +125,7 @@ function _handleExternalEvent() {
|
|
|
121
125
|
render3DItem: _itemLoader.render3DItem
|
|
122
126
|
}));
|
|
123
127
|
if (catalogInstance !== null && catalogInstance !== void 0 && catalogInstance.validateElement(elementJs)) {
|
|
128
|
+
catalogInstance.registerElement(elementJs);
|
|
124
129
|
props.projectActions.addElementToCatalog(elementJs);
|
|
125
130
|
}
|
|
126
131
|
case 7:
|
|
@@ -129,10 +134,10 @@ function _handleExternalEvent() {
|
|
|
129
134
|
props.projectActions.pushLastSelectedCatalogElementToHistory(element);
|
|
130
135
|
props.projectActions.setIsCabinetDrawing(true);
|
|
131
136
|
case 8:
|
|
132
|
-
return _context2.abrupt("continue",
|
|
137
|
+
return _context2.abrupt("continue", 25);
|
|
133
138
|
case 9:
|
|
134
139
|
_evt$payload = evt.payload, moveType = _evt$payload.moveType, moveValue = _evt$payload.moveValue;
|
|
135
|
-
value = state.getIn(['
|
|
140
|
+
value = state.getIn(['viewer2D']).toJS();
|
|
136
141
|
_t3 = moveType;
|
|
137
142
|
_context2.next = _t3 === _constants.TOP ? 10 : _t3 === _constants.BOTTOM ? 11 : _t3 === _constants.RIGHT ? 12 : _t3 === _constants.LEFT ? 13 : 14;
|
|
138
143
|
break;
|
|
@@ -149,14 +154,79 @@ function _handleExternalEvent() {
|
|
|
149
154
|
value.e -= moveValue;
|
|
150
155
|
return _context2.abrupt("continue", 14);
|
|
151
156
|
case 14:
|
|
152
|
-
if (value
|
|
153
|
-
return _context2.abrupt("continue",
|
|
157
|
+
if (compareSVGRect(value)) props.viewer2DActions.updateCameraView(value);
|
|
158
|
+
return _context2.abrupt("continue", 25);
|
|
154
159
|
case 15:
|
|
155
160
|
defaulTitle = 'Untitle';
|
|
156
161
|
props.projectActions.newProject();
|
|
157
162
|
props.projectActions.rename(defaulTitle);
|
|
158
|
-
return _context2.abrupt("continue",
|
|
163
|
+
return _context2.abrupt("continue", 25);
|
|
159
164
|
case 16:
|
|
165
|
+
_evt$payload2 = evt.payload, doorStyle = _evt$payload2.doorStyle, isAll = _evt$payload2.isAll;
|
|
166
|
+
props.itemsActions.setDoorStyle(doorStyle, isAll);
|
|
167
|
+
return _context2.abrupt("continue", 25);
|
|
168
|
+
case 17:
|
|
169
|
+
_doorStyle = evt.payload.doorStyle;
|
|
170
|
+
props.itemsActions.setInitialDoorStyle(_doorStyle.doorStyle, _doorStyle.oStyle);
|
|
171
|
+
return _context2.abrupt("continue", 25);
|
|
172
|
+
case 18:
|
|
173
|
+
props.projectActions.loadProject(evt.payload, props.categoryData);
|
|
174
|
+
return _context2.abrupt("continue", 25);
|
|
175
|
+
case 19:
|
|
176
|
+
_value = state.getIn(['viewer2D']).toJS();
|
|
177
|
+
_value.a -= 0.1;
|
|
178
|
+
_value.d -= 0.1;
|
|
179
|
+
_value.e += _value.SVGWidth * 0.1 / 2;
|
|
180
|
+
_value.f += _value.SVGHeight * 0.1 / 2;
|
|
181
|
+
_zoomValue = parseInt((_value.a - 0.5) / _constants.ZOOM_VARIABLE);
|
|
182
|
+
if (!(_zoomValue > 404)) {
|
|
183
|
+
_context2.next = 20;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
return _context2.abrupt("return");
|
|
187
|
+
case 20:
|
|
188
|
+
if (!(_zoomValue < 35 || Number.isNaN(_zoomValue))) {
|
|
189
|
+
_context2.next = 21;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
return _context2.abrupt("return");
|
|
193
|
+
case 21:
|
|
194
|
+
while (!(_value.e <= 10)) {
|
|
195
|
+
_value.e -= 0.1;
|
|
196
|
+
}
|
|
197
|
+
while (!(_value.e + _value.a * _value.SVGWidth + 10 >= _value.viewerWidth)) {
|
|
198
|
+
_value.e += 0.1;
|
|
199
|
+
}
|
|
200
|
+
while (!(_value.f <= 80)) {
|
|
201
|
+
_value.f -= 0.1;
|
|
202
|
+
}
|
|
203
|
+
while (!(_value.f + _value.a * _value.SVGHeight + 10 >= _value.viewerHeight)) {
|
|
204
|
+
_value.f += 0.1;
|
|
205
|
+
}
|
|
206
|
+
if (compareSVGRect(_value)) props.viewer2DActions.updateCameraView(_value);
|
|
207
|
+
return _context2.abrupt("continue", 25);
|
|
208
|
+
case 22:
|
|
209
|
+
_value2 = state.getIn(['viewer2D']).toJS();
|
|
210
|
+
_value2.a += 0.1;
|
|
211
|
+
_value2.d += 0.1;
|
|
212
|
+
_value2.e -= _value2.SVGWidth * 0.1 / 2;
|
|
213
|
+
_value2.f -= _value2.SVGHeight * 0.1 / 2;
|
|
214
|
+
_zoomValue2 = parseInt((_value2.a - 0.5) / _constants.ZOOM_VARIABLE);
|
|
215
|
+
if (!(_zoomValue2 > 404)) {
|
|
216
|
+
_context2.next = 23;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
return _context2.abrupt("return");
|
|
220
|
+
case 23:
|
|
221
|
+
if (!(_zoomValue2 < 35 || Number.isNaN(_zoomValue2))) {
|
|
222
|
+
_context2.next = 24;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
return _context2.abrupt("return");
|
|
226
|
+
case 24:
|
|
227
|
+
if (compareSVGRect(_value2)) props.viewer2DActions.updateCameraView(_value2);
|
|
228
|
+
return _context2.abrupt("continue", 25);
|
|
229
|
+
case 25:
|
|
160
230
|
case "end":
|
|
161
231
|
return _context2.stop();
|
|
162
232
|
}
|
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.45",
|
|
4
4
|
"description": "It is a kitchen simulator (self-contained micro-frontend).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"moment": "^2.30.1",
|
|
89
89
|
"jwt-decode": "^2.2.0",
|
|
90
90
|
"react-ga4": "^1.4.1",
|
|
91
|
-
"styled-components": "^
|
|
91
|
+
"styled-components": "^5.2.0"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"localstorage-slim": "^1.3.0",
|