kitchen-simulator 1.1.1-test.72 → 1.1.1-test.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/@history.js +2 -5
- package/es/AppContext.js +3 -6
- package/es/KitchenConfigurator.js +86 -86
- package/es/KitchenConfiguratorApp.js +134 -128
- package/es/actions/area-actions.js +5 -8
- package/es/actions/export.js +12 -24
- package/es/actions/groups-actions.js +27 -41
- package/es/actions/holes-actions.js +34 -51
- package/es/actions/items-actions.js +94 -141
- package/es/actions/lines-actions.js +21 -32
- package/es/actions/project-actions.js +94 -141
- package/es/actions/scene-actions.js +11 -17
- package/es/actions/vertices-actions.js +7 -11
- package/es/actions/viewer2d-actions.js +21 -32
- package/es/actions/viewer3d-actions.js +9 -14
- package/es/catalog/areas/area/planner-element.js +2 -5
- package/es/catalog/catalog.js +15 -17
- package/es/catalog/factories/area-factory-3d.js +22 -26
- package/es/catalog/factories/area-factory.js +13 -15
- package/es/catalog/factories/export.js +6 -10
- package/es/catalog/factories/wall-factory-3d.js +31 -36
- package/es/catalog/factories/wall-factory.js +21 -26
- package/es/catalog/holes/door-closet/planner-element.js +15 -19
- package/es/catalog/holes/door-double/planner-element.js +15 -19
- package/es/catalog/holes/door-exterior/planner-element.js +16 -20
- package/es/catalog/holes/door-interior/planner-element.js +16 -20
- package/es/catalog/holes/door-panic/planner-element.js +7 -11
- package/es/catalog/holes/door-panic-double/planner-element.js +15 -19
- package/es/catalog/holes/door-sliding/planner-element.js +17 -21
- package/es/catalog/holes/doorway-framed/planner-element.js +11 -15
- package/es/catalog/holes/doorway-frameless/planner-element.js +7 -11
- package/es/catalog/holes/export.js +13 -29
- package/es/catalog/holes/window-clear/planner-element.js +10 -14
- package/es/catalog/holes/window-cross/planner-element.js +10 -14
- package/es/catalog/holes/window-double-hung/planner-element.js +10 -14
- package/es/catalog/holes/window-vertical/planner-element.js +10 -14
- package/es/catalog/lines/wall/planner-element.js +2 -5
- package/es/catalog/molding/molding-dcm/planner-element.js +5 -9
- package/es/catalog/molding/molding-fbm/planner-element.js +5 -9
- package/es/catalog/molding/molding-lrm/planner-element.js +5 -9
- package/es/catalog/properties/export.js +20 -31
- package/es/catalog/properties/property-checkbox.js +28 -29
- package/es/catalog/properties/property-color.js +16 -19
- package/es/catalog/properties/property-enum.js +24 -27
- package/es/catalog/properties/property-hidden.js +9 -12
- package/es/catalog/properties/property-lenght-measure.js +38 -41
- package/es/catalog/properties/property-length-measure.js +36 -39
- package/es/catalog/properties/property-length-measure_hole.js +38 -41
- package/es/catalog/properties/property-number.js +17 -20
- package/es/catalog/properties/property-read-only.js +16 -19
- package/es/catalog/properties/property-string.js +16 -19
- package/es/catalog/properties/property-toggle.js +16 -19
- package/es/catalog/properties/shared-property-style.js +1 -3
- package/es/catalog/utils/FuseUtils.js +12 -13
- package/es/catalog/utils/exporter.js +10 -11
- package/es/catalog/utils/geom-utils.js +13 -24
- package/es/catalog/utils/item-loader.js +86 -92
- package/es/catalog/utils/load-obj.js +20 -24
- package/es/catalog/utils/mtl-loader.js +3 -4
- package/es/catalog/utils/obj-loader.js +3 -4
- package/es/class/FuseUtils.js +12 -13
- package/es/class/area.js +24 -24
- package/es/class/export.js +23 -36
- package/es/class/group.js +53 -55
- package/es/class/guide.js +15 -17
- package/es/class/hole.js +83 -85
- package/es/class/item.js +155 -155
- package/es/class/layer.js +59 -61
- package/es/class/line.js +135 -138
- package/es/class/project.js +93 -94
- package/es/class/vertex.js +29 -31
- package/es/components/content.js +19 -23
- package/es/components/disclaimer/disclaimer.js +10 -13
- package/es/components/export.js +8 -13
- package/es/components/style/button.js +25 -25
- package/es/components/style/cancel-button.js +7 -10
- package/es/components/style/content-container.js +11 -12
- package/es/components/style/content-title.js +13 -15
- package/es/components/style/delete-button.js +8 -12
- package/es/components/style/export.js +30 -46
- package/es/components/style/form-block.js +10 -11
- package/es/components/style/form-color-input.js +7 -10
- package/es/components/style/form-label.js +10 -11
- package/es/components/style/form-number-input.js +45 -43
- package/es/components/style/form-number-input_2.js +41 -39
- package/es/components/style/form-select.js +19 -20
- package/es/components/style/form-slider.js +10 -13
- package/es/components/style/form-submit-button.js +8 -12
- package/es/components/style/form-text-input.js +30 -28
- package/es/components/viewer2d/area.js +17 -20
- package/es/components/viewer2d/export.js +30 -46
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +10 -13
- package/es/components/viewer2d/grids/grid-streak.js +10 -13
- package/es/components/viewer2d/grids/grid-vertical-streak.js +10 -13
- package/es/components/viewer2d/grids/grids.js +10 -14
- package/es/components/viewer2d/group.js +15 -19
- package/es/components/viewer2d/item.js +61 -65
- package/es/components/viewer2d/layer.js +23 -26
- package/es/components/viewer2d/line.js +101 -106
- package/es/components/viewer2d/ruler.js +22 -25
- package/es/components/viewer2d/rulerDist.js +21 -24
- package/es/components/viewer2d/rulerX.js +46 -44
- package/es/components/viewer2d/rulerY.js +44 -42
- package/es/components/viewer2d/scene.js +34 -34
- package/es/components/viewer2d/snap.js +13 -17
- package/es/components/viewer2d/state.js +18 -22
- package/es/components/viewer2d/utils.js +24 -33
- package/es/components/viewer2d/vertex.js +8 -12
- package/es/components/viewer2d/viewer2d.js +156 -159
- package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +21 -19
- package/es/components/viewer3d/dcm.js +1 -3
- package/es/components/viewer3d/fbm.js +1 -3
- package/es/components/viewer3d/front3D.js +12 -16
- package/es/components/viewer3d/grid-creator.js +8 -12
- package/es/components/viewer3d/grids/grid-horizontal-streak.js +6 -9
- package/es/components/viewer3d/grids/grid-streak.js +5 -8
- package/es/components/viewer3d/grids/grid-vertical-streak.js +6 -9
- package/es/components/viewer3d/libs/first-person-controls.js +2 -5
- package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +1 -3
- package/es/components/viewer3d/libs/mtl-loader.js +1 -3
- package/es/components/viewer3d/libs/obj-loader.js +1 -3
- package/es/components/viewer3d/libs/orbit-controls.js +2 -4
- package/es/components/viewer3d/libs/pointer-lock-controls.js +2 -4
- package/es/components/viewer3d/lrm.js +1 -3
- package/es/components/viewer3d/model.js +1 -3
- package/es/components/viewer3d/pointer-lock-navigation.js +3 -6
- package/es/components/viewer3d/ruler-utils/itemRect.js +18 -21
- package/es/components/viewer3d/ruler-utils/layer3D.js +59 -62
- package/es/components/viewer3d/ruler-utils/ruler3D.js +42 -43
- package/es/components/viewer3d/ruler-utils/scene3D.js +9 -13
- package/es/components/viewer3d/ruler-utils/state3D.js +4 -7
- package/es/components/viewer3d/scene-creator.js +197 -223
- package/es/components/viewer3d/three-memory-cleaner.js +3 -7
- package/es/components/viewer3d/viewer3d-first-person.js +42 -42
- package/es/components/viewer3d/viewer3d.js +200 -198
- package/es/constants.js +349 -354
- package/es/index.js +7 -11
- package/es/models.js +193 -191
- package/es/plugins/SVGLoader.js +48 -49
- package/es/plugins/autosave.js +3 -5
- package/es/plugins/console-debugger.js +6 -7
- package/es/plugins/export.js +8 -13
- package/es/plugins/keyboard.js +29 -31
- package/es/reducers/areas-reducer.js +7 -9
- package/es/reducers/export.js +24 -37
- package/es/reducers/groups-reducer.js +31 -33
- package/es/reducers/holes-reducer.js +43 -45
- package/es/reducers/items-reducer.js +106 -108
- package/es/reducers/lines-reducer.js +28 -30
- package/es/reducers/project-reducer.js +105 -107
- package/es/reducers/reducer.js +16 -19
- package/es/reducers/scene-reducer.js +15 -17
- package/es/reducers/user-reducer.js +5 -7
- package/es/reducers/vertices-reducer.js +11 -13
- package/es/reducers/viewer2d-reducer.js +18 -20
- package/es/reducers/viewer3d-reducer.js +16 -18
- package/es/shared-style.js +10 -12
- package/es/styles/export.js +3 -6
- package/es/translator/en.js +1 -3
- package/es/translator/it.js +1 -3
- package/es/translator/ru.js +1 -3
- package/es/translator/translator.js +13 -15
- package/es/utils/browser.js +2 -5
- package/es/utils/convert-units-lite.js +1 -3
- package/es/utils/email-validator.js +1 -3
- package/es/utils/export.js +15 -29
- package/es/utils/geometry.js +190 -280
- package/es/utils/get-edges-of-subgraphs.js +2 -5
- package/es/utils/graph-cycles.js +8 -7
- package/es/utils/graph-inner-cycles.js +10 -14
- package/es/utils/graph.js +9 -13
- package/es/utils/helper.js +41 -58
- package/es/utils/history.js +8 -11
- package/es/utils/id-broker.js +8 -11
- package/es/utils/logger.js +1 -3
- package/es/utils/math.js +5 -8
- package/es/utils/molding.js +130 -146
- package/es/utils/name-generator.js +7 -9
- package/es/utils/objects-utils.js +7 -14
- package/es/utils/phone-validator.js +1 -3
- package/es/utils/process-black-list.js +5 -6
- package/es/utils/react-if.js +7 -9
- package/es/utils/snap-scene.js +27 -30
- package/es/utils/snap.js +53 -57
- package/es/utils/summarizeCart.js +1 -3
- package/es/utils/threeCSG.es6.js +13 -17
- package/es/version.js +1 -3
- package/package.json +1 -1
package/es/class/item.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _utils = require("../components/viewer2d/utils");
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
import { convert } from "../utils/convert-units-lite";
|
|
8
|
+
import { Group, Hole, Layer } from "./export";
|
|
9
|
+
import { GeometryUtils, IDBroker, MoldingUtils, NameGenerator } from "../utils/export";
|
|
10
|
+
import { fromJS, Map } from 'immutable';
|
|
11
|
+
import { INSTALLATION_SUFFIX_TYPE, MODE_DRAGGING_ITEM, MODE_DRAGGING_ITEM_3D, MODE_DRAWING_ITEM, MODE_DRAWING_ITEM_3D, MODE_IDLE, MODE_IDLE_3D, MODE_ROTATING_ITEM, MODE_ROTATING_ITEM_3D, MOLDING_LOCATIONS } from "../constants";
|
|
12
|
+
import { debugUtil } from "../utils/helper";
|
|
13
|
+
import { hasMoldingLayout } from "../utils/molding";
|
|
14
|
+
import { getInstallationSuffix } from "../components/viewer2d/utils";
|
|
16
15
|
var allItemRect;
|
|
17
16
|
var allItemSnap;
|
|
18
17
|
var allLines;
|
|
@@ -21,19 +20,19 @@ var allLineSnap;
|
|
|
21
20
|
var allRect;
|
|
22
21
|
var time1;
|
|
23
22
|
var time2;
|
|
24
|
-
var Item =
|
|
23
|
+
var Item = /*#__PURE__*/function () {
|
|
25
24
|
function Item() {
|
|
26
|
-
(
|
|
25
|
+
_classCallCheck(this, Item);
|
|
27
26
|
}
|
|
28
|
-
return (
|
|
27
|
+
return _createClass(Item, null, [{
|
|
29
28
|
key: "create",
|
|
30
29
|
value: function create(state, layerID, type, x, y, width, height, rotation, isDuplication) {
|
|
31
30
|
var molding = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : [];
|
|
32
|
-
var itemID =
|
|
31
|
+
var itemID = IDBroker.acquireID();
|
|
33
32
|
var item = state.catalog.factoryElement(type, {
|
|
34
33
|
id: itemID,
|
|
35
34
|
itemID: state.catalog.getIn(['elements', type, 'itemID']),
|
|
36
|
-
name:
|
|
35
|
+
name: NameGenerator.generateName('items', state.catalog.getIn(['elements', type, 'info', 'title'])),
|
|
37
36
|
sku_number: state.catalog.getIn(['elements', type, 'obj']).toJS().sku_number,
|
|
38
37
|
//style: state.catalog.getIn(['elements', type, 'info', 'door']),
|
|
39
38
|
category: state.catalog.getIn(['elements', type, 'type']),
|
|
@@ -56,11 +55,11 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
56
55
|
return elem.itemID === state.catalog.getIn(['elements', type, 'itemID']);
|
|
57
56
|
});
|
|
58
57
|
if (cds) {
|
|
59
|
-
var updatedDoorStyles = (
|
|
58
|
+
var updatedDoorStyles = _objectSpread(_objectSpread(_objectSpread({}, temp.doorStyles), cds.data && cds.data[0] ? cds.data[0] : {}), {}, {
|
|
60
59
|
cabinet_door_style_id: cds.cabinet_door_style_id
|
|
61
60
|
});
|
|
62
61
|
item = item.merge({
|
|
63
|
-
doorStyle:
|
|
62
|
+
doorStyle: fromJS(_objectSpread(_objectSpread({}, temp), {}, {
|
|
64
63
|
doorStyles: updatedDoorStyles
|
|
65
64
|
}))
|
|
66
65
|
});
|
|
@@ -74,11 +73,11 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
74
73
|
});
|
|
75
74
|
if (cds) {
|
|
76
75
|
var tmpDS = styleObj[_x].data;
|
|
77
|
-
tmpDS.doorStyles = (
|
|
76
|
+
tmpDS.doorStyles = _objectSpread(_objectSpread(_objectSpread({}, tmpDS.doorStyles), cds.data && cds.data[0] ? cds.data[0] : {}), {}, {
|
|
78
77
|
cabinet_door_style_id: cds.cabinet_door_style_id
|
|
79
78
|
});
|
|
80
79
|
item = item.merge({
|
|
81
|
-
doorStyle:
|
|
80
|
+
doorStyle: fromJS(tmpDS)
|
|
82
81
|
});
|
|
83
82
|
break;
|
|
84
83
|
}
|
|
@@ -97,11 +96,11 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
97
96
|
if (_cds) {
|
|
98
97
|
var _styleObj$_x2;
|
|
99
98
|
var _tmpDS = (_styleObj$_x2 = _styleObj[_x2]) === null || _styleObj$_x2 === void 0 ? void 0 : _styleObj$_x2.data;
|
|
100
|
-
_tmpDS.doorStyles = (
|
|
99
|
+
_tmpDS.doorStyles = _objectSpread(_objectSpread(_objectSpread({}, _tmpDS.doorStyles), _cds.data && _cds.data[0] ? _cds.data[0] : {}), {}, {
|
|
101
100
|
cabinet_door_style_id: _cds.cabinet_door_style_id
|
|
102
101
|
});
|
|
103
102
|
item = item.merge({
|
|
104
|
-
doorStyle:
|
|
103
|
+
doorStyle: fromJS(_tmpDS)
|
|
105
104
|
});
|
|
106
105
|
break;
|
|
107
106
|
}
|
|
@@ -128,74 +127,74 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
128
127
|
var newProperties = item.get('properties').toJS();
|
|
129
128
|
if (newProperties.hasOwnProperty('depth')) {
|
|
130
129
|
if (!newProperties.hasOwnProperty('oldDepth')) {
|
|
131
|
-
newProperties['oldDepth'] = new
|
|
130
|
+
newProperties['oldDepth'] = new Map({
|
|
132
131
|
length: newProperties.depth.length,
|
|
133
132
|
_length: newProperties.depth._length,
|
|
134
133
|
_unit: newProperties.depth._unit
|
|
135
134
|
});
|
|
136
135
|
}
|
|
137
|
-
newProperties['depth'] = new
|
|
138
|
-
length:
|
|
136
|
+
newProperties['depth'] = new Map({
|
|
137
|
+
length: convert(euro_cds[0].euro_length).from('in').to('cm'),
|
|
139
138
|
_length: euro_cds[0].euro_length,
|
|
140
139
|
_unit: 'in'
|
|
141
140
|
});
|
|
142
141
|
}
|
|
143
142
|
if (newProperties.hasOwnProperty('height')) {
|
|
144
143
|
if (!newProperties.hasOwnProperty('oldHeight')) {
|
|
145
|
-
newProperties['oldHeight'] = new
|
|
144
|
+
newProperties['oldHeight'] = new Map({
|
|
146
145
|
length: newProperties.height.length,
|
|
147
146
|
_length: newProperties.height._length,
|
|
148
147
|
_unit: newProperties.height._unit
|
|
149
148
|
});
|
|
150
149
|
}
|
|
151
|
-
newProperties['height'] = new
|
|
152
|
-
length:
|
|
150
|
+
newProperties['height'] = new Map({
|
|
151
|
+
length: convert(euro_cds[0].euro_height).from('in').to('cm'),
|
|
153
152
|
_length: euro_cds[0].euro_height,
|
|
154
153
|
_unit: 'in'
|
|
155
154
|
});
|
|
156
155
|
}
|
|
157
156
|
if (newProperties.hasOwnProperty('width')) {
|
|
158
157
|
if (!newProperties.hasOwnProperty('oldWidth')) {
|
|
159
|
-
newProperties['oldWidth'] = new
|
|
158
|
+
newProperties['oldWidth'] = new Map({
|
|
160
159
|
length: newProperties.width.length,
|
|
161
160
|
_length: newProperties.width._length,
|
|
162
161
|
_unit: newProperties.width._unit
|
|
163
162
|
});
|
|
164
163
|
}
|
|
165
|
-
newProperties['width'] = new
|
|
166
|
-
length:
|
|
164
|
+
newProperties['width'] = new Map({
|
|
165
|
+
length: convert(euro_cds[0].euro_width).from('in').to('cm') - 10,
|
|
167
166
|
_length: euro_cds[0].euro_width,
|
|
168
167
|
_unit: 'in'
|
|
169
168
|
});
|
|
170
169
|
}
|
|
171
170
|
item = item.merge({
|
|
172
|
-
properties:
|
|
171
|
+
properties: fromJS(newProperties)
|
|
173
172
|
});
|
|
174
173
|
} else {
|
|
175
174
|
var properties = item.get('properties').toJS();
|
|
176
175
|
if (properties.hasOwnProperty('oldDepth')) {
|
|
177
|
-
properties['depth'] = new
|
|
176
|
+
properties['depth'] = new Map({
|
|
178
177
|
length: properties.oldDepth.length,
|
|
179
178
|
_length: properties.oldDepth._length,
|
|
180
179
|
_unit: properties.oldDepth._unit
|
|
181
180
|
});
|
|
182
181
|
}
|
|
183
182
|
if (properties.hasOwnProperty('oldHeight')) {
|
|
184
|
-
properties['height'] = new
|
|
183
|
+
properties['height'] = new Map({
|
|
185
184
|
length: properties.oldHeight.length,
|
|
186
185
|
_length: properties.oldHeight._length,
|
|
187
186
|
_unit: properties.oldHeight._unit
|
|
188
187
|
});
|
|
189
188
|
}
|
|
190
189
|
if (properties.hasOwnProperty('oldWidth')) {
|
|
191
|
-
properties['width'] = new
|
|
190
|
+
properties['width'] = new Map({
|
|
192
191
|
length: properties.oldWidth.length,
|
|
193
192
|
_length: properties.oldWidth._length,
|
|
194
193
|
_unit: properties.oldWidth._unit
|
|
195
194
|
});
|
|
196
195
|
}
|
|
197
196
|
item = item.merge({
|
|
198
|
-
properties:
|
|
197
|
+
properties: fromJS(properties)
|
|
199
198
|
});
|
|
200
199
|
}
|
|
201
200
|
};
|
|
@@ -205,16 +204,16 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
205
204
|
if (item.type.includes('Light')) {
|
|
206
205
|
var ceilHeight = state.getIn(['scene', 'layers', layerID, 'ceilHeight']);
|
|
207
206
|
var ceilUnit = state.getIn(['scene', 'layers', layerID, 'unit']);
|
|
208
|
-
ceilHeight =
|
|
207
|
+
ceilHeight = convert(ceilHeight).from(ceilUnit).to('cm');
|
|
209
208
|
var newAltitude = ceilHeight - item.properties.getIn(['height', 'length']);
|
|
210
|
-
newAltitude =
|
|
209
|
+
newAltitude = convert(newAltitude).from('cm').to(ceilUnit);
|
|
211
210
|
item = item.setIn(['properties', 'altitude', '_length'], newAltitude);
|
|
212
211
|
state = state.setIn(['scene', 'layers', layerID, 'items', item.id], item);
|
|
213
212
|
}
|
|
214
213
|
if (item.category === 'cabinet') {
|
|
215
214
|
// If create a copied object, copied object has original object's molding property.And if create a object, it has a layer's molding property.
|
|
216
215
|
var layerMolding = state.getIn(['scene', 'layers', layerID, 'molding']).filter(function (md) {
|
|
217
|
-
return
|
|
216
|
+
return hasMoldingLayout(md, item.layoutpos);
|
|
218
217
|
});
|
|
219
218
|
state = state.setIn(['scene', 'layers', layerID, 'items', itemID, 'molding'], layerMolding.length ? layerMolding : molding);
|
|
220
219
|
}
|
|
@@ -231,7 +230,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
231
230
|
var dataJSON = item.toJS();
|
|
232
231
|
var itemID = dataJSON.id;
|
|
233
232
|
var doorStyle = dataJSON.doorStyle;
|
|
234
|
-
var tmpDS = (
|
|
233
|
+
var tmpDS = _objectSpread(_objectSpread({}, doorStyle), {}, {
|
|
235
234
|
handle_gltf: doorHandle,
|
|
236
235
|
metalness: 0.2,
|
|
237
236
|
roughness: 0.1
|
|
@@ -245,16 +244,16 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
245
244
|
tmpDS['doorStyles']['drawer_door_handle_' + i + '_gltf'] = doorHandle;
|
|
246
245
|
}
|
|
247
246
|
}
|
|
248
|
-
item = item.mergeIn(['doorStyle'],
|
|
247
|
+
item = item.mergeIn(['doorStyle'], fromJS(tmpDS));
|
|
249
248
|
return item;
|
|
250
249
|
}
|
|
251
250
|
}, {
|
|
252
251
|
key: "select",
|
|
253
252
|
value: function select(state, layerID, itemID) {
|
|
254
|
-
state =
|
|
255
|
-
state =
|
|
253
|
+
state = Layer.select(state, layerID).updatedState;
|
|
254
|
+
state = Layer.selectElement(state, layerID, 'items', itemID).updatedState;
|
|
256
255
|
state = state.merge({
|
|
257
|
-
replacingSupport: new
|
|
256
|
+
replacingSupport: new Map({
|
|
258
257
|
layerID: layerID,
|
|
259
258
|
itemID: itemID
|
|
260
259
|
})
|
|
@@ -266,8 +265,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
266
265
|
}, {
|
|
267
266
|
key: "selectHole",
|
|
268
267
|
value: function selectHole(state, layerID, holeID) {
|
|
269
|
-
state =
|
|
270
|
-
state =
|
|
268
|
+
state = Layer.select(state, layerID).updatedState;
|
|
269
|
+
state = Layer.selectElement(state, layerID, 'holes', holeID).updatedState;
|
|
271
270
|
return {
|
|
272
271
|
updatedState: state
|
|
273
272
|
};
|
|
@@ -283,10 +282,10 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
283
282
|
updatedState: state
|
|
284
283
|
};
|
|
285
284
|
}
|
|
286
|
-
var width = new
|
|
285
|
+
var width = new Map({
|
|
287
286
|
_length: newWidth,
|
|
288
287
|
_unit: 'in',
|
|
289
|
-
length:
|
|
288
|
+
length: convert(newWidth).from('in').to('cm')
|
|
290
289
|
});
|
|
291
290
|
properties = properties.set('width', width);
|
|
292
291
|
state = state.mergeIn(['scene', 'layers', layerID, 'items', itemID, 'properties'], properties);
|
|
@@ -300,14 +299,14 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
300
299
|
var layer = state.getIn(['scene', 'layers', layerID]);
|
|
301
300
|
var scene = state.get('scene');
|
|
302
301
|
var catalog = state.catalog.toJS();
|
|
303
|
-
allLines =
|
|
304
|
-
allLineRects =
|
|
305
|
-
allItemRect =
|
|
306
|
-
allItemSnap =
|
|
307
|
-
allLineSnap =
|
|
302
|
+
allLines = GeometryUtils.getAllLines(layer);
|
|
303
|
+
allLineRects = GeometryUtils.buildRectFromLines(layer, allLines);
|
|
304
|
+
allItemRect = GeometryUtils.getAllItems(scene, catalog, allLineRects);
|
|
305
|
+
allItemSnap = GeometryUtils.getAllItemSnap(allItemRect);
|
|
306
|
+
allLineSnap = GeometryUtils.getAllLineSnap(allLineRects, allItemRect.cur);
|
|
308
307
|
allRect = allItemRect.others.concat(allLineRects);
|
|
309
|
-
allItemSnap =
|
|
310
|
-
allLineSnap =
|
|
308
|
+
allItemSnap = GeometryUtils.validateSnaps(allItemSnap, allRect);
|
|
309
|
+
allLineSnap = GeometryUtils.validateSnaps(allLineSnap, allRect);
|
|
311
310
|
}
|
|
312
311
|
}, {
|
|
313
312
|
key: "duplicateSelected",
|
|
@@ -337,7 +336,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
337
336
|
val.size = allItemRect.cur.size;
|
|
338
337
|
val.layoutpos = allItemRect.cur.layoutpos;
|
|
339
338
|
val.is_corner = allItemRect.cur.is_corner;
|
|
340
|
-
var isrectSect =
|
|
339
|
+
var isrectSect = GeometryUtils.validInterSect(allRect, val);
|
|
341
340
|
if (isrectSect) {
|
|
342
341
|
// Duplicated object has a original object's molding property
|
|
343
342
|
var _this$create = this.create(state, layerID, sceneComponentType, x + width * Math.cos(rotRad), y + width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
@@ -346,8 +345,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
346
345
|
if (item === null) {
|
|
347
346
|
alert('There are no Door Colors in this cabinet.');
|
|
348
347
|
state = state.merge({
|
|
349
|
-
mode:
|
|
350
|
-
drawingSupport: new
|
|
348
|
+
mode: MODE_IDLE,
|
|
349
|
+
drawingSupport: new Map()
|
|
351
350
|
});
|
|
352
351
|
} else {
|
|
353
352
|
state = Item.select(stateI, layerID, item.id).updatedState;
|
|
@@ -364,7 +363,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
364
363
|
_val.size = allItemRect.cur.size;
|
|
365
364
|
_val.layoutpos = allItemRect.cur.layoutpos;
|
|
366
365
|
_val.is_corner = allItemRect.cur.is_corner;
|
|
367
|
-
var isRect =
|
|
366
|
+
var isRect = GeometryUtils.validInterSect(allRect, _val);
|
|
368
367
|
if (isRect) {
|
|
369
368
|
var _this$create2 = this.create(state, layerID, sceneComponentType, x - width * Math.cos(rotRad), y - width * Math.sin(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
370
369
|
_stateI = _this$create2.updatedState,
|
|
@@ -372,8 +371,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
372
371
|
if (_item === null) {
|
|
373
372
|
alert('There are no Door Colors in this cabinet.');
|
|
374
373
|
state = state.merge({
|
|
375
|
-
mode:
|
|
376
|
-
drawingSupport: new
|
|
374
|
+
mode: MODE_IDLE,
|
|
375
|
+
drawingSupport: new Map()
|
|
377
376
|
});
|
|
378
377
|
} else {
|
|
379
378
|
state = Item.select(_stateI, layerID, _item.id).updatedState;
|
|
@@ -390,7 +389,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
390
389
|
_val2.size = allItemRect.cur.size;
|
|
391
390
|
_val2.layoutpos = allItemRect.cur.layoutpos;
|
|
392
391
|
_val2.is_corner = allItemRect.cur.is_corner;
|
|
393
|
-
var isRectDown =
|
|
392
|
+
var isRectDown = GeometryUtils.validInterSect(allRect, _val2);
|
|
394
393
|
if (isRectDown) {
|
|
395
394
|
var _this$create3 = this.create(state, layerID, sceneComponentType, x - depth * Math.sin(rotRad), y - depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
396
395
|
_stateI2 = _this$create3.updatedState,
|
|
@@ -398,8 +397,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
398
397
|
if (_item2 === null) {
|
|
399
398
|
alert('There are no Door Colors in this cabinet.');
|
|
400
399
|
state = state.merge({
|
|
401
|
-
mode:
|
|
402
|
-
drawingSupport: new
|
|
400
|
+
mode: MODE_IDLE,
|
|
401
|
+
drawingSupport: new Map()
|
|
403
402
|
});
|
|
404
403
|
} else {
|
|
405
404
|
state = Item.select(_stateI2, layerID, _item2.id).updatedState;
|
|
@@ -416,7 +415,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
416
415
|
_val3.size = allItemRect.cur.size;
|
|
417
416
|
_val3.layoutpos = allItemRect.cur.layoutpos;
|
|
418
417
|
_val3.is_corner = allItemRect.cur.is_corner;
|
|
419
|
-
var isRectUp =
|
|
418
|
+
var isRectUp = GeometryUtils.validInterSect(allRect, _val3);
|
|
420
419
|
if (isRectUp) {
|
|
421
420
|
var _this$create4 = this.create(state, layerID, sceneComponentType, x + depth * Math.sin(rotRad), y + depth * Math.cos(rotRad), 200, 100, rotRad * 180 / Math.PI, true, myObject.molding),
|
|
422
421
|
_stateI3 = _this$create4.updatedState,
|
|
@@ -424,8 +423,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
424
423
|
if (_item3 === null) {
|
|
425
424
|
alert('There are no Door Colors in this cabinet.');
|
|
426
425
|
state = state.merge({
|
|
427
|
-
mode:
|
|
428
|
-
drawingSupport: new
|
|
426
|
+
mode: MODE_IDLE,
|
|
427
|
+
drawingSupport: new Map()
|
|
429
428
|
});
|
|
430
429
|
} else {
|
|
431
430
|
state = Item.select(_stateI3, layerID, _item3.id).updatedState;
|
|
@@ -448,7 +447,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
448
447
|
var myOffset = myObject.offset;
|
|
449
448
|
var v0 = layer.getIn(['vertices', line.vertices.get(0)]);
|
|
450
449
|
var v1 = layer.getIn(['vertices', line.vertices.get(1)]);
|
|
451
|
-
var lineLength =
|
|
450
|
+
var lineLength = GeometryUtils.pointsDistance(v0.x, v0.y, v1.x, v1.y);
|
|
452
451
|
var delta = width / 2 / lineLength + 0.00001;
|
|
453
452
|
var allHoles = state.getIn(['scene', 'layers', layerID, 'holes']);
|
|
454
453
|
var rightAble = true;
|
|
@@ -543,9 +542,9 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
543
542
|
key: "remove",
|
|
544
543
|
value: function remove(state, layerID, itemID) {
|
|
545
544
|
state = this.unselect(state, layerID, itemID).updatedState;
|
|
546
|
-
state =
|
|
545
|
+
state = Layer.removeElement(state, layerID, 'items', itemID).updatedState;
|
|
547
546
|
state.getIn(['scene', 'groups']).forEach(function (group) {
|
|
548
|
-
return state =
|
|
547
|
+
return state = Group.removeElement(state, group.id, layerID, 'items', itemID).updatedState;
|
|
549
548
|
});
|
|
550
549
|
return {
|
|
551
550
|
updatedState: state
|
|
@@ -564,7 +563,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
564
563
|
}, {
|
|
565
564
|
key: "unselect",
|
|
566
565
|
value: function unselect(state, layerID, itemID) {
|
|
567
|
-
state =
|
|
566
|
+
state = Layer.unselect(state, layerID, 'items', itemID).updatedState;
|
|
568
567
|
return {
|
|
569
568
|
updatedState: state
|
|
570
569
|
};
|
|
@@ -573,8 +572,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
573
572
|
key: "selectToolDrawingItem",
|
|
574
573
|
value: function selectToolDrawingItem(state, sceneComponentType) {
|
|
575
574
|
state = state.merge({
|
|
576
|
-
mode:
|
|
577
|
-
drawingSupport: new
|
|
575
|
+
mode: MODE_DRAWING_ITEM,
|
|
576
|
+
drawingSupport: new Map({
|
|
578
577
|
type: sceneComponentType
|
|
579
578
|
})
|
|
580
579
|
});
|
|
@@ -586,8 +585,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
586
585
|
key: "selectToolDrawingItem3D",
|
|
587
586
|
value: function selectToolDrawingItem3D(state, sceneComponentType) {
|
|
588
587
|
state = state.merge({
|
|
589
|
-
mode:
|
|
590
|
-
drawingSupport: new
|
|
588
|
+
mode: MODE_DRAWING_ITEM_3D,
|
|
589
|
+
drawingSupport: new Map({
|
|
591
590
|
type: sceneComponentType
|
|
592
591
|
})
|
|
593
592
|
});
|
|
@@ -622,7 +621,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
622
621
|
value: function updateDrawingItem(state, layerID, x, y) {
|
|
623
622
|
if (state.hasIn(['drawingSupport', 'currentID'])) {
|
|
624
623
|
var mode = state.get('mode');
|
|
625
|
-
if ([
|
|
624
|
+
if ([MODE_DRAWING_ITEM_3D].includes(mode)) {
|
|
626
625
|
state = state.updateIn(['scene', 'layers', layerID, 'items', state.getIn(['drawingSupport', 'currentID'])], function (item) {
|
|
627
626
|
return item && item.merge({
|
|
628
627
|
x: x,
|
|
@@ -630,12 +629,12 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
630
629
|
});
|
|
631
630
|
});
|
|
632
631
|
state = state.merge({
|
|
633
|
-
mode:
|
|
632
|
+
mode: MODE_IDLE_3D
|
|
634
633
|
});
|
|
635
634
|
}
|
|
636
|
-
if ([
|
|
635
|
+
if ([MODE_DRAWING_ITEM].includes(mode)) {
|
|
637
636
|
state = state.merge({
|
|
638
|
-
mode:
|
|
637
|
+
mode: MODE_IDLE
|
|
639
638
|
});
|
|
640
639
|
state = state.updateIn(['scene', 'layers', layerID, 'items', state.getIn(['drawingSupport', 'currentID'])], function (item) {
|
|
641
640
|
return item && item.merge({
|
|
@@ -651,8 +650,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
651
650
|
if (item === null) {
|
|
652
651
|
alert('There are no Door Colors in this cabinet.');
|
|
653
652
|
state = state.merge({
|
|
654
|
-
mode:
|
|
655
|
-
drawingSupport: new
|
|
653
|
+
mode: MODE_IDLE,
|
|
654
|
+
drawingSupport: new Map()
|
|
656
655
|
});
|
|
657
656
|
} else {
|
|
658
657
|
state = Item.select(stateI, layerID, item.id).updatedState;
|
|
@@ -686,7 +685,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
686
685
|
state = state.merge({
|
|
687
686
|
scene: scene.mergeIn(['layers', layerID, 'items', itemID], item)
|
|
688
687
|
});
|
|
689
|
-
time2 =
|
|
688
|
+
time2 = debugUtil();
|
|
690
689
|
false && console.log('FPS:', Math.round(1000 / (time2 - time1)), ' Delta Time:', (time2 - time1) / 1000, '(s)');
|
|
691
690
|
return {
|
|
692
691
|
updatedState: state
|
|
@@ -697,15 +696,15 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
697
696
|
value: function endDrawingItem(state, layerID, x, y) {
|
|
698
697
|
var catalog = state.catalog;
|
|
699
698
|
state = this.updateDrawingItem(state, layerID, x, y, catalog).updatedState;
|
|
700
|
-
state =
|
|
699
|
+
state = Layer.unselectAll(state, layerID).updatedState;
|
|
701
700
|
var popup = state.get('popup');
|
|
702
701
|
state = state.merge({
|
|
703
|
-
drawingSupport:
|
|
702
|
+
drawingSupport: Map({
|
|
704
703
|
type: state.drawingSupport.get('type')
|
|
705
704
|
}),
|
|
706
705
|
isOpen: !popup
|
|
707
706
|
});
|
|
708
|
-
state =
|
|
707
|
+
state = Layer.unselectAll(state, layerID).updatedState;
|
|
709
708
|
this.updateMolding(state);
|
|
710
709
|
return {
|
|
711
710
|
updatedState: state
|
|
@@ -715,11 +714,11 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
715
714
|
key: "beginDraggingItem",
|
|
716
715
|
value: function beginDraggingItem(state, layerID, itemID, x, y) {
|
|
717
716
|
var item = state.getIn(['scene', 'layers', layerID, 'items', itemID]);
|
|
718
|
-
time1 =
|
|
717
|
+
time1 = debugUtil();
|
|
719
718
|
if (!item) return;
|
|
720
719
|
state = state.merge({
|
|
721
|
-
mode:
|
|
722
|
-
draggingSupport:
|
|
720
|
+
mode: MODE_DRAGGING_ITEM,
|
|
721
|
+
draggingSupport: Map({
|
|
723
722
|
layerID: layerID,
|
|
724
723
|
itemID: itemID,
|
|
725
724
|
startPointX: x,
|
|
@@ -741,8 +740,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
741
740
|
updatedState: state
|
|
742
741
|
};
|
|
743
742
|
state = state.merge({
|
|
744
|
-
mode:
|
|
745
|
-
draggingSupport:
|
|
743
|
+
mode: MODE_DRAGGING_ITEM_3D,
|
|
744
|
+
draggingSupport: Map({
|
|
746
745
|
layerID: layerID,
|
|
747
746
|
itemID: itemID,
|
|
748
747
|
startPointX: x,
|
|
@@ -837,7 +836,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
837
836
|
value: function endDraggingItem(state, x, y) {
|
|
838
837
|
state = this.updateDraggingItem(state, x, y).updatedState;
|
|
839
838
|
state = state.merge({
|
|
840
|
-
mode:
|
|
839
|
+
mode: MODE_IDLE
|
|
841
840
|
});
|
|
842
841
|
return {
|
|
843
842
|
updatedState: state
|
|
@@ -848,7 +847,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
848
847
|
value: function endDraggingItem3D(state) {
|
|
849
848
|
// state = this.updateDraggingItem(state, x, y).updatedState;
|
|
850
849
|
state = state.merge({
|
|
851
|
-
mode:
|
|
850
|
+
mode: MODE_IDLE_3D
|
|
852
851
|
});
|
|
853
852
|
state = state.setIn(['scene', 'isEndDragging'], true);
|
|
854
853
|
return {
|
|
@@ -861,8 +860,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
861
860
|
var item = state.getIn(['scene', 'layers', layerID, 'items', itemID]);
|
|
862
861
|
var originRotation = item.get('rotation');
|
|
863
862
|
state = state.merge({
|
|
864
|
-
mode:
|
|
865
|
-
rotatingSupport:
|
|
863
|
+
mode: MODE_ROTATING_ITEM,
|
|
864
|
+
rotatingSupport: Map({
|
|
866
865
|
layerID: layerID,
|
|
867
866
|
itemID: itemID,
|
|
868
867
|
x: x,
|
|
@@ -880,8 +879,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
880
879
|
var item = state.getIn(['scene', 'layers', layerID, 'items', itemID]);
|
|
881
880
|
var originRotation = item.get('rotation');
|
|
882
881
|
state = state.merge({
|
|
883
|
-
mode:
|
|
884
|
-
rotatingSupport:
|
|
882
|
+
mode: MODE_ROTATING_ITEM_3D,
|
|
883
|
+
rotatingSupport: Map({
|
|
885
884
|
layerID: layerID,
|
|
886
885
|
itemID: itemID,
|
|
887
886
|
x: x,
|
|
@@ -961,7 +960,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
961
960
|
value: function endRotatingItem(state, x, y) {
|
|
962
961
|
//state = this.updateRotatingItem(state, x, y).updatedState;
|
|
963
962
|
state = state.merge({
|
|
964
|
-
mode:
|
|
963
|
+
mode: MODE_IDLE
|
|
965
964
|
});
|
|
966
965
|
return {
|
|
967
966
|
updatedState: state
|
|
@@ -972,7 +971,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
972
971
|
value: function endRotatingItem3D(state, x, y) {
|
|
973
972
|
state = this.updateRotatingItem(state, x, y).updatedState;
|
|
974
973
|
state = state.merge({
|
|
975
|
-
mode:
|
|
974
|
+
mode: MODE_IDLE_3D
|
|
976
975
|
});
|
|
977
976
|
return {
|
|
978
977
|
updatedState: state
|
|
@@ -1033,7 +1032,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1033
1032
|
scene: scene.mergeIn(['layers', layerID, 'items', itemID], item)
|
|
1034
1033
|
});
|
|
1035
1034
|
state = state.merge({
|
|
1036
|
-
mode:
|
|
1035
|
+
mode: MODE_IDLE_3D
|
|
1037
1036
|
});
|
|
1038
1037
|
return {
|
|
1039
1038
|
updatedState: state
|
|
@@ -1050,7 +1049,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1050
1049
|
}, {
|
|
1051
1050
|
key: "setJsProperties",
|
|
1052
1051
|
value: function setJsProperties(state, layerID, itemID, properties) {
|
|
1053
|
-
return this.setProperties(state, layerID, itemID,
|
|
1052
|
+
return this.setProperties(state, layerID, itemID, fromJS(properties));
|
|
1054
1053
|
}
|
|
1055
1054
|
}, {
|
|
1056
1055
|
key: "updateProperties",
|
|
@@ -1065,7 +1064,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1065
1064
|
}, {
|
|
1066
1065
|
key: "updateJsProperties",
|
|
1067
1066
|
value: function updateJsProperties(state, layerID, itemID, properties) {
|
|
1068
|
-
return this.updateProperties(state, layerID, itemID,
|
|
1067
|
+
return this.updateProperties(state, layerID, itemID, fromJS(properties));
|
|
1069
1068
|
}
|
|
1070
1069
|
}, {
|
|
1071
1070
|
key: "setAttributes",
|
|
@@ -1078,7 +1077,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1078
1077
|
}, {
|
|
1079
1078
|
key: "setJsAttributes",
|
|
1080
1079
|
value: function setJsAttributes(state, layerID, itemID, itemAttributes) {
|
|
1081
|
-
itemAttributes =
|
|
1080
|
+
itemAttributes = fromJS(itemAttributes);
|
|
1082
1081
|
return this.setAttributes(state, layerID, itemID, itemAttributes);
|
|
1083
1082
|
}
|
|
1084
1083
|
}, {
|
|
@@ -1100,7 +1099,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1100
1099
|
scene: scene.mergeIn(['layers', layerID, 'items', itemID], item)
|
|
1101
1100
|
});
|
|
1102
1101
|
state = state.merge({
|
|
1103
|
-
mode:
|
|
1102
|
+
mode: MODE_IDLE_3D
|
|
1104
1103
|
});
|
|
1105
1104
|
}
|
|
1106
1105
|
return {
|
|
@@ -1111,7 +1110,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1111
1110
|
key: "removeReplacingSupport",
|
|
1112
1111
|
value: function removeReplacingSupport(state) {
|
|
1113
1112
|
state = state.merge({
|
|
1114
|
-
replacingSupport: new
|
|
1113
|
+
replacingSupport: new Map()
|
|
1115
1114
|
});
|
|
1116
1115
|
return {
|
|
1117
1116
|
updatedState: state
|
|
@@ -1122,14 +1121,14 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1122
1121
|
value: function setInitialDoorStyle(state, doorStyle, oStyle) {
|
|
1123
1122
|
if (doorStyle === undefined) {
|
|
1124
1123
|
state = state.merge({
|
|
1125
|
-
oStyle: new
|
|
1124
|
+
oStyle: new Map({
|
|
1126
1125
|
oStyle: oStyle
|
|
1127
1126
|
})
|
|
1128
1127
|
});
|
|
1129
1128
|
} else {
|
|
1130
1129
|
state = state.merge({
|
|
1131
1130
|
doorStyle: doorStyle,
|
|
1132
|
-
oStyle: new
|
|
1131
|
+
oStyle: new Map({
|
|
1133
1132
|
oStyle: oStyle
|
|
1134
1133
|
})
|
|
1135
1134
|
});
|
|
@@ -1141,12 +1140,12 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1141
1140
|
items.forEach(function (data) {
|
|
1142
1141
|
{
|
|
1143
1142
|
var itemID = data.id;
|
|
1144
|
-
var tmpDS = (
|
|
1145
|
-
doorStyles: (
|
|
1143
|
+
var tmpDS = _objectSpread(_objectSpread({}, data.doorStyle), {}, {
|
|
1144
|
+
doorStyles: _objectSpread(_objectSpread({}, data.doorStyle.doorStyles), {}, {
|
|
1146
1145
|
counttop: doorStyle.doorStyles.counttop
|
|
1147
1146
|
})
|
|
1148
1147
|
});
|
|
1149
|
-
data = data.mergeIn(['doorStyle'],
|
|
1148
|
+
data = data.mergeIn(['doorStyle'], fromJS(tmpDS));
|
|
1150
1149
|
layers = layers.mergeIn(['items', itemID], data);
|
|
1151
1150
|
state = state.merge({
|
|
1152
1151
|
scene: scene.mergeIn(['layers', layerID], layers)
|
|
@@ -1189,15 +1188,15 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1189
1188
|
var itemID = data.id;
|
|
1190
1189
|
var curItem = state.getIn(['scene', 'layers', layerID, 'items', itemID]);
|
|
1191
1190
|
var layer = state.getIn(['scene', 'layers', layerID]);
|
|
1192
|
-
var tmpMolding = (
|
|
1193
|
-
var temp_item_molding = (
|
|
1191
|
+
var tmpMolding = _toConsumableArray(curItem.molding);
|
|
1192
|
+
var temp_item_molding = _toConsumableArray(curItem.molding);
|
|
1194
1193
|
temp_item_molding = temp_item_molding.filter(function (md) {
|
|
1195
1194
|
return doorStyle.doorStyles.cds.some(function (ds) {
|
|
1196
1195
|
return ds.itemID === md.itemID;
|
|
1197
1196
|
});
|
|
1198
1197
|
});
|
|
1199
1198
|
tmpMolding.forEach(function (md) {
|
|
1200
|
-
var itemGroup =
|
|
1199
|
+
var itemGroup = MoldingUtils.getItemGroupFromMolding(layer, curItem, md);
|
|
1201
1200
|
itemGroup.forEach(function (it) {
|
|
1202
1201
|
state = state.setIn(['scene', 'layers', layerID, 'items', it.id, 'molding'], temp_item_molding);
|
|
1203
1202
|
});
|
|
@@ -1210,74 +1209,74 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1210
1209
|
})) || [];
|
|
1211
1210
|
var cds_data;
|
|
1212
1211
|
if (doorStyle.door_style_name === 'Euro & Frameless' && euro_cds.length > 0) {
|
|
1213
|
-
cds_data = cds ? (
|
|
1212
|
+
cds_data = cds ? _objectSpread(_objectSpread({}, euro_cds[0]), {}, {
|
|
1214
1213
|
cabinet_door_style_id: cds.cabinet_door_style_id
|
|
1215
1214
|
}) : {};
|
|
1216
1215
|
var newProperties = state.scene.getIn(['layers', layerID, 'items', itemID, 'properties']).toJS();
|
|
1217
1216
|
if (newProperties.hasOwnProperty('depth')) {
|
|
1218
1217
|
if (!newProperties.hasOwnProperty('oldDepth')) {
|
|
1219
|
-
newProperties['oldDepth'] = new
|
|
1218
|
+
newProperties['oldDepth'] = new Map({
|
|
1220
1219
|
length: newProperties.depth.length,
|
|
1221
1220
|
_length: newProperties.depth._length,
|
|
1222
1221
|
_unit: newProperties.depth._unit
|
|
1223
1222
|
});
|
|
1224
1223
|
}
|
|
1225
|
-
newProperties['depth'] = new
|
|
1226
|
-
length:
|
|
1224
|
+
newProperties['depth'] = new Map({
|
|
1225
|
+
length: convert(euro_cds[0].euro_length).from('in').to('cm'),
|
|
1227
1226
|
_length: euro_cds[0].euro_length,
|
|
1228
1227
|
_unit: 'in'
|
|
1229
1228
|
});
|
|
1230
1229
|
}
|
|
1231
1230
|
if (newProperties.hasOwnProperty('height')) {
|
|
1232
1231
|
if (!newProperties.hasOwnProperty('oldHeight')) {
|
|
1233
|
-
newProperties['oldHeight'] = new
|
|
1232
|
+
newProperties['oldHeight'] = new Map({
|
|
1234
1233
|
length: newProperties.height.length,
|
|
1235
1234
|
_length: newProperties.height._length,
|
|
1236
1235
|
_unit: newProperties.height._unit
|
|
1237
1236
|
});
|
|
1238
1237
|
}
|
|
1239
|
-
newProperties['height'] = new
|
|
1240
|
-
length:
|
|
1238
|
+
newProperties['height'] = new Map({
|
|
1239
|
+
length: convert(euro_cds[0].euro_height).from('in').to('cm'),
|
|
1241
1240
|
_length: euro_cds[0].euro_height,
|
|
1242
1241
|
_unit: 'in'
|
|
1243
1242
|
});
|
|
1244
1243
|
}
|
|
1245
1244
|
if (newProperties.hasOwnProperty('width')) {
|
|
1246
1245
|
if (!newProperties.hasOwnProperty('oldWidth')) {
|
|
1247
|
-
newProperties['oldWidth'] = new
|
|
1246
|
+
newProperties['oldWidth'] = new Map({
|
|
1248
1247
|
length: newProperties.width.length,
|
|
1249
1248
|
_length: newProperties.width._length,
|
|
1250
1249
|
_unit: newProperties.width._unit
|
|
1251
1250
|
});
|
|
1252
1251
|
}
|
|
1253
|
-
newProperties['width'] = new
|
|
1254
|
-
length:
|
|
1252
|
+
newProperties['width'] = new Map({
|
|
1253
|
+
length: convert(euro_cds[0].euro_width).from('in').to('cm') - 10,
|
|
1255
1254
|
_length: euro_cds[0].euro_width,
|
|
1256
1255
|
_unit: 'in'
|
|
1257
1256
|
});
|
|
1258
1257
|
}
|
|
1259
1258
|
state = _this2.setJsProperties(state, layerID, itemID, newProperties).updatedState;
|
|
1260
1259
|
} else {
|
|
1261
|
-
cds_data = cds ? (
|
|
1260
|
+
cds_data = cds ? _objectSpread(_objectSpread({}, cds.data && cds.data[0] ? cds.data[0] : {}), {}, {
|
|
1262
1261
|
cabinet_door_style_id: cds.cabinet_door_style_id
|
|
1263
1262
|
}) : {};
|
|
1264
1263
|
var properties = state.scene.getIn(['layers', layerID, 'items', itemID, 'properties']).toJS();
|
|
1265
1264
|
if (properties.hasOwnProperty('oldDepth')) {
|
|
1266
|
-
properties['depth'] = new
|
|
1265
|
+
properties['depth'] = new Map({
|
|
1267
1266
|
length: properties.oldDepth.length,
|
|
1268
1267
|
_length: properties.oldDepth._length,
|
|
1269
1268
|
_unit: properties.oldDepth._unit
|
|
1270
1269
|
});
|
|
1271
1270
|
}
|
|
1272
1271
|
if (properties.hasOwnProperty('oldHeight')) {
|
|
1273
|
-
properties['height'] = new
|
|
1272
|
+
properties['height'] = new Map({
|
|
1274
1273
|
length: properties.oldHeight.length,
|
|
1275
1274
|
_length: properties.oldHeight._length,
|
|
1276
1275
|
_unit: properties.oldHeight._unit
|
|
1277
1276
|
});
|
|
1278
1277
|
}
|
|
1279
1278
|
if (properties.hasOwnProperty('oldWidth')) {
|
|
1280
|
-
properties['width'] = new
|
|
1279
|
+
properties['width'] = new Map({
|
|
1281
1280
|
length: properties.oldWidth.length,
|
|
1282
1281
|
_length: properties.oldWidth._length,
|
|
1283
1282
|
_unit: properties.oldWidth._unit
|
|
@@ -1298,10 +1297,10 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1298
1297
|
sku: doorStyle.sku,
|
|
1299
1298
|
color_sku_alias: doorStyle.color_sku_alias,
|
|
1300
1299
|
// alias name of color_sku for the current dealer
|
|
1301
|
-
install:
|
|
1302
|
-
doorStyles: (
|
|
1300
|
+
install: getInstallationSuffix(INSTALLATION_SUFFIX_TYPE.NAME, doorStyle),
|
|
1301
|
+
doorStyles: _objectSpread(_objectSpread({}, tmp), cds_data)
|
|
1303
1302
|
};
|
|
1304
|
-
state = state.mergeIn(['scene', 'layers', layerID, 'items', itemID, 'doorStyle'],
|
|
1303
|
+
state = state.mergeIn(['scene', 'layers', layerID, 'items', itemID, 'doorStyle'], fromJS(tmpDS));
|
|
1305
1304
|
};
|
|
1306
1305
|
if (isAll) {
|
|
1307
1306
|
var items = state.scene.layers.get(layerID).items;
|
|
@@ -1343,7 +1342,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1343
1342
|
var dataJSON = data.toJS();
|
|
1344
1343
|
var itemID = dataJSON.id;
|
|
1345
1344
|
var newCounter = dataJSON.counterTop;
|
|
1346
|
-
newCounter = (
|
|
1345
|
+
newCounter = _objectSpread(_objectSpread({}, newCounter), counterTop);
|
|
1347
1346
|
data = data.mergeIn(['counterTop'], newCounter);
|
|
1348
1347
|
layers = layers.mergeIn(['items', itemID], data);
|
|
1349
1348
|
state = state.merge({
|
|
@@ -1408,11 +1407,11 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1408
1407
|
var dataJSON = data.toJS();
|
|
1409
1408
|
var itemID = dataJSON.id;
|
|
1410
1409
|
var doorStyle = dataJSON.doorStyle;
|
|
1411
|
-
var tmpDS = (
|
|
1410
|
+
var tmpDS = _objectSpread(_objectSpread({}, doorStyle), {}, {
|
|
1412
1411
|
metalness: material.metalness,
|
|
1413
1412
|
roughness: material.roughness
|
|
1414
1413
|
});
|
|
1415
|
-
data = data.mergeIn(['doorStyle'],
|
|
1414
|
+
data = data.mergeIn(['doorStyle'], fromJS(tmpDS));
|
|
1416
1415
|
layers = layers.mergeIn(['items', itemID], data);
|
|
1417
1416
|
state = state.merge({
|
|
1418
1417
|
scene: scene.mergeIn(['layers', layerID], layers)
|
|
@@ -1462,13 +1461,13 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1462
1461
|
// if backsplash is already set
|
|
1463
1462
|
if (layer.getIn(['backsplash']).uri === backsplash.uri) {
|
|
1464
1463
|
// unselect
|
|
1465
|
-
newBack = (
|
|
1464
|
+
newBack = _objectSpread(_objectSpread({}, newBack), {}, {
|
|
1466
1465
|
uri: ''
|
|
1467
1466
|
});
|
|
1468
1467
|
flag = false;
|
|
1469
1468
|
}
|
|
1470
1469
|
// else then, set backsplash
|
|
1471
|
-
else newBack = (
|
|
1470
|
+
else newBack = _objectSpread(_objectSpread({}, newBack), backsplash);
|
|
1472
1471
|
layer = layer.mergeIn(['backsplash'], newBack);
|
|
1473
1472
|
layer = layer.set('backsplashApplied', flag);
|
|
1474
1473
|
state = state.merge({
|
|
@@ -1509,7 +1508,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1509
1508
|
scene: scene.mergeIn(['layers', layerID], layer)
|
|
1510
1509
|
});
|
|
1511
1510
|
layer.items.toArray().forEach(function (item) {
|
|
1512
|
-
if (
|
|
1511
|
+
if (MoldingUtils.isEnableItemForMolding(layer, item, molding)) {
|
|
1513
1512
|
var tempItemMolding = item.molding;
|
|
1514
1513
|
if (flag) {
|
|
1515
1514
|
if (tempItemMolding.some(function (mol) {
|
|
@@ -1534,8 +1533,8 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1534
1533
|
});
|
|
1535
1534
|
} else {
|
|
1536
1535
|
var selectedItem = layer.getIn(['items', layer.selected.toJS().items[0]]);
|
|
1537
|
-
if (
|
|
1538
|
-
var moldingGroup =
|
|
1536
|
+
if (MoldingUtils.isEnableItemForMolding(layer, selectedItem, molding)) {
|
|
1537
|
+
var moldingGroup = MoldingUtils.getItemGroupFromMolding(layer, selectedItem, molding);
|
|
1539
1538
|
var tempSelItemMolding = selectedItem.molding;
|
|
1540
1539
|
var _flag = tempSelItemMolding.some(function (mol) {
|
|
1541
1540
|
return mol.name === molding.name;
|
|
@@ -1581,16 +1580,16 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1581
1580
|
var itemGroups = [];
|
|
1582
1581
|
layer.items.toArray().forEach(function (curItem) {
|
|
1583
1582
|
if (selectedItem.id !== curItem.id && curItem.category === 'cabinet') {
|
|
1584
|
-
if (
|
|
1583
|
+
if (MoldingUtils.isItemSnappedItem(selectedItem, curItem)) {
|
|
1585
1584
|
snappedItemGroup.push(curItem); // add the snapped item.
|
|
1586
1585
|
// add the snapped item that has same molding location type, layoutpos and height to itemGroups.
|
|
1587
1586
|
if (curItem.molding.length) {
|
|
1588
1587
|
curItem.molding.forEach(function (md) {
|
|
1589
1588
|
// This code check whether the curItem can be grouped with selected Item in molding.
|
|
1590
|
-
if (
|
|
1589
|
+
if (MoldingUtils.tryMergeMDItem(layer, selectedItem, curItem, [selectedItem], md)) {
|
|
1591
1590
|
itemGroups.push({
|
|
1592
1591
|
base_item: curItem,
|
|
1593
|
-
group:
|
|
1592
|
+
group: MoldingUtils.getItemGroupFromMolding(layer, curItem, md),
|
|
1594
1593
|
molding: md
|
|
1595
1594
|
});
|
|
1596
1595
|
}
|
|
@@ -1602,11 +1601,11 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1602
1601
|
var updateSelectItemMolding = function updateSelectItemMolding() {
|
|
1603
1602
|
var _loop2 = function _loop2() {
|
|
1604
1603
|
// check whether snapped item is same as selected item in layoutpos(Wall, Tall, Base)
|
|
1605
|
-
if (
|
|
1604
|
+
if (MoldingUtils.isSameMoldingLayoutpos(selectedItem, snappedItemGroup[i])) {
|
|
1606
1605
|
// check whether snapped item is same in location(same location type and height).
|
|
1607
1606
|
var delMoldings = [];
|
|
1608
1607
|
for (var k = 0; k < selectedItem.molding.length; k++) {
|
|
1609
|
-
if (
|
|
1608
|
+
if (MoldingUtils.isItemSameItemByLocation(selectedItem, snappedItemGroup[i], selectedItem.molding[k].location_type)) {
|
|
1610
1609
|
delMoldings.push(selectedItem.molding[k].itemID);
|
|
1611
1610
|
}
|
|
1612
1611
|
}
|
|
@@ -1657,13 +1656,13 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1657
1656
|
return it.molding.location_type === location;
|
|
1658
1657
|
}).sort(function (a, b) {
|
|
1659
1658
|
if (a.group.length === b.group.length) {
|
|
1660
|
-
return
|
|
1659
|
+
return GeometryUtils.pointsDistance(a.base_item.x, a.base_item.y, selectedItem.x, selectedItem.y) - GeometryUtils.pointsDistance(b.base_item.x, b.base_item.y, selectedItem.x, selectedItem.y);
|
|
1661
1660
|
} else {
|
|
1662
1661
|
return a.group.length - b.group.length;
|
|
1663
1662
|
}
|
|
1664
1663
|
});
|
|
1665
1664
|
if (locationMolding.length) {
|
|
1666
|
-
var locationMoldingItems =
|
|
1665
|
+
var locationMoldingItems = MoldingUtils.getItemGroupFromMolding(layer, selectedItem, locationMolding[0].molding);
|
|
1667
1666
|
locationMoldingItems.forEach(function (item) {
|
|
1668
1667
|
var tempMoldings = state.getIn(['scene', 'layers', layerID, 'items', item.id, 'molding']);
|
|
1669
1668
|
if (!tempMoldings.some(function (mol) {
|
|
@@ -1674,11 +1673,11 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1674
1673
|
}
|
|
1675
1674
|
};
|
|
1676
1675
|
if (itemGroups.length && layer.items.some(function (it) {
|
|
1677
|
-
return
|
|
1676
|
+
return MoldingUtils.isItemSnappedItem(selectedItem, it) && it.category === 'cabinet';
|
|
1678
1677
|
})) {
|
|
1679
1678
|
emptyMoldingArray();
|
|
1680
|
-
for (var i = 0; i <
|
|
1681
|
-
setLocationMolding(
|
|
1679
|
+
for (var i = 0; i < MOLDING_LOCATIONS.length; i++) {
|
|
1680
|
+
setLocationMolding(MOLDING_LOCATIONS[i]);
|
|
1682
1681
|
}
|
|
1683
1682
|
} else if (!itemGroups.length && selectedItem.molding.length) {
|
|
1684
1683
|
// Delete the selected Item's molding property if selItem attached the group that has no molding.
|
|
@@ -1779,7 +1778,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1779
1778
|
length = 0;
|
|
1780
1779
|
_length = 0;
|
|
1781
1780
|
}
|
|
1782
|
-
state = state.mergeIn(['scene', 'layers', layerID, 'items', itemID, 'properties', 'altitude'], new
|
|
1781
|
+
state = state.mergeIn(['scene', 'layers', layerID, 'items', itemID, 'properties', 'altitude'], new Map({
|
|
1783
1782
|
length: length,
|
|
1784
1783
|
_length: _length,
|
|
1785
1784
|
_unit: _unit
|
|
@@ -1791,7 +1790,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1791
1790
|
}, {
|
|
1792
1791
|
key: "createHole",
|
|
1793
1792
|
value: function createHole(state, layerID, type, lineID, offset, properties) {
|
|
1794
|
-
var holeID =
|
|
1793
|
+
var holeID = IDBroker.acquireID();
|
|
1795
1794
|
var hole = state.catalog.factoryElement(type, {
|
|
1796
1795
|
id: holeID,
|
|
1797
1796
|
url: state.catalog.getIn(['elements', type, 'info', 'url']),
|
|
@@ -1841,7 +1840,7 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1841
1840
|
if (properties.hasOwnProperty('flip_horizontal')) {
|
|
1842
1841
|
properties['flip_horizontal'] = true;
|
|
1843
1842
|
}
|
|
1844
|
-
state =
|
|
1843
|
+
state = Hole.setJsProperties(state, layerID, holeID, properties).updatedState;
|
|
1845
1844
|
return {
|
|
1846
1845
|
updatedState: state,
|
|
1847
1846
|
hole: hole
|
|
@@ -1871,4 +1870,5 @@ var Item = exports["default"] = /*#__PURE__*/function () {
|
|
|
1871
1870
|
};
|
|
1872
1871
|
}
|
|
1873
1872
|
}]);
|
|
1874
|
-
}();
|
|
1873
|
+
}();
|
|
1874
|
+
export { Item as default };
|