kitchen-simulator 3.1.2 → 4.0.1-react-18
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 +0 -3
- package/es/AppContext.js +1 -1
- package/es/LiteKitchenConfigurator.js +15 -25
- package/es/LiteRenderer.js +2 -5
- package/es/actions/export.js +12 -25
- package/es/catalog/catalog.js +5 -21
- package/es/components/content.js +2 -5
- package/es/components/export.js +6 -4
- package/es/components/style/export.js +2 -28
- package/es/components/style/form-number-input.js +22 -11
- package/es/components/viewer2d/group.js +4 -5
- package/es/components/viewer2d/item.js +300 -316
- package/es/components/viewer2d/layer.js +1 -1
- package/es/components/viewer2d/line.js +47 -17
- package/es/components/viewer2d/rulerX.js +0 -3
- package/es/components/viewer2d/rulerY.js +0 -3
- package/es/components/viewer2d/scene.js +1 -4
- package/es/components/viewer2d/state.js +1 -1
- package/es/components/viewer2d/viewer2d.js +43 -28
- package/es/components/viewer3d/viewer3d-first-person.js +0 -8
- package/es/components/viewer3d/viewer3d.js +0 -9
- package/es/devLiteRenderer.js +148 -317
- package/es/index.js +12 -4
- package/es/mocks/appliancePayload.json +27 -0
- package/es/mocks/cabinetPayload.json +1914 -0
- package/es/mocks/cabinetPayload2.json +76 -0
- package/es/mocks/dataBundle2.json +4 -0
- package/es/mocks/distancePayload.json +6 -0
- package/es/mocks/doorStylePayload2.json +84 -0
- package/es/mocks/furnishingPayload.json +23 -0
- package/es/mocks/itemCDSPayload.json +27 -0
- package/es/mocks/lightingPayload.json +23 -0
- package/es/mocks/mockProps.json +43 -0
- package/es/mocks/mockProps2.json +9 -0
- package/es/mocks/moldingPayload.json +19 -0
- package/es/mocks/projectItemsCatalog.json +133 -0
- package/es/mocks/rectangleShape.json +238 -0
- package/es/mocks/replaceCabinetPayload.json +81 -0
- package/es/mocks/roomShapePayload.json +5 -0
- package/es/useAppContext.js +8 -0
- package/lib/AppContext.js +1 -1
- package/lib/LiteKitchenConfigurator.js +15 -25
- package/lib/LiteRenderer.js +2 -5
- package/lib/actions/export.js +39 -35
- package/lib/catalog/catalog.js +4 -20
- package/lib/components/content.js +2 -5
- package/lib/components/export.js +26 -6
- package/lib/components/style/export.js +1 -105
- package/lib/components/style/form-number-input.js +22 -11
- package/lib/components/viewer2d/group.js +4 -5
- package/lib/components/viewer2d/item.js +298 -314
- package/lib/components/viewer2d/layer.js +1 -1
- package/lib/components/viewer2d/line.js +47 -17
- package/lib/components/viewer2d/rulerX.js +0 -3
- package/lib/components/viewer2d/rulerY.js +0 -3
- package/lib/components/viewer2d/scene.js +1 -4
- package/lib/components/viewer2d/state.js +1 -1
- package/lib/components/viewer2d/viewer2d.js +42 -27
- package/lib/components/viewer3d/viewer3d-first-person.js +0 -8
- package/lib/components/viewer3d/viewer3d.js +0 -9
- package/lib/devLiteRenderer.js +147 -316
- package/lib/index.js +12 -4
- package/lib/mocks/appliancePayload.json +27 -0
- package/lib/mocks/cabinetPayload.json +1914 -0
- package/lib/mocks/cabinetPayload2.json +76 -0
- package/lib/mocks/dataBundle2.json +4 -0
- package/lib/mocks/distancePayload.json +6 -0
- package/lib/mocks/doorStylePayload2.json +84 -0
- package/lib/mocks/furnishingPayload.json +23 -0
- package/lib/mocks/itemCDSPayload.json +27 -0
- package/lib/mocks/lightingPayload.json +23 -0
- package/lib/mocks/mockProps.json +43 -0
- package/lib/mocks/mockProps2.json +9 -0
- package/lib/mocks/moldingPayload.json +19 -0
- package/lib/mocks/projectItemsCatalog.json +133 -0
- package/lib/mocks/rectangleShape.json +238 -0
- package/lib/mocks/replaceCabinetPayload.json +81 -0
- package/lib/mocks/roomShapePayload.json +5 -0
- package/lib/useAppContext.js +16 -0
- package/package.json +16 -21
- package/es/catalog/properties/export.js +0 -21
- package/es/catalog/properties/property-checkbox.js +0 -68
- package/es/catalog/properties/property-color.js +0 -39
- package/es/catalog/properties/property-enum.js +0 -50
- package/es/catalog/properties/property-hidden.js +0 -19
- package/es/catalog/properties/property-lenght-measure.js +0 -100
- package/es/catalog/properties/property-length-measure.js +0 -84
- package/es/catalog/properties/property-length-measure_hole.js +0 -100
- package/es/catalog/properties/property-number.js +0 -48
- package/es/catalog/properties/property-read-only.js +0 -26
- package/es/catalog/properties/property-string.js +0 -48
- package/es/catalog/properties/property-toggle.js +0 -39
- package/es/catalog/properties/shared-property-style.js +0 -14
- package/es/components/style/button.js +0 -106
- package/es/components/style/cancel-button.js +0 -21
- package/es/components/style/content-container.js +0 -30
- package/es/components/style/content-title.js +0 -25
- package/es/components/style/delete-button.js +0 -24
- package/es/components/style/form-block.js +0 -20
- package/es/components/style/form-color-input.js +0 -26
- package/es/components/style/form-label.js +0 -22
- package/es/components/style/form-number-input_2.js +0 -200
- package/es/components/style/form-select.js +0 -19
- package/es/components/style/form-slider.js +0 -60
- package/es/components/style/form-submit-button.js +0 -25
- package/es/components/style/form-text-input.js +0 -69
- package/es/plugins/SVGLoader.js +0 -1414
- package/es/styles/export.js +0 -5
- package/es/styles/tabs.css +0 -40
- package/lib/catalog/properties/export.js +0 -81
- package/lib/catalog/properties/property-checkbox.js +0 -76
- package/lib/catalog/properties/property-color.js +0 -47
- package/lib/catalog/properties/property-enum.js +0 -58
- package/lib/catalog/properties/property-hidden.js +0 -27
- package/lib/catalog/properties/property-lenght-measure.js +0 -108
- package/lib/catalog/properties/property-length-measure.js +0 -92
- package/lib/catalog/properties/property-length-measure_hole.js +0 -108
- package/lib/catalog/properties/property-number.js +0 -56
- package/lib/catalog/properties/property-read-only.js +0 -34
- package/lib/catalog/properties/property-string.js +0 -56
- package/lib/catalog/properties/property-toggle.js +0 -47
- package/lib/catalog/properties/shared-property-style.js +0 -21
- package/lib/components/style/button.js +0 -115
- package/lib/components/style/cancel-button.js +0 -29
- package/lib/components/style/content-container.js +0 -38
- package/lib/components/style/content-title.js +0 -35
- package/lib/components/style/delete-button.js +0 -34
- package/lib/components/style/form-block.js +0 -28
- package/lib/components/style/form-color-input.js +0 -34
- package/lib/components/style/form-label.js +0 -30
- package/lib/components/style/form-number-input_2.js +0 -209
- package/lib/components/style/form-select.js +0 -29
- package/lib/components/style/form-slider.js +0 -68
- package/lib/components/style/form-submit-button.js +0 -35
- package/lib/components/style/form-text-input.js +0 -78
- package/lib/plugins/SVGLoader.js +0 -1419
- package/lib/styles/export.js +0 -13
- package/lib/styles/tabs.css +0 -40
|
@@ -116,7 +116,7 @@ export default function Layer(_ref) {
|
|
|
116
116
|
var lineData = [];
|
|
117
117
|
lines.sort(function compare(a, b) {
|
|
118
118
|
return a.createdDateTime - b.createdDateTime;
|
|
119
|
-
}).valueSeq().forEach(function (line) {
|
|
119
|
+
}).valueSeq().forEach(function (line, index) {
|
|
120
120
|
lineData.push(/*#__PURE__*/React.createElement(Line, {
|
|
121
121
|
key: line.id,
|
|
122
122
|
layer: layer,
|
|
@@ -247,11 +247,13 @@ export default function Line(_ref) {
|
|
|
247
247
|
if (!showWallCabinetMeasure || wall_posArray.length <= 2) {
|
|
248
248
|
wallSpace = 0;
|
|
249
249
|
}
|
|
250
|
-
wallRuler = wall_posAndwidth.map(function (pAw) {
|
|
250
|
+
wallRuler = wall_posAndwidth.map(function (pAw, idx) {
|
|
251
251
|
if (pAw.length > 1) {
|
|
252
252
|
if (Math.sin(angle) === 0 || GeometryUtils.almostEqual(y1, y2)) {
|
|
253
253
|
if (x1 - x2 > 0) {
|
|
254
|
-
return /*#__PURE__*/React.createElement("g",
|
|
254
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
255
|
+
key: "wallRuler-".concat(idx)
|
|
256
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
255
257
|
x1: pAw.pos.x + pAw.length,
|
|
256
258
|
y1: pAw.pos.y,
|
|
257
259
|
x2: pAw.pos.x + pAw.length,
|
|
@@ -273,7 +275,9 @@ export default function Line(_ref) {
|
|
|
273
275
|
style: STYLE_DASH
|
|
274
276
|
}));
|
|
275
277
|
} else {
|
|
276
|
-
return /*#__PURE__*/React.createElement("g",
|
|
278
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
279
|
+
key: "wallRuler-".concat(idx)
|
|
280
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
277
281
|
x1: pAw.pos.x + pAw.length,
|
|
278
282
|
y1: pAw.pos.y,
|
|
279
283
|
x2: pAw.pos.x + pAw.length,
|
|
@@ -298,7 +302,9 @@ export default function Line(_ref) {
|
|
|
298
302
|
} else {
|
|
299
303
|
if (y1 - y2 > 0) {
|
|
300
304
|
if (x1 - x2 < 0 || GeometryUtils.almostEqual(x1, x2)) {
|
|
301
|
-
return /*#__PURE__*/React.createElement("g",
|
|
305
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
306
|
+
key: "wallRuler-".concat(idx)
|
|
307
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
302
308
|
x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
303
309
|
y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
304
310
|
x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
|
|
@@ -320,7 +326,9 @@ export default function Line(_ref) {
|
|
|
320
326
|
style: STYLE_DASH
|
|
321
327
|
}));
|
|
322
328
|
} else {
|
|
323
|
-
return /*#__PURE__*/React.createElement("g",
|
|
329
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
330
|
+
key: "wallRuler-".concat(idx)
|
|
331
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
324
332
|
x1: pAw.pos.x,
|
|
325
333
|
y1: pAw.pos.y,
|
|
326
334
|
x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
|
|
@@ -344,7 +352,9 @@ export default function Line(_ref) {
|
|
|
344
352
|
}
|
|
345
353
|
} else {
|
|
346
354
|
if (x1 - x2 < 0 || GeometryUtils.almostEqual(x1, x2)) {
|
|
347
|
-
return /*#__PURE__*/React.createElement("g",
|
|
355
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
356
|
+
key: "wallRuler-".concat(idx)
|
|
357
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
348
358
|
x1: pAw.pos.x,
|
|
349
359
|
y1: pAw.pos.y,
|
|
350
360
|
x2: pAw.pos.x - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
|
|
@@ -366,7 +376,9 @@ export default function Line(_ref) {
|
|
|
366
376
|
style: STYLE_DASH
|
|
367
377
|
}));
|
|
368
378
|
} else {
|
|
369
|
-
return /*#__PURE__*/React.createElement("g",
|
|
379
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
380
|
+
key: "wallRuler-".concat(idx)
|
|
381
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
370
382
|
x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
371
383
|
y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
372
384
|
x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + wallSpace) * Math.sin(angle / 180 * Math.PI),
|
|
@@ -459,11 +471,13 @@ export default function Line(_ref) {
|
|
|
459
471
|
if (!showBaseCabinetMeasure || base_posArray.length <= 2) {
|
|
460
472
|
baseSpace -= STEP;
|
|
461
473
|
}
|
|
462
|
-
baseRuler = base_posAndwidth.map(function (pAw) {
|
|
474
|
+
baseRuler = base_posAndwidth.map(function (pAw, idx) {
|
|
463
475
|
if (pAw.length > 1) {
|
|
464
476
|
if (Math.sin(angle) === 0 || GeometryUtils.almostEqual(y1, y2)) {
|
|
465
477
|
if (x1 - x2 > 0) {
|
|
466
|
-
return /*#__PURE__*/React.createElement("g",
|
|
478
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
479
|
+
key: "baseRuler-".concat(idx)
|
|
480
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
467
481
|
x1: pAw.pos.x + pAw.length,
|
|
468
482
|
y1: pAw.pos.y,
|
|
469
483
|
x2: pAw.pos.x + pAw.length,
|
|
@@ -485,7 +499,9 @@ export default function Line(_ref) {
|
|
|
485
499
|
style: STYLE_DASH
|
|
486
500
|
}));
|
|
487
501
|
} else {
|
|
488
|
-
return /*#__PURE__*/React.createElement("g",
|
|
502
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
503
|
+
key: "baseRuler-".concat(idx)
|
|
504
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
489
505
|
x1: pAw.pos.x + pAw.length,
|
|
490
506
|
y1: pAw.pos.y,
|
|
491
507
|
x2: pAw.pos.x + pAw.length,
|
|
@@ -510,7 +526,9 @@ export default function Line(_ref) {
|
|
|
510
526
|
} else {
|
|
511
527
|
if (y1 - y2 > 0) {
|
|
512
528
|
if (x1 - x2 < 0 || GeometryUtils.almostEqual(x1, x2)) {
|
|
513
|
-
return /*#__PURE__*/React.createElement("g",
|
|
529
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
530
|
+
key: "baseRuler-".concat(idx)
|
|
531
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
514
532
|
x1: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
515
533
|
y1: pAw.pos.y - pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
516
534
|
x2: pAw.pos.x - pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
|
|
@@ -532,7 +550,9 @@ export default function Line(_ref) {
|
|
|
532
550
|
style: STYLE_DASH
|
|
533
551
|
}));
|
|
534
552
|
} else {
|
|
535
|
-
return /*#__PURE__*/React.createElement("g",
|
|
553
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
554
|
+
key: "baseRuler-".concat(idx)
|
|
555
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
536
556
|
x1: pAw.pos.x,
|
|
537
557
|
y1: pAw.pos.y,
|
|
538
558
|
x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
|
|
@@ -556,7 +576,9 @@ export default function Line(_ref) {
|
|
|
556
576
|
}
|
|
557
577
|
} else {
|
|
558
578
|
if (x1 - x2 < 0 || GeometryUtils.almostEqual(x1, x2)) {
|
|
559
|
-
return /*#__PURE__*/React.createElement("g",
|
|
579
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
580
|
+
key: "baseRuler-".concat(idx)
|
|
581
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
560
582
|
x1: pAw.pos.x,
|
|
561
583
|
y1: pAw.pos.y,
|
|
562
584
|
x2: pAw.pos.x - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
|
|
@@ -578,7 +600,9 @@ export default function Line(_ref) {
|
|
|
578
600
|
style: STYLE_DASH
|
|
579
601
|
}));
|
|
580
602
|
} else {
|
|
581
|
-
return /*#__PURE__*/React.createElement("g",
|
|
603
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
604
|
+
key: "baseRuler-".concat(idx)
|
|
605
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
582
606
|
x1: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI),
|
|
583
607
|
y1: pAw.pos.y + pAw.length * Math.sin(angle / 180 * Math.PI),
|
|
584
608
|
x2: pAw.pos.x + pAw.length * Math.cos(angle / 180 * Math.PI) - (thickness / 2 + baseSpace) * Math.sin(angle / 180 * Math.PI),
|
|
@@ -652,7 +676,9 @@ export default function Line(_ref) {
|
|
|
652
676
|
//the space from the dimensioning line to the bottom
|
|
653
677
|
var lineSpacedimension2 = 14;
|
|
654
678
|
if (compareVertices(vertex0, vertex1) >= 0 && vertex0.x !== vertex1.x) {
|
|
655
|
-
renderedRuler.push(/*#__PURE__*/React.createElement("g",
|
|
679
|
+
renderedRuler.push(/*#__PURE__*/React.createElement("g", {
|
|
680
|
+
key: 'ruler_' + line.id
|
|
681
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
656
682
|
x1: length,
|
|
657
683
|
y1: lineSpace + lineSpacedimension1,
|
|
658
684
|
x2: length,
|
|
@@ -674,7 +700,9 @@ export default function Line(_ref) {
|
|
|
674
700
|
style: STYLE_ROOM_SHAPE
|
|
675
701
|
})));
|
|
676
702
|
} else {
|
|
677
|
-
renderedRuler.push(/*#__PURE__*/React.createElement("g",
|
|
703
|
+
renderedRuler.push(/*#__PURE__*/React.createElement("g", {
|
|
704
|
+
key: 'ruler_' + line.id
|
|
705
|
+
}, /*#__PURE__*/React.createElement("line", {
|
|
678
706
|
x1: 0,
|
|
679
707
|
y1: lineSpace + lineSpacedimension1,
|
|
680
708
|
x2: 0,
|
|
@@ -773,7 +801,9 @@ export default function Line(_ref) {
|
|
|
773
801
|
}
|
|
774
802
|
});
|
|
775
803
|
}
|
|
776
|
-
return /*#__PURE__*/React.createElement("g",
|
|
804
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
805
|
+
key: line.id
|
|
806
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
777
807
|
transform: "translate(".concat(x1, ", ").concat(y1, ") rotate(").concat(angle, ", 0, 0)"),
|
|
778
808
|
"data-element-root": true,
|
|
779
809
|
"data-prototype": 'ruler',
|
|
@@ -121,8 +121,5 @@ export { Scene as default };
|
|
|
121
121
|
Scene.propTypes = {
|
|
122
122
|
scene: PropTypes.object.isRequired,
|
|
123
123
|
catalog: PropTypes.object.isRequired,
|
|
124
|
-
relatedLines: PropTypes.
|
|
125
|
-
};
|
|
126
|
-
Scene.contextTypes = {
|
|
127
|
-
projectActions: PropTypes.object.isRequired
|
|
124
|
+
relatedLines: PropTypes.array.isRequired
|
|
128
125
|
};
|
|
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import React, { useEffect, useRef, useState } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { ReactSVGPanZoom, TOOL_AUTO, TOOL_NONE, TOOL_PAN, TOOL_ZOOM_IN, TOOL_ZOOM_OUT } from 'react-svg-pan-zoom';
|
|
7
|
+
import { INITIAL_VALUE, POSITION_NONE, 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";
|
|
@@ -18,6 +18,7 @@ import { formatNumber } from "../../utils/math";
|
|
|
18
18
|
import { isEmpty } from "../../utils/helper"; // variables
|
|
19
19
|
import { isWarningItem } from "./utils";
|
|
20
20
|
import { MoldingUtils } from "../../utils/export";
|
|
21
|
+
import { useAppContext } from "../../useAppContext";
|
|
21
22
|
// variables
|
|
22
23
|
var pinFlag = false;
|
|
23
24
|
var sFlag = false; //for all object move
|
|
@@ -121,21 +122,22 @@ function extractElementData(node) {
|
|
|
121
122
|
direct: node.attributes.getNamedItem('data-direct') ? node.attributes.getNamedItem('data-direct').value : 0
|
|
122
123
|
};
|
|
123
124
|
}
|
|
124
|
-
export default function Viewer2D(_ref
|
|
125
|
+
export default function Viewer2D(_ref) {
|
|
125
126
|
var state = _ref.state,
|
|
126
127
|
width = _ref.width,
|
|
127
128
|
height = _ref.height,
|
|
128
129
|
setToolbar = _ref.setToolbar,
|
|
129
130
|
replaceCabinet = _ref.replaceCabinet,
|
|
130
131
|
onInternalEvent = _ref.onInternalEvent;
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
var _useAppContext = useAppContext(),
|
|
133
|
+
viewer2DActions = _useAppContext.viewer2DActions,
|
|
134
|
+
linesActions = _useAppContext.linesActions,
|
|
135
|
+
holesActions = _useAppContext.holesActions,
|
|
136
|
+
verticesActions = _useAppContext.verticesActions,
|
|
137
|
+
itemsActions = _useAppContext.itemsActions,
|
|
138
|
+
areaActions = _useAppContext.areaActions,
|
|
139
|
+
projectActions = _useAppContext.projectActions,
|
|
140
|
+
catalog = _useAppContext.catalog;
|
|
139
141
|
var _useState = useState(null),
|
|
140
142
|
_useState2 = _slicedToArray(_useState, 2),
|
|
141
143
|
rulerEdit = _useState2[0],
|
|
@@ -158,6 +160,26 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
158
160
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
159
161
|
drawStart = _useState8[0],
|
|
160
162
|
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]);
|
|
161
183
|
useEffect(function () {
|
|
162
184
|
// move viewer point to center
|
|
163
185
|
var selectedLayer = state.scene.layers.get(state.scene.selectedLayer);
|
|
@@ -182,9 +204,9 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
182
204
|
var layerID = scene.selectedLayer;
|
|
183
205
|
var wall_thickness = LINE_THICKNESS / 2;
|
|
184
206
|
var layer = scene.getIn(['layers', layerID]);
|
|
185
|
-
var mapCursorPosition = function mapCursorPosition(
|
|
186
|
-
var x =
|
|
187
|
-
y =
|
|
207
|
+
var mapCursorPosition = function mapCursorPosition(_ref2) {
|
|
208
|
+
var x = _ref2.x,
|
|
209
|
+
y = _ref2.y;
|
|
188
210
|
return {
|
|
189
211
|
x: x,
|
|
190
212
|
y: -y + scene.height
|
|
@@ -1287,6 +1309,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1287
1309
|
};
|
|
1288
1310
|
var onChangeValue = function onChangeValue(value) {
|
|
1289
1311
|
if (sFlag) return;
|
|
1312
|
+
setSvgValue(value);
|
|
1290
1313
|
var _zoomValue = parseInt((value.a - 0.5) / constants.ZOOM_VARIABLE);
|
|
1291
1314
|
if (_zoomValue > constants.MAX_ZOOM_IN_SCALE) return;
|
|
1292
1315
|
if (_zoomValue < 0 || Number.isNaN(_zoomValue)) return;
|
|
@@ -1318,6 +1341,7 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1318
1341
|
}
|
|
1319
1342
|
};
|
|
1320
1343
|
var onChangeTool = function onChangeTool(tool) {
|
|
1344
|
+
setSvgTool(tool);
|
|
1321
1345
|
switch (tool) {
|
|
1322
1346
|
case TOOL_NONE:
|
|
1323
1347
|
projectActions.selectToolEdit();
|
|
@@ -1416,19 +1440,20 @@ export default function Viewer2D(_ref, _ref2) {
|
|
|
1416
1440
|
},
|
|
1417
1441
|
width: width - rulerSize,
|
|
1418
1442
|
height: height - rulerSize,
|
|
1419
|
-
value:
|
|
1443
|
+
value: svgValue,
|
|
1444
|
+
tool: svgTool,
|
|
1420
1445
|
onChangeValue: onChangeValue,
|
|
1421
|
-
tool: mode2Tool(mode),
|
|
1422
1446
|
onChangeTool: onChangeTool,
|
|
1423
1447
|
detectAutoPan: mode2DetectAutopan(mode),
|
|
1424
1448
|
onMouseDown: onMouseDown,
|
|
1425
1449
|
onMouseMove: onMouseMove,
|
|
1426
1450
|
onMouseUp: onMouseUp,
|
|
1427
|
-
miniaturePosition: "none",
|
|
1428
|
-
toolbarPosition: "none",
|
|
1429
1451
|
detectPinchGesture: false,
|
|
1430
1452
|
disableDoubleClickZoomWithToolAuto: true,
|
|
1431
|
-
ref: Viewer
|
|
1453
|
+
ref: Viewer,
|
|
1454
|
+
toolbarProps: {
|
|
1455
|
+
position: POSITION_NONE
|
|
1456
|
+
}
|
|
1432
1457
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
1433
1458
|
width: scene.width,
|
|
1434
1459
|
height: scene.height
|
|
@@ -1463,14 +1488,4 @@ Viewer2D.propTypes = {
|
|
|
1463
1488
|
state: PropTypes.object.isRequired,
|
|
1464
1489
|
width: PropTypes.number.isRequired,
|
|
1465
1490
|
height: PropTypes.number.isRequired
|
|
1466
|
-
};
|
|
1467
|
-
Viewer2D.contextTypes = {
|
|
1468
|
-
viewer2DActions: PropTypes.object.isRequired,
|
|
1469
|
-
linesActions: PropTypes.object.isRequired,
|
|
1470
|
-
holesActions: PropTypes.object.isRequired,
|
|
1471
|
-
verticesActions: PropTypes.object.isRequired,
|
|
1472
|
-
itemsActions: PropTypes.object.isRequired,
|
|
1473
|
-
areaActions: PropTypes.object.isRequired,
|
|
1474
|
-
projectActions: PropTypes.object.isRequired,
|
|
1475
|
-
catalog: PropTypes.object.isRequired
|
|
1476
1491
|
};
|
|
@@ -298,12 +298,4 @@ Viewer3DFirstPerson.propTypes = {
|
|
|
298
298
|
state: PropTypes.object.isRequired,
|
|
299
299
|
width: PropTypes.number.isRequired,
|
|
300
300
|
height: PropTypes.number.isRequired
|
|
301
|
-
};
|
|
302
|
-
Viewer3DFirstPerson.contextTypes = {
|
|
303
|
-
areaActions: PropTypes.object.isRequired,
|
|
304
|
-
holesActions: PropTypes.object.isRequired,
|
|
305
|
-
itemsActions: PropTypes.object.isRequired,
|
|
306
|
-
linesActions: PropTypes.object.isRequired,
|
|
307
|
-
projectActions: PropTypes.object.isRequired,
|
|
308
|
-
catalog: PropTypes.object
|
|
309
301
|
};
|
|
@@ -2665,13 +2665,4 @@ Scene3DViewer.propTypes = {
|
|
|
2665
2665
|
width: PropTypes.number.isRequired,
|
|
2666
2666
|
height: PropTypes.number.isRequired,
|
|
2667
2667
|
replaceCabinet: PropTypes.func.isRequired
|
|
2668
|
-
};
|
|
2669
|
-
Scene3DViewer.contextTypes = {
|
|
2670
|
-
areaActions: PropTypes.object.isRequired,
|
|
2671
|
-
holesActions: PropTypes.object.isRequired,
|
|
2672
|
-
itemsActions: PropTypes.object.isRequired,
|
|
2673
|
-
linesActions: PropTypes.object.isRequired,
|
|
2674
|
-
sceneActions: PropTypes.object.isRequired,
|
|
2675
|
-
projectActions: PropTypes.object.isRequired,
|
|
2676
|
-
catalog: PropTypes.object
|
|
2677
2668
|
};
|