kitchen-simulator 1.0.0-alin.4 → 1.0.0-alin.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/LiteKitchenConfigurator.js +14 -3
- package/es/LiteRenderer.js +13 -105
- 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 +19 -55
- package/es/components/viewer3d/viewer3d.js +0 -2
- package/es/constants.js +7 -1
- package/es/devLiteRenderer.js +71 -6
- 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 +86 -19
- package/lib/LiteKitchenConfigurator.js +14 -3
- package/lib/LiteRenderer.js +14 -106
- 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 +19 -55
- package/lib/components/viewer3d/viewer3d.js +0 -2
- package/lib/constants.js +11 -5
- package/lib/devLiteRenderer.js +70 -5
- 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 +85 -18
- package/package.json +3 -3
|
@@ -13,8 +13,6 @@ var _constants = require("../constants");
|
|
|
13
13
|
var _helper = require("./helper");
|
|
14
14
|
var _exporter = _interopRequireDefault(require("../catalog/utils/exporter"));
|
|
15
15
|
var _itemLoader = require("../catalog/utils/item-loader");
|
|
16
|
-
var _catalog = _interopRequireDefault(require("../catalog/catalog"));
|
|
17
|
-
var _models = require("../models");
|
|
18
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
18
|
var loadSVGsByItem = /*#__PURE__*/function () {
|
|
@@ -69,42 +67,46 @@ var loadSVGsByItem = /*#__PURE__*/function () {
|
|
|
69
67
|
return _ref.apply(this, arguments);
|
|
70
68
|
};
|
|
71
69
|
}();
|
|
72
|
-
function
|
|
70
|
+
var compareSVGRect = function compareSVGRect(value) {
|
|
71
|
+
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;
|
|
72
|
+
};
|
|
73
|
+
function handleExternalEvent(_x2) {
|
|
73
74
|
return _handleExternalEvent.apply(this, arguments);
|
|
74
75
|
}
|
|
75
76
|
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;
|
|
77
|
+
_handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(props) {
|
|
78
|
+
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
79
|
return _regenerator["default"].wrap(function (_context2) {
|
|
79
80
|
while (1) switch (_context2.prev = _context2.next) {
|
|
80
81
|
case 0:
|
|
81
|
-
|
|
82
|
+
evt = props.externalEvent;
|
|
83
|
+
state = props.state.get('KitchenConfigurator');
|
|
82
84
|
_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;
|
|
85
|
+
_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
86
|
break;
|
|
85
87
|
case 1:
|
|
86
88
|
props.projectActions.setMode(_constants.MODE_IDLE_3D);
|
|
87
|
-
return _context2.abrupt("continue",
|
|
89
|
+
return _context2.abrupt("continue", 25);
|
|
88
90
|
case 2:
|
|
89
91
|
props.projectActions.setMode(_constants.MODE_IDLE);
|
|
90
|
-
return _context2.abrupt("continue",
|
|
92
|
+
return _context2.abrupt("continue", 25);
|
|
91
93
|
case 3:
|
|
92
|
-
sLineCnt = state.getIn(['
|
|
94
|
+
sLineCnt = state.getIn(['scene', 'layers', 'layer-1', 'selected', 'lines']).size;
|
|
93
95
|
if (sLineCnt > 0) props.projectActions.setMode(_constants.MODE_ELEVATION_VIEW);
|
|
94
|
-
return _context2.abrupt("continue",
|
|
96
|
+
return _context2.abrupt("continue", 25);
|
|
95
97
|
case 4:
|
|
96
98
|
if (state.mode === _constants.MODE_IDLE || state.mode === _constants.MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
97
99
|
props.projectActions.setMode(_constants.MODE_IDLE);
|
|
98
100
|
props.linesActions.selectToolDrawingLine('wall');
|
|
99
101
|
}
|
|
100
|
-
return _context2.abrupt("continue",
|
|
102
|
+
return _context2.abrupt("continue", 25);
|
|
101
103
|
case 5:
|
|
102
104
|
if ((0, _helper.isEmpty)(evt === null || evt === void 0 ? void 0 : evt.payload)) {
|
|
103
105
|
_context2.next = 8;
|
|
104
106
|
break;
|
|
105
107
|
}
|
|
106
108
|
element = evt.payload;
|
|
107
|
-
catalog = state.getIn(['
|
|
109
|
+
catalog = state.getIn(['catalog']).toJS(); // add item to catalog of state
|
|
108
110
|
if (!(0, _helper.isEmpty)(catalog === null || catalog === void 0 ? void 0 : catalog.elements[element.name])) {
|
|
109
111
|
_context2.next = 7;
|
|
110
112
|
break;
|
|
@@ -129,10 +131,10 @@ function _handleExternalEvent() {
|
|
|
129
131
|
props.projectActions.pushLastSelectedCatalogElementToHistory(element);
|
|
130
132
|
props.projectActions.setIsCabinetDrawing(true);
|
|
131
133
|
case 8:
|
|
132
|
-
return _context2.abrupt("continue",
|
|
134
|
+
return _context2.abrupt("continue", 25);
|
|
133
135
|
case 9:
|
|
134
136
|
_evt$payload = evt.payload, moveType = _evt$payload.moveType, moveValue = _evt$payload.moveValue;
|
|
135
|
-
value = state.getIn(['
|
|
137
|
+
value = state.getIn(['viewer2D']).toJS();
|
|
136
138
|
_t3 = moveType;
|
|
137
139
|
_context2.next = _t3 === _constants.TOP ? 10 : _t3 === _constants.BOTTOM ? 11 : _t3 === _constants.RIGHT ? 12 : _t3 === _constants.LEFT ? 13 : 14;
|
|
138
140
|
break;
|
|
@@ -149,14 +151,79 @@ function _handleExternalEvent() {
|
|
|
149
151
|
value.e -= moveValue;
|
|
150
152
|
return _context2.abrupt("continue", 14);
|
|
151
153
|
case 14:
|
|
152
|
-
if (value
|
|
153
|
-
return _context2.abrupt("continue",
|
|
154
|
+
if (compareSVGRect(value)) props.viewer2DActions.updateCameraView(value);
|
|
155
|
+
return _context2.abrupt("continue", 25);
|
|
154
156
|
case 15:
|
|
155
157
|
defaulTitle = 'Untitle';
|
|
156
158
|
props.projectActions.newProject();
|
|
157
159
|
props.projectActions.rename(defaulTitle);
|
|
158
|
-
return _context2.abrupt("continue",
|
|
160
|
+
return _context2.abrupt("continue", 25);
|
|
159
161
|
case 16:
|
|
162
|
+
_evt$payload2 = evt.payload, doorStyle = _evt$payload2.doorStyle, isAll = _evt$payload2.isAll;
|
|
163
|
+
props.itemsActions.setDoorStyle(doorStyle, isAll);
|
|
164
|
+
return _context2.abrupt("continue", 25);
|
|
165
|
+
case 17:
|
|
166
|
+
_doorStyle = evt.payload.doorStyle;
|
|
167
|
+
props.itemsActions.setInitialDoorStyle(_doorStyle.doorStyle, _doorStyle.oStyle);
|
|
168
|
+
return _context2.abrupt("continue", 25);
|
|
169
|
+
case 18:
|
|
170
|
+
props.projectActions.loadProject(evt.payload, props.categoryData);
|
|
171
|
+
return _context2.abrupt("continue", 25);
|
|
172
|
+
case 19:
|
|
173
|
+
_value = state.getIn(['viewer2D']).toJS();
|
|
174
|
+
_value.a -= 0.1;
|
|
175
|
+
_value.d -= 0.1;
|
|
176
|
+
_value.e += _value.SVGWidth * 0.1 / 2;
|
|
177
|
+
_value.f += _value.SVGHeight * 0.1 / 2;
|
|
178
|
+
_zoomValue = parseInt((_value.a - 0.5) / _constants.ZOOM_VARIABLE);
|
|
179
|
+
if (!(_zoomValue > 404)) {
|
|
180
|
+
_context2.next = 20;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
return _context2.abrupt("return");
|
|
184
|
+
case 20:
|
|
185
|
+
if (!(_zoomValue < 35 || Number.isNaN(_zoomValue))) {
|
|
186
|
+
_context2.next = 21;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
return _context2.abrupt("return");
|
|
190
|
+
case 21:
|
|
191
|
+
while (!(_value.e <= 10)) {
|
|
192
|
+
_value.e -= 0.1;
|
|
193
|
+
}
|
|
194
|
+
while (!(_value.e + _value.a * _value.SVGWidth + 10 >= _value.viewerWidth)) {
|
|
195
|
+
_value.e += 0.1;
|
|
196
|
+
}
|
|
197
|
+
while (!(_value.f <= 80)) {
|
|
198
|
+
_value.f -= 0.1;
|
|
199
|
+
}
|
|
200
|
+
while (!(_value.f + _value.a * _value.SVGHeight + 10 >= _value.viewerHeight)) {
|
|
201
|
+
_value.f += 0.1;
|
|
202
|
+
}
|
|
203
|
+
if (compareSVGRect(_value)) props.viewer2DActions.updateCameraView(_value);
|
|
204
|
+
return _context2.abrupt("continue", 25);
|
|
205
|
+
case 22:
|
|
206
|
+
_value2 = state.getIn(['viewer2D']).toJS();
|
|
207
|
+
_value2.a += 0.1;
|
|
208
|
+
_value2.d += 0.1;
|
|
209
|
+
_value2.e -= _value2.SVGWidth * 0.1 / 2;
|
|
210
|
+
_value2.f -= _value2.SVGHeight * 0.1 / 2;
|
|
211
|
+
_zoomValue2 = parseInt((_value2.a - 0.5) / _constants.ZOOM_VARIABLE);
|
|
212
|
+
if (!(_zoomValue2 > 404)) {
|
|
213
|
+
_context2.next = 23;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
return _context2.abrupt("return");
|
|
217
|
+
case 23:
|
|
218
|
+
if (!(_zoomValue2 < 35 || Number.isNaN(_zoomValue2))) {
|
|
219
|
+
_context2.next = 24;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
return _context2.abrupt("return");
|
|
223
|
+
case 24:
|
|
224
|
+
if (compareSVGRect(_value2)) props.viewer2DActions.updateCameraView(_value2);
|
|
225
|
+
return _context2.abrupt("continue", 25);
|
|
226
|
+
case 25:
|
|
160
227
|
case "end":
|
|
161
228
|
return _context2.stop();
|
|
162
229
|
}
|
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.40",
|
|
4
4
|
"description": "It is a kitchen simulator (self-contained micro-frontend).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -82,13 +82,13 @@
|
|
|
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": "2.18.0",
|
|
86
86
|
"redux": "4.0.1",
|
|
87
87
|
"three": "0.166.0",
|
|
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",
|