kitchen-simulator 4.1.7-react-18 → 4.2.2
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/README.md +3 -0
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +171 -111
- package/es/LiteRenderer.js +161 -129
- package/es/actions/export.js +25 -12
- package/es/actions/project-actions.js +2 -1
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/svg/bottombar/elevation.svg +12 -5
- package/es/catalog/catalog.js +21 -5
- package/es/catalog/factories/area-factory-3d.js +17 -17
- package/es/catalog/factories/wall-factory.js +1 -1
- package/es/catalog/holes/window-clear/planner-element.js +2 -2
- package/es/catalog/properties/export.js +21 -0
- package/es/catalog/properties/property-checkbox.js +68 -0
- package/es/catalog/properties/property-color.js +39 -0
- package/es/catalog/properties/property-enum.js +50 -0
- package/es/catalog/properties/property-hidden.js +19 -0
- package/es/catalog/properties/property-lenght-measure.js +100 -0
- package/es/catalog/properties/property-length-measure.js +84 -0
- package/es/catalog/properties/property-length-measure_hole.js +100 -0
- package/es/catalog/properties/property-number.js +48 -0
- package/es/catalog/properties/property-read-only.js +26 -0
- package/es/catalog/properties/property-string.js +48 -0
- package/es/catalog/properties/property-toggle.js +39 -0
- package/es/catalog/properties/shared-property-style.js +14 -0
- package/es/catalog/utils/exporter.js +24 -11
- package/es/catalog/utils/item-loader.js +224 -220
- package/es/class/hole.js +0 -2
- package/es/class/item.js +92 -70
- package/es/class/layer.js +1 -1
- package/es/class/line.js +4 -8
- package/es/class/project.js +96 -81
- package/es/components/content.js +10 -93
- package/es/components/export.js +4 -6
- package/es/components/style/button.js +106 -0
- package/es/components/style/cancel-button.js +21 -0
- package/es/components/style/content-container.js +30 -0
- package/es/components/style/content-title.js +25 -0
- package/es/components/style/delete-button.js +24 -0
- package/es/components/style/export.js +28 -2
- package/es/components/style/form-block.js +20 -0
- package/es/components/style/form-color-input.js +26 -0
- package/es/components/style/form-label.js +22 -0
- package/es/components/style/form-number-input.js +29 -29
- package/es/components/style/form-number-input_2.js +200 -0
- package/es/components/style/form-select.js +19 -0
- package/es/components/style/form-slider.js +60 -0
- package/es/components/style/form-submit-button.js +25 -0
- package/es/components/style/form-text-input.js +69 -0
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/group.js +5 -4
- package/es/components/viewer2d/item.js +155 -359
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +22 -54
- package/es/components/viewer2d/ruler.js +16 -11
- package/es/components/viewer2d/rulerDist.js +38 -51
- package/es/components/viewer2d/rulerX.js +4 -2
- package/es/components/viewer2d/rulerY.js +3 -0
- package/es/components/viewer2d/scene.js +17 -12
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/utils.js +2 -2
- package/es/components/viewer2d/vertex.js +3 -2
- package/es/components/viewer2d/viewer2d.js +81 -118
- package/es/components/viewer3d/front3D.js +13 -1
- package/es/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/es/components/viewer3d/scene-creator.js +270 -69
- package/es/components/viewer3d/viewer3d-first-person.js +26 -32
- package/es/components/viewer3d/viewer3d.js +110 -130
- package/es/constants.js +7 -2
- package/es/devLiteRenderer.js +491 -150
- package/es/index.js +589 -62
- package/es/models.js +13 -8
- package/es/plugins/SVGLoader.js +1414 -0
- package/es/plugins/console-debugger.js +34 -0
- package/es/plugins/export.js +7 -0
- package/es/plugins/keyboard.js +110 -0
- package/es/reducers/project-reducer.js +4 -1
- package/es/reducers/viewer2d-reducer.js +3 -1
- package/es/reducers/viewer3d-reducer.js +3 -1
- package/es/styles/export.js +5 -0
- package/es/styles/tabs.css +40 -0
- package/es/utils/geometry.js +77 -119
- package/es/utils/helper.js +38 -1
- package/es/utils/isolate-event-handler.js +829 -609
- package/es/utils/molding.js +489 -11
- package/es/utils/ruler.js +58 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +170 -111
- package/lib/LiteRenderer.js +160 -129
- package/lib/actions/export.js +35 -39
- package/lib/actions/project-actions.js +2 -1
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/svg/bottombar/elevation.svg +12 -5
- package/lib/catalog/catalog.js +20 -4
- package/lib/catalog/factories/area-factory-3d.js +14 -14
- package/lib/catalog/factories/wall-factory.js +1 -1
- package/lib/catalog/holes/window-clear/planner-element.js +2 -2
- package/lib/catalog/properties/export.js +81 -0
- package/lib/catalog/properties/property-checkbox.js +76 -0
- package/lib/catalog/properties/property-color.js +47 -0
- package/lib/catalog/properties/property-enum.js +58 -0
- package/lib/catalog/properties/property-hidden.js +27 -0
- package/lib/catalog/properties/property-lenght-measure.js +108 -0
- package/lib/catalog/properties/property-length-measure.js +92 -0
- package/lib/catalog/properties/property-length-measure_hole.js +108 -0
- package/lib/catalog/properties/property-number.js +56 -0
- package/lib/catalog/properties/property-read-only.js +34 -0
- package/lib/catalog/properties/property-string.js +56 -0
- package/lib/catalog/properties/property-toggle.js +47 -0
- package/lib/catalog/properties/shared-property-style.js +21 -0
- package/lib/catalog/utils/exporter.js +24 -11
- package/lib/catalog/utils/item-loader.js +221 -217
- package/lib/class/hole.js +0 -2
- package/lib/class/item.js +90 -68
- package/lib/class/layer.js +1 -1
- package/lib/class/line.js +3 -7
- package/lib/class/project.js +96 -81
- package/lib/components/content.js +10 -93
- package/lib/components/export.js +6 -26
- package/lib/components/style/button.js +115 -0
- package/lib/components/style/cancel-button.js +29 -0
- package/lib/components/style/content-container.js +38 -0
- package/lib/components/style/content-title.js +35 -0
- package/lib/components/style/delete-button.js +34 -0
- package/lib/components/style/export.js +105 -1
- package/lib/components/style/form-block.js +28 -0
- package/lib/components/style/form-color-input.js +34 -0
- package/lib/components/style/form-label.js +30 -0
- package/lib/components/style/form-number-input.js +29 -29
- package/lib/components/style/form-number-input_2.js +209 -0
- package/lib/components/style/form-select.js +29 -0
- package/lib/components/style/form-slider.js +68 -0
- package/lib/components/style/form-submit-button.js +35 -0
- package/lib/components/style/form-text-input.js +78 -0
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/group.js +5 -4
- package/lib/components/viewer2d/item.js +152 -356
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +22 -54
- package/lib/components/viewer2d/ruler.js +15 -10
- package/lib/components/viewer2d/rulerDist.js +38 -51
- package/lib/components/viewer2d/rulerX.js +4 -2
- package/lib/components/viewer2d/rulerY.js +3 -0
- package/lib/components/viewer2d/scene.js +17 -12
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/utils.js +2 -2
- package/lib/components/viewer2d/vertex.js +3 -2
- package/lib/components/viewer2d/viewer2d.js +79 -115
- package/lib/components/viewer3d/front3D.js +13 -1
- package/lib/components/viewer3d/ruler-utils/scene3D.js +1 -1
- package/lib/components/viewer3d/scene-creator.js +267 -66
- package/lib/components/viewer3d/viewer3d-first-person.js +26 -32
- package/lib/components/viewer3d/viewer3d.js +107 -126
- package/lib/constants.js +12 -7
- package/lib/devLiteRenderer.js +489 -148
- package/lib/index.js +591 -62
- package/lib/models.js +13 -8
- package/lib/plugins/SVGLoader.js +1419 -0
- package/lib/plugins/console-debugger.js +42 -0
- package/lib/plugins/export.js +25 -0
- package/lib/plugins/keyboard.js +117 -0
- package/lib/reducers/project-reducer.js +4 -1
- package/lib/reducers/viewer2d-reducer.js +3 -1
- package/lib/reducers/viewer3d-reducer.js +3 -1
- package/lib/styles/export.js +13 -0
- package/lib/styles/tabs.css +40 -0
- package/lib/utils/geometry.js +77 -119
- package/lib/utils/helper.js +40 -1
- package/lib/utils/isolate-event-handler.js +829 -608
- package/lib/utils/molding.js +490 -9
- package/lib/utils/ruler.js +63 -0
- package/package.json +21 -20
- package/es/mocks/appliancePayload.json +0 -27
- package/es/mocks/cabinetPayload.json +0 -1914
- package/es/mocks/cabinetPayload2.json +0 -76
- package/es/mocks/dataBundle2.json +0 -4
- package/es/mocks/distancePayload.json +0 -6
- package/es/mocks/doorStylePayload2.json +0 -84
- package/es/mocks/furnishingPayload.json +0 -23
- package/es/mocks/itemCDSPayload.json +0 -27
- package/es/mocks/lightingPayload.json +0 -23
- package/es/mocks/mockProps.json +0 -43
- package/es/mocks/mockProps2.json +0 -9
- package/es/mocks/moldingPayload.json +0 -19
- package/es/mocks/projectItemsCatalog.json +0 -133
- package/es/mocks/rectangleShape.json +0 -238
- package/es/mocks/replaceCabinetPayload.json +0 -81
- package/es/mocks/roomShapePayload.json +0 -5
- package/es/useAppContext.js +0 -8
- package/lib/mocks/appliancePayload.json +0 -27
- package/lib/mocks/cabinetPayload.json +0 -1914
- package/lib/mocks/cabinetPayload2.json +0 -76
- package/lib/mocks/dataBundle2.json +0 -4
- package/lib/mocks/distancePayload.json +0 -6
- package/lib/mocks/doorStylePayload2.json +0 -84
- package/lib/mocks/furnishingPayload.json +0 -23
- package/lib/mocks/itemCDSPayload.json +0 -27
- package/lib/mocks/lightingPayload.json +0 -23
- package/lib/mocks/mockProps.json +0 -43
- package/lib/mocks/mockProps2.json +0 -9
- package/lib/mocks/moldingPayload.json +0 -19
- package/lib/mocks/projectItemsCatalog.json +0 -133
- package/lib/mocks/rectangleShape.json +0 -238
- package/lib/mocks/replaceCabinetPayload.json +0 -81
- package/lib/mocks/roomShapePayload.json +0 -5
- package/lib/useAppContext.js +0 -16
|
@@ -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 {
|
|
7
|
+
import { ReactSVGPanZoom, TOOL_AUTO, TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT } 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, INTERNAL_EVENT_SELECT_ELEMENT, INTERNAL_EVENT_DRAG_ELEMENT, INTERNAL_EVENT_DRAW_ELEMENT, INTERNAL_EVENT_ROTATE_ELEMENT } from "../../constants";
|
|
10
10
|
import State from "./state";
|
|
@@ -15,10 +15,8 @@ import FormNumberInput from "../style/form-number-input";
|
|
|
15
15
|
import { convert } from "../../utils/convert-units-lite";
|
|
16
16
|
import { Map } from 'immutable';
|
|
17
17
|
import { formatNumber } from "../../utils/math";
|
|
18
|
-
import { isEmpty } from "../../utils/helper"; // variables
|
|
18
|
+
import { isEmpty, updatePayloadOfInternalEvent } from "../../utils/helper"; // variables
|
|
19
19
|
import { isWarningItem } from "./utils";
|
|
20
|
-
import { MoldingUtils } from "../../utils/export";
|
|
21
|
-
import { useAppContext } from "../../useAppContext";
|
|
22
20
|
// variables
|
|
23
21
|
var pinFlag = false;
|
|
24
22
|
var sFlag = false; //for all object move
|
|
@@ -122,22 +120,21 @@ function extractElementData(node) {
|
|
|
122
120
|
direct: node.attributes.getNamedItem('data-direct') ? node.attributes.getNamedItem('data-direct').value : 0
|
|
123
121
|
};
|
|
124
122
|
}
|
|
125
|
-
export default function Viewer2D(_ref) {
|
|
126
|
-
var _state$get;
|
|
123
|
+
export default function Viewer2D(_ref, _ref2) {
|
|
127
124
|
var state = _ref.state,
|
|
128
125
|
width = _ref.width,
|
|
129
126
|
height = _ref.height,
|
|
127
|
+
setToolbar = _ref.setToolbar,
|
|
130
128
|
replaceCabinet = _ref.replaceCabinet,
|
|
131
129
|
onInternalEvent = _ref.onInternalEvent;
|
|
132
|
-
var
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
catalog = _useAppContext.catalog;
|
|
130
|
+
var viewer2DActions = _ref2.viewer2DActions,
|
|
131
|
+
linesActions = _ref2.linesActions,
|
|
132
|
+
holesActions = _ref2.holesActions,
|
|
133
|
+
verticesActions = _ref2.verticesActions,
|
|
134
|
+
itemsActions = _ref2.itemsActions,
|
|
135
|
+
areaActions = _ref2.areaActions,
|
|
136
|
+
projectActions = _ref2.projectActions,
|
|
137
|
+
catalog = _ref2.catalog;
|
|
141
138
|
var _useState = useState(null),
|
|
142
139
|
_useState2 = _slicedToArray(_useState, 2),
|
|
143
140
|
rulerEdit = _useState2[0],
|
|
@@ -160,26 +157,6 @@ export default function Viewer2D(_ref) {
|
|
|
160
157
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
161
158
|
drawStart = _useState8[0],
|
|
162
159
|
setdrawStart = _useState8[1];
|
|
163
|
-
var _useState9 = useState(function () {
|
|
164
|
-
return viewer2D && !viewer2D.isEmpty() ? viewer2D.toJS() : INITIAL_VALUE;
|
|
165
|
-
}),
|
|
166
|
-
_useState0 = _slicedToArray(_useState9, 2),
|
|
167
|
-
svgValue = _useState0[0],
|
|
168
|
-
setSvgValue = _useState0[1];
|
|
169
|
-
var _useState1 = useState(function () {
|
|
170
|
-
return mode2Tool(mode);
|
|
171
|
-
}),
|
|
172
|
-
_useState10 = _slicedToArray(_useState1, 2),
|
|
173
|
-
svgTool = _useState10[0],
|
|
174
|
-
setSvgTool = _useState10[1];
|
|
175
|
-
useEffect(function () {
|
|
176
|
-
// keep tool controlled from app mode
|
|
177
|
-
setSvgTool(mode2Tool(mode));
|
|
178
|
-
}, [mode]);
|
|
179
|
-
useEffect(function () {
|
|
180
|
-
// keep value controlled from store, but never null
|
|
181
|
-
if (viewer2D && !viewer2D.isEmpty()) setSvgValue(viewer2D.toJS());
|
|
182
|
-
}, [viewer2D]);
|
|
183
160
|
useEffect(function () {
|
|
184
161
|
// move viewer point to center
|
|
185
162
|
var selectedLayer = state.scene.layers.get(state.scene.selectedLayer);
|
|
@@ -204,9 +181,9 @@ export default function Viewer2D(_ref) {
|
|
|
204
181
|
var layerID = scene.selectedLayer;
|
|
205
182
|
var wall_thickness = LINE_THICKNESS / 2;
|
|
206
183
|
var layer = scene.getIn(['layers', layerID]);
|
|
207
|
-
var mapCursorPosition = function mapCursorPosition(
|
|
208
|
-
var x =
|
|
209
|
-
y =
|
|
184
|
+
var mapCursorPosition = function mapCursorPosition(_ref3) {
|
|
185
|
+
var x = _ref3.x,
|
|
186
|
+
y = _ref3.y;
|
|
210
187
|
return {
|
|
211
188
|
x: x,
|
|
212
189
|
y: -y + scene.height
|
|
@@ -230,11 +207,10 @@ export default function Viewer2D(_ref) {
|
|
|
230
207
|
allArea = GeometryUtils.getAllArea(layer);
|
|
231
208
|
};
|
|
232
209
|
var updateRulerDistAttribute = function updateRulerDistAttribute(elementData, value) {
|
|
233
|
-
var _scene$getIn;
|
|
234
210
|
var newVal = value.get('length');
|
|
235
211
|
var oldVal = elementData.length;
|
|
236
212
|
var direct = elementData.direct;
|
|
237
|
-
var thisItem =
|
|
213
|
+
var thisItem = scene.getIn(['layers', elementData.layer, 'items', elementData.id]).toJS();
|
|
238
214
|
var oldX = thisItem.x;
|
|
239
215
|
var oldY = thisItem.y;
|
|
240
216
|
var oldRotRad = thisItem.rotation / 180 * Math.PI;
|
|
@@ -268,8 +244,7 @@ export default function Viewer2D(_ref) {
|
|
|
268
244
|
verticesActions.endDraggingVertex(x, y, state.snapMask);
|
|
269
245
|
};
|
|
270
246
|
var updateRulerAttribute = function updateRulerAttribute(elementData, value) {
|
|
271
|
-
var
|
|
272
|
-
var selectedLine = (_scene$getIn2 = scene.getIn(['layers', elementData.layer, 'lines', elementData.id])) === null || _scene$getIn2 === void 0 ? void 0 : _scene$getIn2.toJS();
|
|
247
|
+
var selectedLine = scene.getIn(['layers', elementData.layer, 'lines', elementData.id]).toJS();
|
|
273
248
|
var v_0 = scene.getIn(['layers', elementData.layer, 'vertices', selectedLine.vertices[0]]);
|
|
274
249
|
var v_1 = scene.getIn(['layers', elementData.layer, 'vertices', selectedLine.vertices[1]]);
|
|
275
250
|
var _GeometryUtils$orderV = GeometryUtils.orderVertices([v_0, v_1]),
|
|
@@ -329,10 +304,9 @@ export default function Viewer2D(_ref) {
|
|
|
329
304
|
updateRightHoleRulerAttribute(elementData, value);
|
|
330
305
|
};
|
|
331
306
|
var updateLeftHoleRulerAttribute = function updateLeftHoleRulerAttribute(elementData, value) {
|
|
332
|
-
var _scene$getIn3;
|
|
333
307
|
var newVal = value.get('length');
|
|
334
308
|
var oldVal = elementData.length;
|
|
335
|
-
var thisItem =
|
|
309
|
+
var thisItem = scene.getIn(['layers', elementData.layer, 'holes', elementData.id]).toJS();
|
|
336
310
|
var oldX = thisItem.x;
|
|
337
311
|
var oldY = thisItem.y;
|
|
338
312
|
var oldRotRad = thisItem.rotation;
|
|
@@ -345,9 +319,8 @@ export default function Viewer2D(_ref) {
|
|
|
345
319
|
setRulerEdit(null);
|
|
346
320
|
};
|
|
347
321
|
var updateHoleRulerAttribute = function updateHoleRulerAttribute(elementData, value) {
|
|
348
|
-
var _scene$getIn4;
|
|
349
322
|
var newVal = value.get('length');
|
|
350
|
-
var thisItem =
|
|
323
|
+
var thisItem = scene.getIn(['layers', elementData.layer, 'holes', elementData.id]).toJS();
|
|
351
324
|
var oldX = thisItem.x;
|
|
352
325
|
var oldY = thisItem.y;
|
|
353
326
|
holesActions.beginDraggingHole(elementData.layer, elementData.id, oldX, oldY);
|
|
@@ -356,10 +329,9 @@ export default function Viewer2D(_ref) {
|
|
|
356
329
|
setRulerEdit(null);
|
|
357
330
|
};
|
|
358
331
|
var updateRightHoleRulerAttribute = function updateRightHoleRulerAttribute(elementData, value) {
|
|
359
|
-
var _scene$getIn5;
|
|
360
332
|
var newVal = value.get('length');
|
|
361
333
|
var oldVal = elementData.length;
|
|
362
|
-
var thisItem =
|
|
334
|
+
var thisItem = scene.getIn(['layers', elementData.layer, 'holes', elementData.id]).toJS();
|
|
363
335
|
var oldX = thisItem.x;
|
|
364
336
|
var oldY = thisItem.y;
|
|
365
337
|
var oldRotRad = thisItem.rotation;
|
|
@@ -394,7 +366,6 @@ export default function Viewer2D(_ref) {
|
|
|
394
366
|
// }
|
|
395
367
|
};
|
|
396
368
|
var getEndPoint = function getEndPoint(vertices, x, y, mode) {
|
|
397
|
-
var _state$getIn, _state$getIn2;
|
|
398
369
|
var selLineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
|
|
399
370
|
if (isEmpty(selLineID)) {
|
|
400
371
|
return {
|
|
@@ -403,8 +374,8 @@ export default function Viewer2D(_ref) {
|
|
|
403
374
|
y: y
|
|
404
375
|
};
|
|
405
376
|
}
|
|
406
|
-
var draggingLine =
|
|
407
|
-
var allLines =
|
|
377
|
+
var draggingLine = state.getIn(['scene', 'layers', layerID, 'lines', selLineID]).toJS();
|
|
378
|
+
var allLines = state.getIn(['scene', 'layers', layerID, 'lines']).toJS();
|
|
408
379
|
var dragVertexId = state.getIn(['draggingSupport', 'vertexID']);
|
|
409
380
|
dragVertexId = !isEmpty(dragVertexId) ? dragVertexId : draggingLine.vertices[1];
|
|
410
381
|
var vtx, vty;
|
|
@@ -579,11 +550,11 @@ export default function Viewer2D(_ref) {
|
|
|
579
550
|
};
|
|
580
551
|
};
|
|
581
552
|
var getConnectedLines = function getConnectedLines() {
|
|
582
|
-
var _state$
|
|
583
|
-
var vertices =
|
|
584
|
-
var lines =
|
|
553
|
+
var _state$getIn;
|
|
554
|
+
var vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
|
|
555
|
+
var lines = state.getIn(['scene', 'layers', layerID, 'lines']).toJS();
|
|
585
556
|
var lineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
|
|
586
|
-
var drawingLine = (_state$
|
|
557
|
+
var drawingLine = (_state$getIn = state.getIn(['scene', 'layers', layerID, 'lines', lineID])) === null || _state$getIn === void 0 ? void 0 : _state$getIn.toJS();
|
|
587
558
|
// get the lines that have same points with drawing line.
|
|
588
559
|
if (!isEmpty(drawingLine)) {
|
|
589
560
|
var tlines = [];
|
|
@@ -592,7 +563,6 @@ export default function Viewer2D(_ref) {
|
|
|
592
563
|
}
|
|
593
564
|
};
|
|
594
565
|
var onMouseMove = function onMouseMove(viewerEvent) {
|
|
595
|
-
var _state$getIn6, _state$getIn7, _state$getIn9;
|
|
596
566
|
//workaround that allow imageful component to work
|
|
597
567
|
|
|
598
568
|
// let evt = new Event('mousemove-planner-event');
|
|
@@ -616,12 +586,11 @@ export default function Viewer2D(_ref) {
|
|
|
616
586
|
case constants.MODE_DRAWING_LINE:
|
|
617
587
|
// check whether the drawing line is started.
|
|
618
588
|
var lineID = state.getIn(['scene', 'layers', layerID, 'selected', 'lines']).first();
|
|
619
|
-
var lines =
|
|
620
|
-
var drawingLine =
|
|
589
|
+
var lines = state.getIn(['scene', 'layers', layerID, 'lines']).toJS();
|
|
590
|
+
var drawingLine = state.getIn(['scene', 'layers', layerID, 'lines', lineID]).toJS();
|
|
621
591
|
var tlines = [];
|
|
622
592
|
if (drawStart || state.getIn(['scene', 'setLineAttributes'])) {
|
|
623
|
-
var
|
|
624
|
-
var _vertices = (_state$getIn8 = state.getIn(['scene', 'layers', layerID, 'vertices'])) === null || _state$getIn8 === void 0 ? void 0 : _state$getIn8.toJS();
|
|
593
|
+
var _vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
|
|
625
594
|
setdrawStart(false);
|
|
626
595
|
// get the lines that have same points with drawing line.
|
|
627
596
|
getRelatedLines(tlines, drawingLine, _vertices, lines);
|
|
@@ -727,7 +696,7 @@ export default function Viewer2D(_ref) {
|
|
|
727
696
|
linesActions.updateDraggingLine(x, y, relatedLines, state.snapMask);
|
|
728
697
|
break;
|
|
729
698
|
case constants.MODE_DRAGGING_VERTEX:
|
|
730
|
-
var vertices =
|
|
699
|
+
var vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
|
|
731
700
|
getConnectedLines();
|
|
732
701
|
var result = getEndPoint(vertices, x, y, 'DRAGGING_VERTEX');
|
|
733
702
|
verticesActions.updateDraggingVertex(result.x, result.y, state.snapMask);
|
|
@@ -833,6 +802,7 @@ export default function Viewer2D(_ref) {
|
|
|
833
802
|
verticesActions.beginDraggingVertex(elementData.layer, elementData.id, x, y, state.snapMask);
|
|
834
803
|
break;
|
|
835
804
|
case 'items':
|
|
805
|
+
setToolbar('');
|
|
836
806
|
current_sel_obj_id = elementData.id;
|
|
837
807
|
if (elementData.part === 'rotation-anchor') itemsActions.beginRotatingItem(elementData.layer, elementData.id, x, y);else if (elementData.part === 'remove') break;else if (elementData.part === 'duplicate') break;else if (elementData.part === 'warning_edit') break;else {
|
|
838
808
|
// closes the setting dialog
|
|
@@ -860,15 +830,23 @@ export default function Viewer2D(_ref) {
|
|
|
860
830
|
event.stopPropagation();
|
|
861
831
|
};
|
|
862
832
|
var onMouseUp = function onMouseUp(viewerEvent) {
|
|
863
|
-
var _state$getIn0, _state$getIn1;
|
|
864
833
|
//set move all flag false
|
|
865
834
|
sFlag = false;
|
|
866
|
-
// //////////////////////
|
|
867
|
-
// setRulerEdit(null);
|
|
868
835
|
var event = viewerEvent.originalEvent;
|
|
869
|
-
var
|
|
870
|
-
|
|
871
|
-
|
|
836
|
+
var parent = document.querySelector('#kitchen-simulator-container');
|
|
837
|
+
var targetRect = event.target.getBoundingClientRect();
|
|
838
|
+
var left = targetRect.left;
|
|
839
|
+
var top = targetRect.top;
|
|
840
|
+
if (!isEmpty(parent)) {
|
|
841
|
+
var parentRect = parent.getBoundingClientRect();
|
|
842
|
+
left = targetRect.left - parentRect.left;
|
|
843
|
+
top = targetRect.top - parentRect.top;
|
|
844
|
+
left = left - (200 - targetRect.width) / 2;
|
|
845
|
+
top = top - (50 - targetRect.height) / 2;
|
|
846
|
+
}
|
|
847
|
+
if (!mode.includes('ING')) {
|
|
848
|
+
setToolbar('');
|
|
849
|
+
}
|
|
872
850
|
if (event.target.tagName === 'rect') {
|
|
873
851
|
if (event.target.id) {
|
|
874
852
|
setRulerEditID(event.target.id);
|
|
@@ -883,8 +861,8 @@ export default function Viewer2D(_ref) {
|
|
|
883
861
|
x = _mapCursorPosition3.x,
|
|
884
862
|
y = _mapCursorPosition3.y;
|
|
885
863
|
var draggingDistance = Math.sqrt((x - mouseDownPoint.x) * (x - mouseDownPoint.x) + (y - mouseDownPoint.y) * (y - mouseDownPoint.y));
|
|
886
|
-
var vertices =
|
|
887
|
-
var lines =
|
|
864
|
+
var vertices = state.getIn(['scene', 'layers', layerID, 'vertices']).toJS();
|
|
865
|
+
var lines = state.getIn(['scene', 'layers', layerID, 'lines']).toJS();
|
|
888
866
|
var elementData = extractElementData(event.target);
|
|
889
867
|
var selectedLayer = scene.getIn(['layers', layerID]);
|
|
890
868
|
var elementPrototype = null;
|
|
@@ -957,11 +935,11 @@ export default function Viewer2D(_ref) {
|
|
|
957
935
|
// handle action when click elevation about selected line
|
|
958
936
|
var _mode = MODE_ELEVATION_VIEW;
|
|
959
937
|
projectActions.setMode(_mode);
|
|
938
|
+
internalType = constants.INTERNAL_EVENT_TOGGLE_TO_ELEVATION;
|
|
960
939
|
break;
|
|
961
940
|
} else {
|
|
962
|
-
var _state$getIn10;
|
|
963
941
|
var tlines = [];
|
|
964
|
-
var drawingLine =
|
|
942
|
+
var drawingLine = state.getIn(['scene', 'layers', layerID, 'lines', elementData.id]).toJS();
|
|
965
943
|
getRelatedLines(tlines, drawingLine, vertices, lines);
|
|
966
944
|
setRelatedLines(tlines);
|
|
967
945
|
linesActions.selectLine(elementData.layer, elementData.id);
|
|
@@ -1001,8 +979,8 @@ export default function Viewer2D(_ref) {
|
|
|
1001
979
|
id: "ruler_numberInput",
|
|
1002
980
|
style: {
|
|
1003
981
|
position: 'absolute',
|
|
1004
|
-
left:
|
|
1005
|
-
top:
|
|
982
|
+
left: left,
|
|
983
|
+
top: top,
|
|
1006
984
|
zIndex: 1000
|
|
1007
985
|
}
|
|
1008
986
|
}, /*#__PURE__*/React.createElement(FormNumberInput, {
|
|
@@ -1033,8 +1011,8 @@ export default function Viewer2D(_ref) {
|
|
|
1033
1011
|
id: "ruler_numberInput",
|
|
1034
1012
|
style: {
|
|
1035
1013
|
position: 'absolute',
|
|
1036
|
-
left:
|
|
1037
|
-
top:
|
|
1014
|
+
left: left,
|
|
1015
|
+
top: top,
|
|
1038
1016
|
zIndex: 1000
|
|
1039
1017
|
}
|
|
1040
1018
|
}, /*#__PURE__*/React.createElement(FormNumberInput, {
|
|
@@ -1066,8 +1044,8 @@ export default function Viewer2D(_ref) {
|
|
|
1066
1044
|
id: "ruler_numberInput",
|
|
1067
1045
|
style: {
|
|
1068
1046
|
position: 'absolute',
|
|
1069
|
-
left:
|
|
1070
|
-
top:
|
|
1047
|
+
left: left,
|
|
1048
|
+
top: top,
|
|
1071
1049
|
zIndex: 1000
|
|
1072
1050
|
}
|
|
1073
1051
|
}, /*#__PURE__*/React.createElement(FormNumberInput, {
|
|
@@ -1099,8 +1077,8 @@ export default function Viewer2D(_ref) {
|
|
|
1099
1077
|
id: "ruler_numberInput",
|
|
1100
1078
|
style: {
|
|
1101
1079
|
position: 'absolute',
|
|
1102
|
-
left:
|
|
1103
|
-
top:
|
|
1080
|
+
left: left,
|
|
1081
|
+
top: top,
|
|
1104
1082
|
zIndex: 1000
|
|
1105
1083
|
}
|
|
1106
1084
|
}, /*#__PURE__*/React.createElement(FormNumberInput, {
|
|
@@ -1132,8 +1110,8 @@ export default function Viewer2D(_ref) {
|
|
|
1132
1110
|
id: "ruler_numberInput",
|
|
1133
1111
|
style: {
|
|
1134
1112
|
position: 'absolute',
|
|
1135
|
-
left:
|
|
1136
|
-
top:
|
|
1113
|
+
left: left,
|
|
1114
|
+
top: top,
|
|
1137
1115
|
zIndex: 1000
|
|
1138
1116
|
}
|
|
1139
1117
|
}, /*#__PURE__*/React.createElement(FormNumberInput, {
|
|
@@ -1165,8 +1143,8 @@ export default function Viewer2D(_ref) {
|
|
|
1165
1143
|
id: "ruler_numberInput",
|
|
1166
1144
|
style: {
|
|
1167
1145
|
position: 'absolute',
|
|
1168
|
-
left:
|
|
1169
|
-
top:
|
|
1146
|
+
left: left,
|
|
1147
|
+
top: top,
|
|
1170
1148
|
zIndex: 1000
|
|
1171
1149
|
}
|
|
1172
1150
|
}, /*#__PURE__*/React.createElement(FormNumberInput, {
|
|
@@ -1197,8 +1175,8 @@ export default function Viewer2D(_ref) {
|
|
|
1197
1175
|
id: "ruler_numberInput",
|
|
1198
1176
|
style: {
|
|
1199
1177
|
position: 'absolute',
|
|
1200
|
-
left:
|
|
1201
|
-
top:
|
|
1178
|
+
left: left,
|
|
1179
|
+
top: top,
|
|
1202
1180
|
zIndex: 1000
|
|
1203
1181
|
}
|
|
1204
1182
|
}, /*#__PURE__*/React.createElement(FormNumberInput, {
|
|
@@ -1279,24 +1257,7 @@ export default function Viewer2D(_ref) {
|
|
|
1279
1257
|
_currentObject = state.getIn(['scene', 'layers', layerID, elementPrototype, elementID]);
|
|
1280
1258
|
}
|
|
1281
1259
|
if (_currentObject) {
|
|
1282
|
-
var
|
|
1283
|
-
var payload = (_currentObject3 = _currentObject) === null || _currentObject3 === void 0 ? void 0 : _currentObject3.toJS();
|
|
1284
|
-
if (((_currentObject4 = _currentObject) === null || _currentObject4 === void 0 ? void 0 : _currentObject4.prototype) === 'lines') {
|
|
1285
|
-
// caculating length of selected line//
|
|
1286
|
-
var v_a = layer.vertices.get(_currentObject.vertices.get(0));
|
|
1287
|
-
var v_b = layer.vertices.get(_currentObject.vertices.get(1));
|
|
1288
|
-
var distance = GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
1289
|
-
var _length3 = convert(distance).from('cm').to('in');
|
|
1290
|
-
payload.length = _length3;
|
|
1291
|
-
//////////////////////////////////////
|
|
1292
|
-
} else if (((_currentObject5 = _currentObject) === null || _currentObject5 === void 0 ? void 0 : _currentObject5.prototype) === 'items') {
|
|
1293
|
-
// check this cabinet has warning box
|
|
1294
|
-
payload.isWarning = isWarningItem(_currentObject);
|
|
1295
|
-
// check this item is available molding
|
|
1296
|
-
payload.isMoldingAvailable = MoldingUtils.isEnableItemForMolding(layer, _currentObject);
|
|
1297
|
-
// check this item is snapped to wall
|
|
1298
|
-
payload.isAttachedWall = MoldingUtils.isAttachedWall(layer, _currentObject);
|
|
1299
|
-
}
|
|
1260
|
+
var payload = updatePayloadOfInternalEvent(_currentObject, layer, catalog);
|
|
1300
1261
|
|
|
1301
1262
|
// send selection event befor replace event
|
|
1302
1263
|
if (internalType === constants.INTERNAL_EVENT_REPLACE_CABINET) {
|
|
@@ -1315,7 +1276,6 @@ export default function Viewer2D(_ref) {
|
|
|
1315
1276
|
};
|
|
1316
1277
|
var onChangeValue = function onChangeValue(value) {
|
|
1317
1278
|
if (sFlag) return;
|
|
1318
|
-
setSvgValue(value);
|
|
1319
1279
|
var _zoomValue = parseInt((value.a - 0.5) / constants.ZOOM_VARIABLE);
|
|
1320
1280
|
if (_zoomValue > constants.MAX_ZOOM_IN_SCALE) return;
|
|
1321
1281
|
if (_zoomValue < 0 || Number.isNaN(_zoomValue)) return;
|
|
@@ -1328,8 +1288,6 @@ export default function Viewer2D(_ref) {
|
|
|
1328
1288
|
var bbox;
|
|
1329
1289
|
if (_rect && _rulerEdit) {
|
|
1330
1290
|
bbox = _rect.getBoundingClientRect();
|
|
1331
|
-
// bbox.width = _rect.getBBox().width;
|
|
1332
|
-
// bbox.height = _rect.getBBox().height;
|
|
1333
1291
|
_rulerEdit.style.left = "".concat(bbox.left - (150 - bbox.width) / 2, "px");
|
|
1334
1292
|
_rulerEdit.style.top = "".concat(bbox.top - (50 - bbox.height) / 2, "px");
|
|
1335
1293
|
}
|
|
@@ -1347,7 +1305,6 @@ export default function Viewer2D(_ref) {
|
|
|
1347
1305
|
}
|
|
1348
1306
|
};
|
|
1349
1307
|
var onChangeTool = function onChangeTool(tool) {
|
|
1350
|
-
setSvgTool(tool);
|
|
1351
1308
|
switch (tool) {
|
|
1352
1309
|
case TOOL_NONE:
|
|
1353
1310
|
projectActions.selectToolEdit();
|
|
@@ -1364,12 +1321,12 @@ export default function Viewer2D(_ref) {
|
|
|
1364
1321
|
}
|
|
1365
1322
|
};
|
|
1366
1323
|
var onZoom = function onZoom(value) {
|
|
1367
|
-
// var nextValue = viewer2D
|
|
1324
|
+
// var nextValue = viewer2D.toJS();
|
|
1368
1325
|
// nextValue = zoom(nextValue, 0, 0, value.a / nextValue.a)
|
|
1369
1326
|
// projectActions.updateZoomScale(nextValue.a);
|
|
1370
1327
|
// return viewer2DActions.updateCameraView(nextValue)
|
|
1371
1328
|
};
|
|
1372
|
-
var _state$get$toJS =
|
|
1329
|
+
var _state$get$toJS = state.get('viewer2D').toJS(),
|
|
1373
1330
|
e = _state$get$toJS.e,
|
|
1374
1331
|
f = _state$get$toJS.f,
|
|
1375
1332
|
SVGWidth = _state$get$toJS.SVGWidth,
|
|
@@ -1446,23 +1403,19 @@ export default function Viewer2D(_ref) {
|
|
|
1446
1403
|
},
|
|
1447
1404
|
width: width - rulerSize,
|
|
1448
1405
|
height: height - rulerSize,
|
|
1449
|
-
value:
|
|
1450
|
-
tool: svgTool,
|
|
1406
|
+
value: viewer2D.isEmpty() ? null : viewer2D.toJS(),
|
|
1451
1407
|
onChangeValue: onChangeValue,
|
|
1408
|
+
tool: mode2Tool(mode),
|
|
1452
1409
|
onChangeTool: onChangeTool,
|
|
1453
1410
|
detectAutoPan: mode2DetectAutopan(mode),
|
|
1454
1411
|
onMouseDown: onMouseDown,
|
|
1455
1412
|
onMouseMove: onMouseMove,
|
|
1456
1413
|
onMouseUp: onMouseUp,
|
|
1414
|
+
miniaturePosition: "none",
|
|
1415
|
+
toolbarPosition: "none",
|
|
1457
1416
|
detectPinchGesture: false,
|
|
1458
1417
|
disableDoubleClickZoomWithToolAuto: true,
|
|
1459
|
-
ref: Viewer
|
|
1460
|
-
miniatureProps: {
|
|
1461
|
-
position: POSITION_NONE
|
|
1462
|
-
},
|
|
1463
|
-
toolbarProps: {
|
|
1464
|
-
position: POSITION_NONE
|
|
1465
|
-
}
|
|
1418
|
+
ref: Viewer
|
|
1466
1419
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
1467
1420
|
width: scene.width,
|
|
1468
1421
|
height: scene.height
|
|
@@ -1497,4 +1450,14 @@ Viewer2D.propTypes = {
|
|
|
1497
1450
|
state: PropTypes.object.isRequired,
|
|
1498
1451
|
width: PropTypes.number.isRequired,
|
|
1499
1452
|
height: PropTypes.number.isRequired
|
|
1453
|
+
};
|
|
1454
|
+
Viewer2D.contextTypes = {
|
|
1455
|
+
viewer2DActions: PropTypes.object.isRequired,
|
|
1456
|
+
linesActions: PropTypes.object.isRequired,
|
|
1457
|
+
holesActions: PropTypes.object.isRequired,
|
|
1458
|
+
verticesActions: PropTypes.object.isRequired,
|
|
1459
|
+
itemsActions: PropTypes.object.isRequired,
|
|
1460
|
+
areaActions: PropTypes.object.isRequired,
|
|
1461
|
+
projectActions: PropTypes.object.isRequired,
|
|
1462
|
+
catalog: PropTypes.object.isRequired
|
|
1500
1463
|
};
|
|
@@ -4,13 +4,15 @@ import Viewer3D from "./viewer3d";
|
|
|
4
4
|
import State3D from "./ruler-utils/state3D";
|
|
5
5
|
import { isEmpty } from "../viewer2d/utils";
|
|
6
6
|
var k = 0;
|
|
7
|
-
export default function Front3D(_ref) {
|
|
7
|
+
export default function Front3D(_ref, _ref2) {
|
|
8
8
|
var width = _ref.width,
|
|
9
9
|
height = _ref.height,
|
|
10
10
|
state = _ref.state,
|
|
11
|
+
setToolbar = _ref.setToolbar,
|
|
11
12
|
replaceCabinet = _ref.replaceCabinet,
|
|
12
13
|
keyDownEnable = _ref.keyDownEnable,
|
|
13
14
|
catalog = _ref.catalog;
|
|
15
|
+
var viewer2DActions = _ref2.viewer2DActions;
|
|
14
16
|
var _useState = useState(''),
|
|
15
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
16
18
|
mode = _useState2[0],
|
|
@@ -21,6 +23,15 @@ export default function Front3D(_ref) {
|
|
|
21
23
|
k++;
|
|
22
24
|
setMode(state.get('mode'));
|
|
23
25
|
}
|
|
26
|
+
var mouseUpEvent = function mouseUpEvent(event) {
|
|
27
|
+
setToolbar('');
|
|
28
|
+
};
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
if (!isEmpty(document.getElementById('front'))) document.getElementById('front').addEventListener('mouseup', mouseUpEvent);
|
|
31
|
+
return function () {
|
|
32
|
+
if (!isEmpty(document.getElementById('front'))) document.getElementById('front').removeEventListener('mouseup', mouseUpEvent);
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
24
35
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("svg", {
|
|
25
36
|
width: sceneWidth,
|
|
26
37
|
height: sceneHeight,
|
|
@@ -43,6 +54,7 @@ export default function Front3D(_ref) {
|
|
|
43
54
|
state: state,
|
|
44
55
|
width: width,
|
|
45
56
|
height: height,
|
|
57
|
+
setToolbar: setToolbar,
|
|
46
58
|
replaceCabinet: replaceCabinet,
|
|
47
59
|
keyDownEnable: keyDownEnable,
|
|
48
60
|
downloadFlag: false
|
|
@@ -14,7 +14,7 @@ export default function Scene3D(_ref) {
|
|
|
14
14
|
downloadFlag = _ref.downloadFlag;
|
|
15
15
|
var layers = scene.layers;
|
|
16
16
|
var selectedLayer = layers.get(scene.selectedLayer);
|
|
17
|
-
var ceilHeight = selectedLayer.ceilHeight;
|
|
17
|
+
var ceilHeight = Number(selectedLayer.ceilHeight);
|
|
18
18
|
var selectedLine = selectedLayer.lines.get(selectedLayer.selected.lines.toJS()[0]);
|
|
19
19
|
var vertex0 = selectedLayer.vertices.get(selectedLine.vertices.get(0));
|
|
20
20
|
var vertex1 = selectedLayer.vertices.get(selectedLine.vertices.get(1));
|