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
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = consoleDebugger;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _export = _interopRequireDefault(require("../actions/export"));
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function consoleDebugger() {
|
|
13
|
+
return function (store, stateExtractor) {
|
|
14
|
+
window.KitchenConfigurator = _objectSpread(_objectSpread({}, _export["default"]), {}, {
|
|
15
|
+
getStore: function getStore() {
|
|
16
|
+
return store;
|
|
17
|
+
},
|
|
18
|
+
getState: function getState() {
|
|
19
|
+
return stateExtractor(store.getState());
|
|
20
|
+
},
|
|
21
|
+
"do": function _do(actions) {
|
|
22
|
+
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
23
|
+
actions = actions.reverse();
|
|
24
|
+
var dispatch = store.dispatch;
|
|
25
|
+
var _dispatchAction = function dispatchAction() {
|
|
26
|
+
console.info("There are other ".concat(actions.length, " actions on stack"));
|
|
27
|
+
if (actions.length === 0) return;
|
|
28
|
+
dispatch(actions.pop());
|
|
29
|
+
if (actions.length === 0) return;
|
|
30
|
+
setTimeout(_dispatchAction, delay);
|
|
31
|
+
};
|
|
32
|
+
setTimeout(_dispatchAction, 0);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
console.groupCollapsed('KitchenConfigurator');
|
|
36
|
+
console.info('KitchenConfigurator is ready');
|
|
37
|
+
console.info('console.log(KitchenConfigurator)');
|
|
38
|
+
console.log(window.KitchenConfigurator);
|
|
39
|
+
console.groupEnd();
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "ConsoleDebugger", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _consoleDebugger["default"];
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "Keyboard", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _keyboard["default"];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
exports["default"] = void 0;
|
|
20
|
+
var _keyboard = _interopRequireDefault(require("./keyboard"));
|
|
21
|
+
var _consoleDebugger = _interopRequireDefault(require("./console-debugger"));
|
|
22
|
+
var _default = exports["default"] = {
|
|
23
|
+
Keyboard: _keyboard["default"],
|
|
24
|
+
ConsoleDebugger: _consoleDebugger["default"]
|
|
25
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = keyboard;
|
|
7
|
+
var _constants = require("../constants");
|
|
8
|
+
var _projectActions = require("../actions/project-actions");
|
|
9
|
+
function keyboard() {
|
|
10
|
+
return function (store, stateExtractor) {
|
|
11
|
+
window.addEventListener('keydown', function (event) {
|
|
12
|
+
var state = stateExtractor(store.getState());
|
|
13
|
+
var mode = state.get('mode');
|
|
14
|
+
switch (event.keyCode) {
|
|
15
|
+
// case KEYBOARD_BUTTON_CODE.BACKSPACE:
|
|
16
|
+
// case KEYBOARD_BUTTON_CODE.DELETE: {
|
|
17
|
+
// if (
|
|
18
|
+
// [
|
|
19
|
+
// MODE_IDLE,
|
|
20
|
+
// MODE_3D_FIRST_PERSON,
|
|
21
|
+
// MODE_3D_VIEW,
|
|
22
|
+
// MODE_IDLE_3D,
|
|
23
|
+
// MODE_ROTATING_ITEM_3D,
|
|
24
|
+
// MODE_DRAGGING_ITEM_3D
|
|
25
|
+
// ].includes(mode)
|
|
26
|
+
// )
|
|
27
|
+
// store.dispatch(remove());
|
|
28
|
+
// break;
|
|
29
|
+
// }
|
|
30
|
+
case _constants.KEYBOARD_BUTTON_CODE.ESC:
|
|
31
|
+
{
|
|
32
|
+
store.dispatch((0, _projectActions.rollback)());
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
case _constants.KEYBOARD_BUTTON_CODE.Z:
|
|
36
|
+
{
|
|
37
|
+
if (event.getModifierState('Control') || event.getModifierState('Meta')) store.dispatch((0, _projectActions.undo)());
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case _constants.KEYBOARD_BUTTON_CODE.Q:
|
|
41
|
+
{
|
|
42
|
+
if (event.getModifierState('Control') || event.getModifierState('Meta')) store.dispatch((0, _projectActions.redo)());
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case _constants.KEYBOARD_BUTTON_CODE.ALT:
|
|
46
|
+
{
|
|
47
|
+
if (_constants.MODE_SNAPPING.includes(mode)) store.dispatch((0, _projectActions.toggleSnap)(state.snapMask.merge({
|
|
48
|
+
SNAP_POINT: false,
|
|
49
|
+
SNAP_LINE: false,
|
|
50
|
+
SNAP_SEGMENT: false,
|
|
51
|
+
SNAP_GRID: false,
|
|
52
|
+
SNAP_GUIDE: false,
|
|
53
|
+
tempSnapConfiguartion: state.snapMask.toJS()
|
|
54
|
+
})));
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case _constants.KEYBOARD_BUTTON_CODE.C:
|
|
58
|
+
{
|
|
59
|
+
var selectedLayer = state.getIn(['scene', 'selectedLayer']);
|
|
60
|
+
var selected = state.getIn(['scene', 'layers', selectedLayer, 'selected']);
|
|
61
|
+
if ((mode === _constants.MODE_IDLE || mode === _constants.MODE_3D_VIEW) && (selected.holes.size || selected.areas.size || selected.items.size || selected.lines.size)) {
|
|
62
|
+
if (selected.holes.size) {
|
|
63
|
+
var hole = state.getIn(['scene', 'layers', selectedLayer, 'holes', selected.holes.get(0)]);
|
|
64
|
+
store.dispatch((0, _projectActions.copyProperties)(hole.get('properties')));
|
|
65
|
+
} else if (selected.areas.size) {
|
|
66
|
+
var area = state.getIn(['scene', 'layers', selectedLayer, 'areas', selected.areas.get(0)]);
|
|
67
|
+
store.dispatch((0, _projectActions.copyProperties)(area.properties));
|
|
68
|
+
} else if (selected.items.size) {
|
|
69
|
+
var item = state.getIn(['scene', 'layers', selectedLayer, 'items', selected.items.get(0)]);
|
|
70
|
+
store.dispatch((0, _projectActions.copyProperties)(item.properties));
|
|
71
|
+
} else if (selected.lines.size) {
|
|
72
|
+
var line = state.getIn(['scene', 'layers', selectedLayer, 'lines', selected.lines.get(0)]);
|
|
73
|
+
store.dispatch((0, _projectActions.copyProperties)(line.properties));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case _constants.KEYBOARD_BUTTON_CODE.V:
|
|
79
|
+
{
|
|
80
|
+
store.dispatch((0, _projectActions.pasteProperties)());
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case _constants.KEYBOARD_BUTTON_CODE.SHIFT:
|
|
84
|
+
{
|
|
85
|
+
if (['TEXTAREA', 'INPUT'].includes(document.activeElement.tagName) === false) {
|
|
86
|
+
if ([_constants.MODE_DRAWING_ITEM_3D, _constants.MODE_IDLE_3D].includes(mode)) store.dispatch((0, _projectActions.recreate)());else if ([_constants.MODE_DRAWING_ITEM, _constants.MODE_IDLE].includes(mode)) store.dispatch((0, _projectActions.shift2doff)());
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
window.addEventListener('keyup', function (event) {
|
|
93
|
+
var state = stateExtractor(store.getState());
|
|
94
|
+
var mode = state.get('mode');
|
|
95
|
+
switch (event.keyCode) {
|
|
96
|
+
case _constants.KEYBOARD_BUTTON_CODE.ALT:
|
|
97
|
+
{
|
|
98
|
+
if (_constants.MODE_SNAPPING.includes(mode)) store.dispatch((0, _projectActions.toggleSnap)(state.snapMask.merge(state.snapMask.get('tempSnapConfiguartion'))));
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case _constants.KEYBOARD_BUTTON_CODE.CTRL:
|
|
102
|
+
{
|
|
103
|
+
// store.dispatch(setAlterateState());
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case _constants.KEYBOARD_BUTTON_CODE.SHIFT:
|
|
107
|
+
{
|
|
108
|
+
if (['TEXTAREA', 'INPUT'].includes(document.activeElement.tagName) === false) {
|
|
109
|
+
if ([_constants.MODE_DRAWING_ITEM_3D, _constants.MODE_IDLE_3D].includes(mode)) store.dispatch((0, _projectActions.uncreate)());else if ([_constants.MODE_DRAWING_ITEM, _constants.MODE_IDLE].includes(mode)) store.dispatch((0, _projectActions.shift2don)());
|
|
110
|
+
}
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
module.exports = exports.default;
|
|
@@ -132,7 +132,10 @@ function _default(state, action) {
|
|
|
132
132
|
case _constants.SET_IS_CABINET_DRAWING:
|
|
133
133
|
return _export2.Project.setIsCabinetDrawing(state, action.isCabinetDrawing).updatedState;
|
|
134
134
|
case _constants.CREATE_ROOM_WITH_SHAPE:
|
|
135
|
-
|
|
135
|
+
state = state.merge({
|
|
136
|
+
sceneHistory: _export.history.historyPush(state.sceneHistory, state.scene)
|
|
137
|
+
});
|
|
138
|
+
return _export2.Project.createRoomWithShape(state, action.roomShapeType, action.width, action.height, action.measurementUnit, action.doorStyle).updatedState;
|
|
136
139
|
default:
|
|
137
140
|
return state;
|
|
138
141
|
}
|
|
@@ -35,8 +35,10 @@ function _default(state, action) {
|
|
|
35
35
|
if (item.type.includes('Light')) {
|
|
36
36
|
var height = item.properties.getIn(['height', '_length']);
|
|
37
37
|
var heightUnit = item.properties.getIn(['height', '_unit']);
|
|
38
|
-
var newAltitude = action.value - (0, _convertUnitsLite.convert)(height).from(heightUnit).to('in');
|
|
38
|
+
var newAltitude = (0, _convertUnitsLite.convert)(action.value).from(_layer.unit).to('in') - (0, _convertUnitsLite.convert)(height).from(heightUnit).to('in');
|
|
39
39
|
item = item.setIn(['properties', 'altitude', '_length'], (0, _convertUnitsLite.convert)(newAltitude).from('in').to(_layer.unit));
|
|
40
|
+
item = item.setIn(['properties', 'altitude', '_unit'], _layer.unit);
|
|
41
|
+
item = item.setIn(['properties', 'altitude', 'length'], (0, _convertUnitsLite.convert)(newAltitude).from('in').to('cm'));
|
|
40
42
|
}
|
|
41
43
|
return item;
|
|
42
44
|
});
|
|
@@ -40,8 +40,10 @@ function _default(state, action) {
|
|
|
40
40
|
if (item.type.includes('Light')) {
|
|
41
41
|
var height = item.properties.getIn(['height', '_length']);
|
|
42
42
|
var heightUnit = item.properties.getIn(['height', '_unit']);
|
|
43
|
-
var newAltitude = action.value - (0, _convertUnitsLite.convert)(height).from(heightUnit).to('in');
|
|
43
|
+
var newAltitude = (0, _convertUnitsLite.convert)(action.value).from(_layer.unit).to('in') - (0, _convertUnitsLite.convert)(height).from(heightUnit).to('in');
|
|
44
44
|
item = item.setIn(['properties', 'altitude', '_length'], (0, _convertUnitsLite.convert)(newAltitude).from('in').to(_layer.unit));
|
|
45
|
+
item = item.setIn(['properties', 'altitude', '_unit'], _layer.unit);
|
|
46
|
+
item = item.setIn(['properties', 'altitude', 'length'], (0, _convertUnitsLite.convert)(newAltitude).from('in').to('cm'));
|
|
45
47
|
}
|
|
46
48
|
return item;
|
|
47
49
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.TabsStyle = void 0;
|
|
8
|
+
var TabsStyle = _interopRequireWildcard(require("./tabs.css"));
|
|
9
|
+
exports.TabsStyle = TabsStyle;
|
|
10
|
+
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); }
|
|
11
|
+
var _default = exports["default"] = {
|
|
12
|
+
TabsStyle: TabsStyle
|
|
13
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.react-tabs__tab-list {
|
|
2
|
+
border-bottom: 1px solid #aaa;
|
|
3
|
+
margin: 0 0 10px;
|
|
4
|
+
padding: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.react-tabs__tab {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
border: 1px solid transparent;
|
|
10
|
+
border-bottom: none;
|
|
11
|
+
bottom: -1px;
|
|
12
|
+
position: relative;
|
|
13
|
+
list-style: none;
|
|
14
|
+
padding: 6px 12px;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.react-tabs__tab--selected,
|
|
19
|
+
.react-tabs__tab:focus {
|
|
20
|
+
border-color: #aaa;
|
|
21
|
+
color: #1ca6fc;
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.react-tabs__tab-panel {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.react-tabs__tab-panel--selected {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes spin {
|
|
34
|
+
from {
|
|
35
|
+
transform: rotate(0deg);
|
|
36
|
+
}
|
|
37
|
+
to {
|
|
38
|
+
transform: rotate(360deg);
|
|
39
|
+
}
|
|
40
|
+
}
|
package/lib/utils/geometry.js
CHANGED
|
@@ -841,9 +841,9 @@ function getAllItemSpecified(scene, catalog, filter) {
|
|
|
841
841
|
var info = cat === null || cat === void 0 ? void 0 : cat.info;
|
|
842
842
|
var props = item.properties;
|
|
843
843
|
var getSize = function getSize(key) {
|
|
844
|
-
var _props$getIn;
|
|
844
|
+
var _props$getIn, _props$getIn2, _props$getIn3;
|
|
845
845
|
var length = props === null || props === void 0 || (_props$getIn = props.getIn) === null || _props$getIn === void 0 ? void 0 : _props$getIn.call(props, [key, '_length']);
|
|
846
|
-
return length != null ? (0, _convertUnitsLite.convert)(length).from('in').to(scene.unit) : 0;
|
|
846
|
+
return length != null ? (0, _convertUnitsLite.convert)(length).from((_props$getIn2 = props === null || props === void 0 || (_props$getIn3 = props.getIn) === null || _props$getIn3 === void 0 ? void 0 : _props$getIn3.call(props, [key, '_unit'])) !== null && _props$getIn2 !== void 0 ? _props$getIn2 : 'in').to(scene.unit) : 0;
|
|
847
847
|
};
|
|
848
848
|
val.size = {
|
|
849
849
|
width: getSize('width'),
|
|
@@ -1973,7 +1973,7 @@ function getAllHoleRect(scene, val) {
|
|
|
1973
1973
|
layer.lines.forEach(function (line) {
|
|
1974
1974
|
line.holes.forEach(function (holeID) {
|
|
1975
1975
|
var hole = layer.holes.get(holeID);
|
|
1976
|
-
holes.push(hole);
|
|
1976
|
+
if (hole) holes.push(hole);
|
|
1977
1977
|
});
|
|
1978
1978
|
});
|
|
1979
1979
|
var i = 0;
|
|
@@ -2163,20 +2163,20 @@ function relationshipOfTwoOverlappedLines(srcLine, destLine) {
|
|
|
2163
2163
|
}
|
|
2164
2164
|
function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
|
|
2165
2165
|
var p1 = {
|
|
2166
|
-
x: srcLine.x1,
|
|
2167
|
-
y: srcLine.y1
|
|
2166
|
+
x: Math.round(srcLine.x1 * 100) / 100,
|
|
2167
|
+
y: Math.round(srcLine.y1 * 100) / 100
|
|
2168
2168
|
};
|
|
2169
2169
|
var p2 = {
|
|
2170
|
-
x: srcLine.x2,
|
|
2171
|
-
y: srcLine.y2
|
|
2170
|
+
x: Math.round(srcLine.x2 * 100) / 100,
|
|
2171
|
+
y: Math.round(srcLine.y2 * 100) / 100
|
|
2172
2172
|
};
|
|
2173
2173
|
var p3 = {
|
|
2174
|
-
x: destLine.x1,
|
|
2175
|
-
y: destLine.y1
|
|
2174
|
+
x: Math.round(destLine.x1 * 100) / 100,
|
|
2175
|
+
y: Math.round(destLine.y1 * 100) / 100
|
|
2176
2176
|
};
|
|
2177
2177
|
var p4 = {
|
|
2178
|
-
x: destLine.x2,
|
|
2179
|
-
y: destLine.y2
|
|
2178
|
+
x: Math.round(destLine.x2 * 100) / 100,
|
|
2179
|
+
y: Math.round(destLine.y2 * 100) / 100
|
|
2180
2180
|
};
|
|
2181
2181
|
var x1 = p1.x,
|
|
2182
2182
|
y1 = p1.y;
|
|
@@ -2205,7 +2205,7 @@ function relationshipOfTwoOverlappedLines2(srcLine, destLine) {
|
|
|
2205
2205
|
lineSX = _sort4[0],
|
|
2206
2206
|
lineDX = _sort4[1];
|
|
2207
2207
|
var isReversedSrcLineIdx = false;
|
|
2208
|
-
if (lineSX[0].x === line1[0].x && lineSX[0].y === line1[0].y) isReversedSrcLineIdx = true;
|
|
2208
|
+
if (lineSX[0].x === line0[0].x && lineSX[0].y === line0[0].y) isReversedSrcLineIdx = false;else if (lineSX[0].x === line1[0].x && lineSX[0].y === line1[0].y) isReversedSrcLineIdx = true;
|
|
2209
2209
|
var compare0 = comparator(lineSX[0], lineDX[0]);
|
|
2210
2210
|
var compare1 = comparator(lineSX[1], lineDX[0]);
|
|
2211
2211
|
var compare2 = comparator(lineSX[1], lineDX[1]);
|
|
@@ -2550,40 +2550,20 @@ function getCalcRectFromItem2(itemInfo) {
|
|
|
2550
2550
|
var w = itemInfo.size.width / 2;
|
|
2551
2551
|
var h = itemInfo.size.height / 2;
|
|
2552
2552
|
var rotRad = itemInfo.rotRad;
|
|
2553
|
-
var
|
|
2554
|
-
var
|
|
2555
|
-
var
|
|
2556
|
-
var
|
|
2557
|
-
var m2y = y + w * Math.sin(rotRad) + mh * Math.cos(rotRad);
|
|
2553
|
+
var mx = x - w * Math.cos(rotRad);
|
|
2554
|
+
var my = y - w * Math.sin(rotRad);
|
|
2555
|
+
var m2x = x + w * Math.cos(rotRad);
|
|
2556
|
+
var m2y = y + w * Math.sin(rotRad);
|
|
2558
2557
|
var m3x = x - h * Math.sin(rotRad);
|
|
2559
2558
|
var m3y = y + h * Math.cos(rotRad);
|
|
2560
2559
|
var m1x = x + h * Math.sin(rotRad);
|
|
2561
2560
|
var m1y = y - h * Math.cos(rotRad);
|
|
2562
|
-
var x0 = mx + h * Math.sin(rotRad);
|
|
2563
|
-
var y0 = my - h * Math.cos(rotRad);
|
|
2564
|
-
var x3 = mx * 2 - x0;
|
|
2565
|
-
var y3 = my * 2 - y0;
|
|
2566
|
-
var x1 = x * 2 - x3;
|
|
2567
|
-
var y1 = y * 2 - y3;
|
|
2568
|
-
var x2 = x * 2 - x0;
|
|
2569
|
-
var y2 = y * 2 - y0;
|
|
2570
2561
|
return {
|
|
2571
2562
|
rectCenterPoint: [[point(mx, my), 180], [point(m1x, m1y), -90], [point(m2x, m2y), 0], [point(m3x, m3y), 90]]
|
|
2572
2563
|
};
|
|
2573
2564
|
}
|
|
2574
|
-
function getAllItems2(
|
|
2565
|
+
function getAllItems2(curItem, layer) {
|
|
2575
2566
|
var rectarray = [];
|
|
2576
|
-
var currentItem;
|
|
2577
|
-
var selectedItem;
|
|
2578
|
-
if (layer.selected.items.size > 0) {
|
|
2579
|
-
selectedItem = layer.getIn(['items', layer.selected.items.get(0)]);
|
|
2580
|
-
var catid = selectedItem.type;
|
|
2581
|
-
var cat = findCatalogElement(catalog, catid);
|
|
2582
|
-
currentItem = {
|
|
2583
|
-
selectedItem: selectedItem,
|
|
2584
|
-
cat: cat
|
|
2585
|
-
};
|
|
2586
|
-
}
|
|
2587
2567
|
layer.items.forEach(function (item) {
|
|
2588
2568
|
var val = {
|
|
2589
2569
|
pos: {
|
|
@@ -2592,27 +2572,21 @@ function getAllItems2(layer, catalog) {
|
|
|
2592
2572
|
},
|
|
2593
2573
|
rotRad: item.rotation / 180 * Math.PI
|
|
2594
2574
|
};
|
|
2595
|
-
var
|
|
2596
|
-
var
|
|
2597
|
-
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from('in').to('cm');
|
|
2598
|
-
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from('in').to('cm');
|
|
2599
|
-
// let width = cat.info.sizeinfo.width;
|
|
2600
|
-
// let height = cat.info.sizeinfo.depth;
|
|
2575
|
+
var width = (0, _convertUnitsLite.convert)(item.properties.getIn(['width', '_length'])).from(curItem.get('properties').get('width').get('_unit')).to('cm');
|
|
2576
|
+
var height = (0, _convertUnitsLite.convert)(item.properties.getIn(['depth', '_length'])).from(curItem.get('properties').get('depth').get('_unit')).to('cm');
|
|
2601
2577
|
val.size = {
|
|
2602
2578
|
width: width,
|
|
2603
2579
|
height: height
|
|
2604
2580
|
};
|
|
2605
|
-
var
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
if (!item.selected) {
|
|
2615
|
-
var detectObjectsAtSameAltitudeFlag = layoutpos === 'Base' ? item.properties.getIn(['altitude', '_length']) <= altitude + tempHeight.get('_length') : item.properties.getIn(['altitude', '_length']) + item.properties.getIn(['height', '_length']) >= altitude;
|
|
2581
|
+
var curItemTall = (0, _convertUnitsLite.convert)(curItem.get('properties').get('height').get('_length')).from(curItem.get('properties').get('height').get('_unit')).to('cm');
|
|
2582
|
+
var zMinCurItem = (0, _convertUnitsLite.convert)(curItem.get('properties').get('altitude').get('_length')).from(curItem.get('properties').get('altitude').get('_unit')).to('cm');
|
|
2583
|
+
var zMaxCurItem = zMinCurItem + curItemTall;
|
|
2584
|
+
if (curItem.get('id') !== item.id) {
|
|
2585
|
+
var detectObjectsAtSameAltitudeFlag = false;
|
|
2586
|
+
var itemTall = (0, _convertUnitsLite.convert)(item.properties.getIn(['height', '_length'])).from(item.get('properties').get('height').get('_unit')).to('cm');
|
|
2587
|
+
var zMinItem = (0, _convertUnitsLite.convert)(item.properties.getIn(['altitude', '_length'])).from(item.get('properties').get('altitude').get('_unit')).to('cm');
|
|
2588
|
+
var zMaxItem = zMinItem + itemTall;
|
|
2589
|
+
if (zMinItem - zMinCurItem >= 0 && zMaxCurItem - zMinItem > _constants.EPSILON || zMinCurItem - zMinItem >= 0 && zMaxItem - zMinCurItem > _constants.EPSILON) detectObjectsAtSameAltitudeFlag = true;
|
|
2616
2590
|
if (detectObjectsAtSameAltitudeFlag) {
|
|
2617
2591
|
var x = val.pos.x;
|
|
2618
2592
|
var y = val.pos.y;
|
|
@@ -2644,68 +2618,25 @@ function getAllItems2(layer, catalog) {
|
|
|
2644
2618
|
}
|
|
2645
2619
|
}
|
|
2646
2620
|
});
|
|
2647
|
-
|
|
2648
|
-
// layer.holes.forEach(hole => {
|
|
2649
|
-
// let val = {pos:{x:hole.x, y:hole.y}, rotRad:hole.rotation};
|
|
2650
|
-
// let catid = hole.type;
|
|
2651
|
-
// let cat = catalog.elements[catid];
|
|
2652
|
-
// let width = hole.properties.getIn(['width']).getIn(['length']);
|
|
2653
|
-
// let height = hole.properties.getIn(['height']).getIn(['length']);
|
|
2654
|
-
// val.size = {width, height};
|
|
2655
|
-
// let otherItem = {
|
|
2656
|
-
// hole,
|
|
2657
|
-
// cat
|
|
2658
|
-
// }
|
|
2659
|
-
|
|
2660
|
-
// // if (!GeometryUtils.needSnap(currentItem, otherItem)) {
|
|
2661
|
-
// // return;
|
|
2662
|
-
// // }
|
|
2663
|
-
|
|
2664
|
-
// if (!hole.selected) {
|
|
2665
|
-
// let x = val.pos.x;
|
|
2666
|
-
// let y = val.pos.y;
|
|
2667
|
-
// let rotRad = val.rotRad;
|
|
2668
|
-
// let w = val.size.width / 2;
|
|
2669
|
-
// let mx = x - w * Math.cos(rotRad);
|
|
2670
|
-
// let my = y - w * Math.sin(rotRad);
|
|
2671
|
-
// let kx = x + w * Math.cos(rotRad);
|
|
2672
|
-
// let ky = y + w * Math.sin(rotRad);
|
|
2673
|
-
// let x0 = mx - 10 * Math.sin(rotRad);
|
|
2674
|
-
// let y0 = my + 10 * Math.cos(rotRad);
|
|
2675
|
-
// let x3 = mx + 10 * Math.sin(rotRad);
|
|
2676
|
-
// let y3 = my - 10 * Math.cos(rotRad);
|
|
2677
|
-
// let x1 = kx - 10 * Math.sin(rotRad);
|
|
2678
|
-
// let y1 = ky + 10 * Math.cos(rotRad);
|
|
2679
|
-
// let x2 = kx + 10 * Math.sin(rotRad);
|
|
2680
|
-
// let y2 = ky - 10 * Math.cos(rotRad);
|
|
2681
|
-
// rectarray.push({'rect':[point(x0,y0), point(x1,y1) ,point(x0,y0), point(x1,y1)]});
|
|
2682
|
-
// rectarray.push({'rect':[point(x1,y1), point(x2,y2), point(x1,y1), point(x2,y2)]}); // right
|
|
2683
|
-
// rectarray.push({'rect':[point(x2,y2), point(x3,y3), point(x2,y2), point(x3,y3)]}); // front
|
|
2684
|
-
// rectarray.push({'rect':[point(x3,y3), point(x0,y0), point(x3,y3), point(x0,y0)]}); // left
|
|
2685
|
-
// }
|
|
2686
|
-
// });
|
|
2687
2621
|
return {
|
|
2688
2622
|
others: rectarray
|
|
2689
2623
|
};
|
|
2690
2624
|
}
|
|
2691
|
-
function calcDistancesFromItemToWalls(
|
|
2692
|
-
if ((0, _helper.isEmpty)(
|
|
2693
|
-
var x =
|
|
2694
|
-
var y =
|
|
2695
|
-
var rotRad =
|
|
2625
|
+
function calcDistancesFromItemToWalls(curItem, layer) {
|
|
2626
|
+
if ((0, _helper.isEmpty)(curItem)) return [];
|
|
2627
|
+
var x = curItem.get('x');
|
|
2628
|
+
var y = curItem.get('y');
|
|
2629
|
+
var rotRad = curItem.get('rotation') / 180 * Math.PI;
|
|
2696
2630
|
var width, height;
|
|
2697
|
-
if (
|
|
2698
|
-
width = (0, _convertUnitsLite.convert)(
|
|
2699
|
-
height = (0, _convertUnitsLite.convert)(
|
|
2631
|
+
if (curItem.get('properties').get('width') || curItem.get('properties').get('depth')) {
|
|
2632
|
+
width = (0, _convertUnitsLite.convert)(curItem.get('properties').get('width').get('_length')).from(curItem.get('properties').get('width').get('_unit')).to('cm');
|
|
2633
|
+
height = (0, _convertUnitsLite.convert)(curItem.get('properties').get('depth').get('_length')).from(curItem.get('properties').get('depth').get('_unit')).to('cm');
|
|
2700
2634
|
} else {
|
|
2701
|
-
width = (0, _convertUnitsLite.convert)(
|
|
2702
|
-
height = (0, _convertUnitsLite.convert)(
|
|
2635
|
+
width = (0, _convertUnitsLite.convert)(curItem.info.sizeinfo.width).from('in').to('cm');
|
|
2636
|
+
height = (0, _convertUnitsLite.convert)(curItem.info.sizeinfo.depth).from('in').to('cm');
|
|
2703
2637
|
}
|
|
2704
|
-
var
|
|
2705
|
-
var center_x = x;
|
|
2638
|
+
var center_x = x; // middle of front line of cabinet rect
|
|
2706
2639
|
var center_y = y;
|
|
2707
|
-
var center_x1 = x - center_h * Math.sin(rotRad);
|
|
2708
|
-
var center_y1 = y + center_h * Math.cos(rotRad);
|
|
2709
2640
|
var PointArray = [];
|
|
2710
2641
|
var itemInfo = {
|
|
2711
2642
|
pos: {
|
|
@@ -2719,24 +2650,37 @@ function calcDistancesFromItemToWalls(attributesFormData, layer, catalog) {
|
|
|
2719
2650
|
height: height
|
|
2720
2651
|
};
|
|
2721
2652
|
var curiteminfo = getCalcRectFromItem2(itemInfo);
|
|
2722
|
-
var allItemRect = getAllItems2(
|
|
2723
|
-
var allLines = getAllLines(layer);
|
|
2724
|
-
var allLineRects = buildRectFromLines(layer, allLines);
|
|
2725
|
-
var allRect = allLineRects.concat(allItemRect.others);
|
|
2726
|
-
|
|
2727
|
-
|
|
2653
|
+
var allItemRect = getAllItems2(curItem, layer); // get all item edge rects
|
|
2654
|
+
var allLines = getAllLines(layer); // get all wall lines
|
|
2655
|
+
var allLineRects = buildRectFromLines(layer, allLines); // make line rects from wall lines
|
|
2656
|
+
var allRect = allLineRects.concat(allItemRect.others); // item edges + wall lines
|
|
2657
|
+
var _loop = function _loop(i) {
|
|
2658
|
+
// [rectCenterPoint] has four middle points of cabinet rect edges
|
|
2659
|
+
var centerpoint = curiteminfo.rectCenterPoint[i];
|
|
2660
|
+
var comparelength = []; // distance array from rectCenterPoint[i] to other lines(walls, other cabinet rect edges)
|
|
2728
2661
|
var a;
|
|
2729
|
-
var RectLineFuction;
|
|
2730
|
-
|
|
2662
|
+
var RectLineFuction = linePassingThroughTwoPoints(centerpoint[0].x, centerpoint[0].y, center_x, center_y); // normal line of cabinet rect edge
|
|
2663
|
+
|
|
2731
2664
|
allRect.forEach(function (linerect) {
|
|
2665
|
+
// calc distance to all other lines
|
|
2732
2666
|
var p0 = clone_point(linerect.rect[2]);
|
|
2733
2667
|
var p1 = clone_point(linerect.rect[3]);
|
|
2734
|
-
var lineFunction = {};
|
|
2668
|
+
var lineFunction = {}; // other line function
|
|
2735
2669
|
if (p0.x !== p1.x || p0.y !== p1.y) lineFunction = linePassingThroughTwoPoints(p0.x, p0.y, p1.x, p1.y);
|
|
2670
|
+
// intersection between normal line and other line
|
|
2736
2671
|
var coordinatePoint = twoLinesIntersection(lineFunction.a, lineFunction.b, lineFunction.c, RectLineFuction.a, RectLineFuction.b, RectLineFuction.c);
|
|
2737
2672
|
if (coordinatePoint !== undefined) {
|
|
2738
|
-
if (
|
|
2739
|
-
|
|
2673
|
+
if (
|
|
2674
|
+
// intersection point is on the other line
|
|
2675
|
+
pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p0.x, p0.y, coordinatePoint.x, coordinatePoint.y) && pointsDistance(p0.x, p0.y, p1.x, p1.y) > pointsDistance(p1.x, p1.y, coordinatePoint.x, coordinatePoint.y)) {
|
|
2676
|
+
// check the intersection point is outside direction of edge
|
|
2677
|
+
var isOutside = true;
|
|
2678
|
+
for (var j = 0; j < curiteminfo.rectCenterPoint.length; j++) {
|
|
2679
|
+
if (j === i) continue;
|
|
2680
|
+
var otherCenterPoint = curiteminfo.rectCenterPoint[j];
|
|
2681
|
+
if (isPointOnLineSegment(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y, otherCenterPoint[0].x, otherCenterPoint[0].y)) isOutside = false;
|
|
2682
|
+
}
|
|
2683
|
+
if (isOutside && pointsDistance(coordinatePoint.x, coordinatePoint.y, center_x, center_y) > pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y)) {
|
|
2740
2684
|
comparelength.push(pointsDistance(centerpoint[0].x, centerpoint[0].y, coordinatePoint.x, coordinatePoint.y));
|
|
2741
2685
|
a = Math.min.apply(null, comparelength);
|
|
2742
2686
|
}
|
|
@@ -2744,7 +2688,21 @@ function calcDistancesFromItemToWalls(attributesFormData, layer, catalog) {
|
|
|
2744
2688
|
}
|
|
2745
2689
|
});
|
|
2746
2690
|
PointArray.push([a, centerpoint[1]]);
|
|
2691
|
+
};
|
|
2692
|
+
for (var i = 0; i < curiteminfo.rectCenterPoint.length; i++) {
|
|
2693
|
+
_loop(i);
|
|
2694
|
+
}
|
|
2695
|
+
PointArray.forEach(function (pointElement, index) {
|
|
2696
|
+
if (pointElement[0] == undefined) PointArray[index][0] = 0;
|
|
2747
2697
|
});
|
|
2698
|
+
var cnt = 0;
|
|
2699
|
+
PointArray.forEach(function (pointElement) {
|
|
2700
|
+
if (pointElement[0] == 0) cnt++;
|
|
2701
|
+
});
|
|
2702
|
+
if (cnt == 4 || cnt == 3) {
|
|
2703
|
+
PointArray[0][0] = 100;
|
|
2704
|
+
PointArray[1][0] = 100;
|
|
2705
|
+
}
|
|
2748
2706
|
return {
|
|
2749
2707
|
PointArray: PointArray
|
|
2750
2708
|
};
|
package/lib/utils/helper.js
CHANGED
|
@@ -22,7 +22,9 @@ exports.refineProductForSummaryPdf = exports.refineMoldingForSummaryPdf = void 0
|
|
|
22
22
|
exports.replaceMeshesWithLineSegments = replaceMeshesWithLineSegments;
|
|
23
23
|
exports.textureCube = void 0;
|
|
24
24
|
exports.toPlainObject = toPlainObject;
|
|
25
|
-
exports.
|
|
25
|
+
exports.translateDrawer = void 0;
|
|
26
|
+
exports.updatePayloadOfInternalEvent = updatePayloadOfInternalEvent;
|
|
27
|
+
exports.updateViwer2D = void 0;
|
|
26
28
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
27
29
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
28
30
|
var _HDRCubeTextureLoader = require("three/examples/jsm/loaders/HDRCubeTextureLoader.js");
|
|
@@ -32,6 +34,7 @@ var _utils = require("./../components/viewer2d/utils");
|
|
|
32
34
|
var _convertUnitsLite = require("./convert-units-lite");
|
|
33
35
|
var _math = require("./math");
|
|
34
36
|
var _awsSdk = _interopRequireDefault(require("aws-sdk"));
|
|
37
|
+
var _export = require("./export");
|
|
35
38
|
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" != _typeof3(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); }
|
|
36
39
|
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; }
|
|
37
40
|
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; }
|
|
@@ -422,4 +425,40 @@ function centering2D(state) {
|
|
|
422
425
|
});
|
|
423
426
|
if (viewer2DActions) updateViwer2D(viewer, viewer2DActions);
|
|
424
427
|
return state;
|
|
428
|
+
}
|
|
429
|
+
function updatePayloadOfInternalEvent(currentObject, layer, catalog) {
|
|
430
|
+
var pointArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
431
|
+
if (isEmpty(currentObject)) return null;
|
|
432
|
+
var updatedPayload = currentObject.toJS();
|
|
433
|
+
if (isEmpty(layer) || isEmpty(catalog)) return updatedPayload;
|
|
434
|
+
if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'lines') {
|
|
435
|
+
// caculating length of selected line//
|
|
436
|
+
var v_a = layer.vertices.get(currentObject.vertices.get(0));
|
|
437
|
+
var v_b = layer.vertices.get(currentObject.vertices.get(1));
|
|
438
|
+
var distance = _export.GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
439
|
+
var _length = (0, _convertUnitsLite.convert)(distance).from('cm').to(layer.unit);
|
|
440
|
+
updatedPayload.length = _length;
|
|
441
|
+
//////////////////////////////////////
|
|
442
|
+
} else if ((currentObject === null || currentObject === void 0 ? void 0 : currentObject.prototype) === 'items') {
|
|
443
|
+
var _catalog$elements$cur;
|
|
444
|
+
// check this cabinet has warning box
|
|
445
|
+
updatedPayload.isWarning = (0, _utils.isWarningItem)(currentObject);
|
|
446
|
+
// check this item is available molding
|
|
447
|
+
updatedPayload.isMoldingAvailable = _export.MoldingUtils.isEnableItemForMolding(layer, currentObject);
|
|
448
|
+
// check this item is snapped to wall
|
|
449
|
+
updatedPayload.isAttachedWall = _export.MoldingUtils.isAttachedWall(layer, currentObject);
|
|
450
|
+
// update distArray
|
|
451
|
+
if (pointArray) updatedPayload.distArray = pointArray;
|
|
452
|
+
|
|
453
|
+
// update sku_number using sku_array
|
|
454
|
+
var currentDoorColorId = currentObject.getIn(['doorStyle', 'id']);
|
|
455
|
+
var skuArray = catalog === null || catalog === void 0 || (_catalog$elements$cur = catalog.elements[currentObject.get('name')]) === null || _catalog$elements$cur === void 0 || (_catalog$elements$cur = _catalog$elements$cur.obj) === null || _catalog$elements$cur === void 0 ? void 0 : _catalog$elements$cur.skuArray;
|
|
456
|
+
var correctSKU = skuArray === null || skuArray === void 0 ? void 0 : skuArray.find(function (sku) {
|
|
457
|
+
return sku.door_color_id === currentDoorColorId;
|
|
458
|
+
});
|
|
459
|
+
if (correctSKU) {
|
|
460
|
+
updatedPayload.sku_number = correctSKU.sku;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return updatedPayload;
|
|
425
464
|
}
|