kitchen-simulator 3.1.15 → 4.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/LiteKitchenConfigurator.js +204 -21
- package/es/LiteRenderer.js +277 -12
- package/es/actions/items-actions.js +6 -10
- package/es/actions/lines-actions.js +1 -3
- package/es/actions/project-actions.js +5 -15
- package/es/assets/Window.hdr +2100 -0
- package/es/assets/gltf/door_sliding.bin +0 -0
- package/es/assets/img/1.jpg +0 -0
- package/es/catalog/areas/area/planner-element.js +5 -10
- package/es/catalog/catalog.js +4 -1
- package/es/catalog/factories/area-factory-3d.js +17 -18
- package/es/catalog/factories/wall-factory-3d.js +2 -2
- package/es/catalog/factories/wall-factory.js +8 -8
- package/es/catalog/lines/wall/planner-element.js +9 -18
- package/es/catalog/utils/exporter.js +3 -6
- package/es/catalog/utils/item-loader.js +197 -202
- package/es/catalog/utils/mtl-loader.js +2 -2
- package/es/catalog/utils/obj-loader.js +2 -2
- package/es/class/item.js +127 -107
- package/es/class/line.js +2 -14
- package/es/class/project.js +44 -150
- package/es/components/content.js +6 -19
- package/es/components/viewer2d/grids/grid-streak.js +1 -1
- package/es/components/viewer2d/item.js +51 -84
- package/es/components/viewer2d/line.js +243 -315
- package/es/components/viewer2d/ruler.js +36 -16
- package/es/components/viewer2d/rulerDist.js +75 -44
- package/es/components/viewer2d/utils.js +0 -6
- package/es/components/viewer2d/viewer2d.js +205 -301
- package/es/components/viewer3d/front3D.js +2 -3
- package/es/components/viewer3d/libs/mtl-loader.js +2 -2
- package/es/components/viewer3d/libs/obj-loader.js +2 -2
- package/es/components/viewer3d/libs/orbit-controls.js +4 -3
- package/es/components/viewer3d/libs/pointer-lock-controls.js +7 -6
- package/es/components/viewer3d/viewer3d.js +80 -127
- package/es/constants.js +3 -110
- package/es/devLiteRenderer.js +38 -597
- package/es/index.js +86 -16
- package/es/models.js +5 -8
- package/es/plugins/SVGLoader.js +5 -7
- package/es/plugins/keyboard.js +6 -15
- package/es/reducers/items-reducer.js +5 -5
- package/es/reducers/lines-reducer.js +1 -1
- package/es/reducers/project-reducer.js +3 -5
- package/es/shared-style.js +4 -4
- package/es/utils/geometry.js +0 -161
- package/es/utils/get-edges-of-subgraphs.js +1 -1
- package/es/utils/graph-cycles.js +1 -1
- package/es/utils/graph.js +1 -1
- package/es/utils/helper.js +2 -67
- package/es/utils/isolate-event-handler.js +124 -1367
- package/es/utils/molding.js +2 -238
- package/lib/LiteKitchenConfigurator.js +205 -22
- package/lib/LiteRenderer.js +278 -13
- package/lib/actions/items-actions.js +6 -10
- package/lib/actions/lines-actions.js +1 -3
- package/lib/actions/project-actions.js +4 -15
- package/lib/assets/Window.hdr +2100 -0
- package/lib/assets/gltf/door_sliding.bin +0 -0
- package/lib/assets/img/1.jpg +0 -0
- package/lib/catalog/areas/area/planner-element.js +5 -11
- package/lib/catalog/catalog.js +4 -1
- package/lib/catalog/factories/area-factory-3d.js +14 -15
- package/lib/catalog/factories/wall-factory-3d.js +2 -2
- package/lib/catalog/factories/wall-factory.js +8 -8
- package/lib/catalog/lines/wall/planner-element.js +9 -19
- package/lib/catalog/utils/exporter.js +3 -6
- package/lib/catalog/utils/item-loader.js +194 -199
- package/lib/catalog/utils/mtl-loader.js +2 -9
- package/lib/catalog/utils/obj-loader.js +2 -10
- package/lib/class/item.js +125 -105
- package/lib/class/line.js +1 -13
- package/lib/class/project.js +43 -149
- package/lib/components/content.js +6 -19
- package/lib/components/viewer2d/grids/grid-streak.js +1 -1
- package/lib/components/viewer2d/item.js +50 -83
- package/lib/components/viewer2d/line.js +242 -315
- package/lib/components/viewer2d/ruler.js +35 -15
- package/lib/components/viewer2d/rulerDist.js +75 -44
- package/lib/components/viewer2d/utils.js +0 -7
- package/lib/components/viewer2d/viewer2d.js +205 -299
- package/lib/components/viewer3d/front3D.js +2 -3
- package/lib/components/viewer3d/libs/mtl-loader.js +2 -9
- package/lib/components/viewer3d/libs/obj-loader.js +2 -9
- package/lib/components/viewer3d/libs/orbit-controls.js +5 -11
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +7 -13
- package/lib/components/viewer3d/viewer3d.js +79 -125
- package/lib/constants.js +7 -115
- package/lib/devLiteRenderer.js +33 -592
- package/lib/index.js +86 -16
- package/lib/models.js +5 -8
- package/lib/plugins/SVGLoader.js +5 -7
- package/lib/plugins/keyboard.js +6 -15
- package/lib/reducers/items-reducer.js +5 -5
- package/lib/reducers/lines-reducer.js +1 -1
- package/lib/reducers/project-reducer.js +2 -4
- package/lib/shared-style.js +4 -4
- package/lib/utils/geometry.js +0 -162
- package/lib/utils/get-edges-of-subgraphs.js +1 -6
- package/lib/utils/graph-cycles.js +8 -7
- package/lib/utils/graph.js +1 -6
- package/lib/utils/helper.js +3 -70
- package/lib/utils/isolate-event-handler.js +121 -1364
- package/lib/utils/molding.js +0 -238
- package/package.json +1 -1
|
@@ -7,430 +7,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.handleExternalEvent = handleExternalEvent;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
11
|
var _immutable = require("immutable");
|
|
13
12
|
var _constants = require("../constants");
|
|
14
13
|
var _helper = require("./helper");
|
|
15
14
|
var _exporter = _interopRequireDefault(require("../catalog/utils/exporter"));
|
|
16
15
|
var _itemLoader = require("../catalog/utils/item-loader");
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var _utils = require("../components/viewer2d/utils");
|
|
20
|
-
var _SVGLoader = require("three/addons/loaders/SVGLoader");
|
|
21
|
-
var _molding = require("./molding");
|
|
16
|
+
var _catalog = _interopRequireDefault(require("../catalog/catalog"));
|
|
17
|
+
var _models = require("../models");
|
|
22
18
|
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; }
|
|
23
19
|
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; }
|
|
24
|
-
var PRECISION = 2;
|
|
25
|
-
function loadJSON(_x) {
|
|
26
|
-
return _loadJSON.apply(this, arguments);
|
|
27
|
-
}
|
|
28
|
-
/********Parse TempPlaceholder from cabinetPayloadData **************/
|
|
29
|
-
function _loadJSON() {
|
|
30
|
-
_loadJSON = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(path) {
|
|
31
|
-
return _regenerator["default"].wrap(function (_context2) {
|
|
32
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
33
|
-
case 0:
|
|
34
|
-
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
35
|
-
var xhr = new XMLHttpRequest();
|
|
36
|
-
xhr.onreadystatechange = function () {
|
|
37
|
-
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
38
|
-
if (xhr.status === 200) {
|
|
39
|
-
resolve(JSON.parse(xhr.responseText));
|
|
40
|
-
} else {
|
|
41
|
-
reject(xhr);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
xhr.open('GET', path, true);
|
|
46
|
-
xhr.send();
|
|
47
|
-
}));
|
|
48
|
-
case 1:
|
|
49
|
-
case "end":
|
|
50
|
-
return _context2.stop();
|
|
51
|
-
}
|
|
52
|
-
}, _callee2);
|
|
53
|
-
}));
|
|
54
|
-
return _loadJSON.apply(this, arguments);
|
|
55
|
-
}
|
|
56
|
-
function parseTempPlaceholdersFromCabinetPayload(_x2) {
|
|
57
|
-
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
58
|
-
}
|
|
59
|
-
/***** Update cabinetPayloadData with updatedTempPlaceholders *****/
|
|
60
|
-
function _parseTempPlaceholdersFromCabinetPayload() {
|
|
61
|
-
_parseTempPlaceholdersFromCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(cabinetPayload) {
|
|
62
|
-
var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, el, tempPlaceholdersData, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, _t2, _t3, _t4;
|
|
63
|
-
return _regenerator["default"].wrap(function (_context3) {
|
|
64
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
65
|
-
case 0:
|
|
66
|
-
link = '';
|
|
67
|
-
keys = Object.keys(cabinetPayload.structure_json);
|
|
68
|
-
temp = [];
|
|
69
|
-
i = 0;
|
|
70
|
-
case 1:
|
|
71
|
-
if (!(i < keys.length)) {
|
|
72
|
-
_context3.next = 4;
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
if (!((_cabinetPayload$struc = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc !== void 0 && (_cabinetPayload$struc = _cabinetPayload$struc.toString()) !== null && _cabinetPayload$struc !== void 0 && _cabinetPayload$struc.includes('.gltf') && (_cabinetPayload$struc2 = cabinetPayload.structure_json[keys[i]]) !== null && _cabinetPayload$struc2 !== void 0 && (_cabinetPayload$struc2 = _cabinetPayload$struc2.toString()) !== null && _cabinetPayload$struc2 !== void 0 && _cabinetPayload$struc2.startsWith('http'))) {
|
|
76
|
-
_context3.next = 3;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
link = cabinetPayload.structure_json[keys[i]];
|
|
80
|
-
_t2 = temp;
|
|
81
|
-
_t3 = keys[i];
|
|
82
|
-
_context3.next = 2;
|
|
83
|
-
return loadJSON(link);
|
|
84
|
-
case 2:
|
|
85
|
-
_t4 = _context3.sent;
|
|
86
|
-
_t2.push.call(_t2, {
|
|
87
|
-
name: _t3,
|
|
88
|
-
data: _t4
|
|
89
|
-
});
|
|
90
|
-
case 3:
|
|
91
|
-
i++;
|
|
92
|
-
_context3.next = 1;
|
|
93
|
-
break;
|
|
94
|
-
case 4:
|
|
95
|
-
el = cabinetPayload.structure_json.tempPlaceholders[0].id;
|
|
96
|
-
tempPlaceholdersData = [];
|
|
97
|
-
tempData = {};
|
|
98
|
-
doorKey = 0;
|
|
99
|
-
drawerKey = 0;
|
|
100
|
-
fixedKey = 0;
|
|
101
|
-
doorPHs = 0;
|
|
102
|
-
drawerPHs = 0;
|
|
103
|
-
has_single_door = false;
|
|
104
|
-
fixedPHs = 0;
|
|
105
|
-
temp.forEach(function (t, index) {
|
|
106
|
-
var nodes = t.data.nodes;
|
|
107
|
-
if (nodes === undefined) {
|
|
108
|
-
nodes = [];
|
|
109
|
-
}
|
|
110
|
-
var tempPlaceholders = nodes.filter(function (element) {
|
|
111
|
-
return element.name.startsWith('ph_');
|
|
112
|
-
});
|
|
113
|
-
tempPlaceholders.sort(function (a, b) {
|
|
114
|
-
return a.name > b.name ? 1 : -1;
|
|
115
|
-
});
|
|
116
|
-
if (tempPlaceholders.length > 0) {
|
|
117
|
-
if (t.name === 'base') {
|
|
118
|
-
tempPlaceholders.map(function (element) {
|
|
119
|
-
var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
|
|
120
|
-
if (sink_match && sink_match.length >= 2) {
|
|
121
|
-
var _process$env$API_URL, _cabinetPayload$struc3;
|
|
122
|
-
tempData['sink'] = tempData['sink'] || [];
|
|
123
|
-
tempData['sink'].push(element.name);
|
|
124
|
-
var sink_url = (_process$env$API_URL = process.env.API_URL) !== null && _process$env$API_URL !== void 0 ? _process$env$API_URL :
|
|
125
|
-
// server url from 3DTool env
|
|
126
|
-
import.meta.env.VITE_APP_API_URL + // server url from Host env
|
|
127
|
-
"/uploads/assets/default/".concat(sink_match[1], ".gltf");
|
|
128
|
-
if (cabinetPayload !== null && cabinetPayload !== void 0 && (_cabinetPayload$struc3 = cabinetPayload.structure_json) !== null && _cabinetPayload$struc3 !== void 0 && (_cabinetPayload$struc3 = _cabinetPayload$struc3.tempPlaceholders[0]) !== null && _cabinetPayload$struc3 !== void 0 && _cabinetPayload$struc3.structure) cabinetPayload.structure_json.tempPlaceholders[0].structure.sink = sink_url;
|
|
129
|
-
} else if (temp.some(function (felement) {
|
|
130
|
-
return felement.name.includes('base_drawer');
|
|
131
|
-
}) && element.name.includes('interior_drawer')) {
|
|
132
|
-
var objCnt = temp.filter(function (felement) {
|
|
133
|
-
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
134
|
-
}).length;
|
|
135
|
-
var phCnt = tempPlaceholders.filter(function (felement) {
|
|
136
|
-
return felement.name.includes('interior');
|
|
137
|
-
}).length;
|
|
138
|
-
drawerPHs = phCnt;
|
|
139
|
-
if (objCnt === 1 || phCnt % objCnt !== 0) {
|
|
140
|
-
if (tempData['base_drawer_1'] === undefined) {
|
|
141
|
-
tempData['base_drawer_1'] = [];
|
|
142
|
-
}
|
|
143
|
-
tempData['base_drawer_1'].push(element.name);
|
|
144
|
-
drawerKey++;
|
|
145
|
-
} else if (objCnt > 1 && phCnt % objCnt === 0) {
|
|
146
|
-
if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
|
|
147
|
-
tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
|
|
148
|
-
}
|
|
149
|
-
tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
|
|
150
|
-
drawerKey++;
|
|
151
|
-
}
|
|
152
|
-
} else if (temp.some(function (felement) {
|
|
153
|
-
return felement.name.includes('base_door');
|
|
154
|
-
}) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
|
|
155
|
-
var _objCnt = temp.filter(function (felement) {
|
|
156
|
-
return felement.name.includes('base_door');
|
|
157
|
-
}).length;
|
|
158
|
-
var _phCnt = tempPlaceholders.filter(function (felement) {
|
|
159
|
-
return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
|
|
160
|
-
}).length;
|
|
161
|
-
doorPHs = _phCnt;
|
|
162
|
-
if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
|
|
163
|
-
if (tempData['base_door_1'] === undefined) {
|
|
164
|
-
tempData['base_door_1'] = [];
|
|
165
|
-
}
|
|
166
|
-
tempData['base_door_1'].push(element.name);
|
|
167
|
-
doorKey++;
|
|
168
|
-
} else if (_objCnt > 1) {
|
|
169
|
-
if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
|
|
170
|
-
tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
|
|
171
|
-
}
|
|
172
|
-
tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
|
|
173
|
-
doorKey++;
|
|
174
|
-
}
|
|
175
|
-
} else if (temp.some(function (felement) {
|
|
176
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
177
|
-
}) && element.name.includes('_drawer_door_fixed')) {
|
|
178
|
-
var _objCnt2 = temp.filter(function (felement) {
|
|
179
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
180
|
-
}).length;
|
|
181
|
-
var _phCnt2 = tempPlaceholders.filter(function (felement) {
|
|
182
|
-
return felement.name.includes('_drawer_door_fixed');
|
|
183
|
-
}).length;
|
|
184
|
-
fixedPHs = _phCnt2;
|
|
185
|
-
if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
|
|
186
|
-
if (tempData['base_fixed_drawer_door_1'] === undefined) {
|
|
187
|
-
tempData['base_fixed_drawer_door_1'] = [];
|
|
188
|
-
}
|
|
189
|
-
tempData['base_fixed_drawer_door_1'].push(element.name);
|
|
190
|
-
fixedKey++;
|
|
191
|
-
} else if (_objCnt2 > 1) {
|
|
192
|
-
if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
|
|
193
|
-
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
|
|
194
|
-
}
|
|
195
|
-
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
|
|
196
|
-
fixedKey++;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
} else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
|
|
201
|
-
var objCnt = temp.filter(function (felement) {
|
|
202
|
-
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
203
|
-
}).length;
|
|
204
|
-
if (objCnt === 1 || drawerPHs % objCnt !== 0) {
|
|
205
|
-
if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
|
|
206
|
-
//get drawer door handle placeholders
|
|
207
|
-
var ph_temp = temp.find(function (felement) {
|
|
208
|
-
return felement.name === 'base_drawer_door_1';
|
|
209
|
-
});
|
|
210
|
-
if (ph_temp != undefined) {
|
|
211
|
-
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
212
|
-
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
213
|
-
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
214
|
-
});
|
|
215
|
-
for (var w = 0; w < drawerPHs; w++) {
|
|
216
|
-
if (!tempData['base_drawer_door_1'].some(function (el) {
|
|
217
|
-
return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
|
|
218
|
-
})) {
|
|
219
|
-
tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
|
|
220
|
-
//add drawer door handle placeholders
|
|
221
|
-
if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
|
|
222
|
-
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
} else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
|
|
227
|
-
if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
|
|
228
|
-
//get drawer door handle placeholders
|
|
229
|
-
var ph_temp = temp.find(function (felement) {
|
|
230
|
-
return felement.name === 'base_drawer_door' + t.name.slice(-2);
|
|
231
|
-
});
|
|
232
|
-
if (ph_temp != undefined) {
|
|
233
|
-
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
234
|
-
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
235
|
-
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
236
|
-
});
|
|
237
|
-
tempPlaceholders.forEach(function (element) {
|
|
238
|
-
if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
|
|
239
|
-
return el === t.name + '/' + element.name;
|
|
240
|
-
})) {
|
|
241
|
-
tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
|
|
242
|
-
//add drawer door handle placeholders
|
|
243
|
-
if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
|
|
244
|
-
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle' + t.name.slice(-2)].push('base_drawer_door' + t.name.slice(-2) + '/' + ph_drawer_door_handle[0].name);
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
} else if (t.name.includes('base_door')) {
|
|
250
|
-
var _objCnt3 = temp.filter(function (felement) {
|
|
251
|
-
return felement.name.includes('base_door');
|
|
252
|
-
}).length;
|
|
253
|
-
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
254
|
-
return el.name.includes('handle');
|
|
255
|
-
});
|
|
256
|
-
if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
|
|
257
|
-
if (tempData['door_handle_1'] === undefined) {
|
|
258
|
-
tempData['door_handle_1'] = [];
|
|
259
|
-
}
|
|
260
|
-
var _loop = function _loop() {
|
|
261
|
-
var phname = tempPlaceholders[0].name;
|
|
262
|
-
var newph = undefined;
|
|
263
|
-
if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
|
|
264
|
-
newph = tempPlaceholders.find(function (el) {
|
|
265
|
-
return el.name.isRightPlaceholder();
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
if (tempData['base_door_1'][_w].isRightPlaceholder()) {
|
|
269
|
-
newph = tempPlaceholders.find(function (el) {
|
|
270
|
-
return el.name.isLeftPlaceholder();
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
if (newph != undefined) {
|
|
274
|
-
phname = newph.name;
|
|
275
|
-
}
|
|
276
|
-
if (doorPHs === 1 && tempPlaceholders.find(function (el) {
|
|
277
|
-
return el.name.isLeftPlaceholder();
|
|
278
|
-
}) != undefined && tempPlaceholders.find(function (el) {
|
|
279
|
-
return el.name.isRightPlaceholder();
|
|
280
|
-
}) != undefined) {
|
|
281
|
-
has_single_door = true;
|
|
282
|
-
}
|
|
283
|
-
if (!tempData['door_handle_1'].some(function (el) {
|
|
284
|
-
return el === 'door_handle_1/' + phname;
|
|
285
|
-
})) {
|
|
286
|
-
tempData['door_handle_1'].push('base_door_1/' + phname);
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
for (var _w = 0; _w < doorPHs; _w++) {
|
|
290
|
-
_loop();
|
|
291
|
-
}
|
|
292
|
-
} else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
|
|
293
|
-
if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
|
|
294
|
-
var phname = tempPlaceholders[0].name;
|
|
295
|
-
var newph = undefined;
|
|
296
|
-
var blAdd = true;
|
|
297
|
-
if (cabinetPayload.is_corner) {
|
|
298
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
299
|
-
newph = tempPlaceholders.find(function (el) {
|
|
300
|
-
return el.name.isLeftPlaceholder();
|
|
301
|
-
});
|
|
302
|
-
} else {
|
|
303
|
-
blAdd = false;
|
|
304
|
-
}
|
|
305
|
-
} else {
|
|
306
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
307
|
-
newph = tempPlaceholders.find(function (el) {
|
|
308
|
-
return el.name.isRightPlaceholder();
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
312
|
-
newph = tempPlaceholders.find(function (el) {
|
|
313
|
-
return el.name.isLeftPlaceholder();
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if (blAdd) {
|
|
318
|
-
if (newph != undefined) {
|
|
319
|
-
phname = newph.name;
|
|
320
|
-
}
|
|
321
|
-
if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
|
|
322
|
-
return el === t.name + '/' + phname;
|
|
323
|
-
})) {
|
|
324
|
-
tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
} else if (t.name.includes('base_fixed_drawer_door')) {
|
|
329
|
-
var _objCnt4 = temp.filter(function (felement) {
|
|
330
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
331
|
-
}).length;
|
|
332
|
-
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
333
|
-
return el.name.includes('handle');
|
|
334
|
-
});
|
|
335
|
-
if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
|
|
336
|
-
if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
|
|
337
|
-
var _loop2 = function _loop2() {
|
|
338
|
-
var phname = tempPlaceholders[0].name;
|
|
339
|
-
var newph = undefined;
|
|
340
|
-
if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
|
|
341
|
-
newph = tempPlaceholders.find(function (el) {
|
|
342
|
-
return el.name.isRightPlaceholder();
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
|
|
346
|
-
newph = tempPlaceholders.find(function (el) {
|
|
347
|
-
return el.name.isLeftPlaceholder();
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
if (newph != undefined) {
|
|
351
|
-
phname = newph.name;
|
|
352
|
-
}
|
|
353
|
-
if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
|
|
354
|
-
return el === 'fixed_drawer_door_handle_1/' + phname;
|
|
355
|
-
})) {
|
|
356
|
-
tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
|
|
360
|
-
_loop2();
|
|
361
|
-
}
|
|
362
|
-
} else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
|
|
363
|
-
if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
|
|
364
|
-
tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
|
|
365
|
-
}
|
|
366
|
-
var _phname = tempPlaceholders[0].name;
|
|
367
|
-
var _newph = undefined;
|
|
368
|
-
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
369
|
-
_newph = tempPlaceholders.find(function (el) {
|
|
370
|
-
return el.name.isRightPlaceholder();
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
374
|
-
_newph = tempPlaceholders.find(function (el) {
|
|
375
|
-
return el.name.isLeftPlaceholder();
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
if (_newph != undefined) {
|
|
379
|
-
_phname = _newph.name;
|
|
380
|
-
}
|
|
381
|
-
if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
|
|
382
|
-
return el === t.name + '/' + _phname;
|
|
383
|
-
})) {
|
|
384
|
-
tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
tempPlaceholdersData.push({
|
|
391
|
-
id: parseInt(el, 10),
|
|
392
|
-
placeholders: tempData,
|
|
393
|
-
structure: cabinetPayload.structure_json.tempPlaceholders[0].structure
|
|
394
|
-
});
|
|
395
|
-
return _context3.abrupt("return", tempPlaceholdersData);
|
|
396
|
-
case 5:
|
|
397
|
-
case "end":
|
|
398
|
-
return _context3.stop();
|
|
399
|
-
}
|
|
400
|
-
}, _callee3);
|
|
401
|
-
}));
|
|
402
|
-
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
403
|
-
}
|
|
404
|
-
function updateCabinetPayload(_x3) {
|
|
405
|
-
return _updateCabinetPayload.apply(this, arguments);
|
|
406
|
-
}
|
|
407
|
-
function _updateCabinetPayload() {
|
|
408
|
-
_updateCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(cabinetPayload) {
|
|
409
|
-
var tempPlaceholders, cabinetPayloadKeys, i;
|
|
410
|
-
return _regenerator["default"].wrap(function (_context4) {
|
|
411
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
412
|
-
case 0:
|
|
413
|
-
tempPlaceholders = [];
|
|
414
|
-
_context4.next = 1;
|
|
415
|
-
return parseTempPlaceholdersFromCabinetPayload(cabinetPayload);
|
|
416
|
-
case 1:
|
|
417
|
-
tempPlaceholders = _context4.sent;
|
|
418
|
-
cabinetPayloadKeys = Object.keys(cabinetPayload);
|
|
419
|
-
for (i = 0; i < cabinetPayloadKeys.length; i++) {
|
|
420
|
-
if (cabinetPayloadKeys[i] === 'structure_json') {
|
|
421
|
-
cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] = tempPlaceholders[0].placeholders;
|
|
422
|
-
cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] = tempPlaceholders;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
return _context4.abrupt("return", cabinetPayload);
|
|
426
|
-
case 2:
|
|
427
|
-
case "end":
|
|
428
|
-
return _context4.stop();
|
|
429
|
-
}
|
|
430
|
-
}, _callee4);
|
|
431
|
-
}));
|
|
432
|
-
return _updateCabinetPayload.apply(this, arguments);
|
|
433
|
-
}
|
|
434
20
|
var loadSVGsByItem = /*#__PURE__*/function () {
|
|
435
21
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(item) {
|
|
436
22
|
var _parsed$xml$viewBox, _parsed$xml$viewBox2, response, svgText, loader, parsed, _t;
|
|
@@ -454,7 +40,7 @@ var loadSVGsByItem = /*#__PURE__*/function () {
|
|
|
454
40
|
return response.text();
|
|
455
41
|
case 3:
|
|
456
42
|
svgText = _context.sent;
|
|
457
|
-
loader = new
|
|
43
|
+
loader = new SVGLoader();
|
|
458
44
|
parsed = loader.parse(svgText);
|
|
459
45
|
if (!(0, _helper.isEmpty)(parsed.paths)) {
|
|
460
46
|
_context.next = 4;
|
|
@@ -479,1000 +65,171 @@ var loadSVGsByItem = /*#__PURE__*/function () {
|
|
|
479
65
|
}
|
|
480
66
|
}, _callee, null, [[1, 5]]);
|
|
481
67
|
}));
|
|
482
|
-
return function loadSVGsByItem(
|
|
68
|
+
return function loadSVGsByItem(_x) {
|
|
483
69
|
return _ref.apply(this, arguments);
|
|
484
70
|
};
|
|
485
71
|
}();
|
|
486
|
-
|
|
487
|
-
return
|
|
488
|
-
}
|
|
489
|
-
function
|
|
490
|
-
_addItemToCatalog = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(element, state, catalogInstance, projectActions) {
|
|
491
|
-
var _element, _element2;
|
|
492
|
-
var elementJs, catalog, outlineSVGData, _element$structure_js, _element$structure_js2, _element$structure_js3, updatedStructureJson;
|
|
493
|
-
return _regenerator["default"].wrap(function (_context5) {
|
|
494
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
495
|
-
case 0:
|
|
496
|
-
if (!(0, _helper.isEmpty)((_element = element) === null || _element === void 0 ? void 0 : _element.name)) {
|
|
497
|
-
_context5.next = 1;
|
|
498
|
-
break;
|
|
499
|
-
}
|
|
500
|
-
return _context5.abrupt("return");
|
|
501
|
-
case 1:
|
|
502
|
-
elementJs = element;
|
|
503
|
-
catalog = state.getIn(['catalog']).toJS(); // add item to catalog of state
|
|
504
|
-
// if (isEmpty(catalog?.elements[element.name])) {
|
|
505
|
-
_context5.next = 2;
|
|
506
|
-
return loadSVGsByItem(element);
|
|
507
|
-
case 2:
|
|
508
|
-
outlineSVGData = _context5.sent;
|
|
509
|
-
if (!(((_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.type) === 'cabinet')) {
|
|
510
|
-
_context5.next = 4;
|
|
511
|
-
break;
|
|
512
|
-
}
|
|
513
|
-
// make placeholders of element and tempPlaceholder
|
|
514
|
-
updatedStructureJson = _objectSpread(_objectSpread({}, element.structure_json), (_element$structure_js = (_element$structure_js2 = element.structure_json) === null || _element$structure_js2 === void 0 || (_element$structure_js2 = _element$structure_js2.tempPlaceholders[0]) === null || _element$structure_js2 === void 0 ? void 0 : _element$structure_js2.structure) !== null && _element$structure_js !== void 0 ? _element$structure_js : {});
|
|
515
|
-
element.structure_json = updatedStructureJson;
|
|
516
|
-
element = _objectSpread(_objectSpread({}, element), {}, {
|
|
517
|
-
cds: {
|
|
518
|
-
data: [_objectSpread({}, element.customer_property)],
|
|
519
|
-
itemID: element.itemID
|
|
520
|
-
}
|
|
521
|
-
});
|
|
522
|
-
if ((0, _helper.isEmpty)((_element$structure_js3 = element.structure_json) === null || _element$structure_js3 === void 0 ? void 0 : _element$structure_js3.tempPlaceholders)) {
|
|
523
|
-
_context5.next = 4;
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
_context5.next = 3;
|
|
527
|
-
return updateCabinetPayload(element);
|
|
528
|
-
case 3:
|
|
529
|
-
elementJs = _context5.sent;
|
|
530
|
-
case 4:
|
|
531
|
-
elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
|
|
532
|
-
outlineSVGData: outlineSVGData,
|
|
533
|
-
type: element.type,
|
|
534
|
-
render2DItem: _itemLoader.render2DItem
|
|
535
|
-
});
|
|
536
|
-
if (element.type === 'appliance' || element.type === 'furnishing') elementJs.render3DItem = _itemLoader.render3DApplianceItem;else if (element.type === 'lighting') elementJs.render3DItem = _itemLoader.render3DLightingItem;else elementJs.render3DItem = _itemLoader.render3DItem;
|
|
537
|
-
elementJs = (0, _exporter["default"])(elementJs);
|
|
538
|
-
if (catalogInstance !== null && catalogInstance !== void 0 && catalogInstance.validateElement(elementJs)) {
|
|
539
|
-
catalogInstance.registerElement(elementJs);
|
|
540
|
-
projectActions.addElementToCatalog(elementJs);
|
|
541
|
-
}
|
|
542
|
-
// }
|
|
543
|
-
case 5:
|
|
544
|
-
case "end":
|
|
545
|
-
return _context5.stop();
|
|
546
|
-
}
|
|
547
|
-
}, _callee5);
|
|
548
|
-
}));
|
|
549
|
-
return _addItemToCatalog.apply(this, arguments);
|
|
550
|
-
}
|
|
551
|
-
function initAttrData(element, layer, state) {
|
|
552
|
-
element = (0, _typeof2["default"])(element.misc) === 'object' ? element.set('misc', new _immutable.Map(element.misc)) : element;
|
|
553
|
-
switch (element.prototype) {
|
|
554
|
-
case 'items':
|
|
555
|
-
{
|
|
556
|
-
return new _immutable.Map(element);
|
|
557
|
-
}
|
|
558
|
-
case 'lines':
|
|
559
|
-
{
|
|
560
|
-
var v_a = layer.vertices.get(element.vertices.get(0));
|
|
561
|
-
var v_b = layer.vertices.get(element.vertices.get(1));
|
|
562
|
-
var distance = _export.GeometryUtils.pointsDistance(v_a.x, v_a.y, v_b.x, v_b.y);
|
|
563
|
-
var _unit = element.misc.get('_unitLength') || _constants.UNIT_INCH;
|
|
564
|
-
var _length = (0, _convertUnitsLite.convert)(distance).from(_constants.UNIT_CENTIMETER).to(_unit);
|
|
565
|
-
if (state.mode == _constants.MODE_DRAWING_LINE) {
|
|
566
|
-
return new _immutable.Map({
|
|
567
|
-
vertexOne: v_a,
|
|
568
|
-
vertexTwo: v_b,
|
|
569
|
-
lineLength: new _immutable.Map({
|
|
570
|
-
length: distance,
|
|
571
|
-
_length: _length,
|
|
572
|
-
_unit: _unit
|
|
573
|
-
}),
|
|
574
|
-
focus: element.focus
|
|
575
|
-
});
|
|
576
|
-
} else {
|
|
577
|
-
var allLines = layer.lines.toArray();
|
|
578
|
-
var relatedLine = allLines.filter(function (line) {
|
|
579
|
-
return line.vertices.toArray().includes(v_b.id) && line.id != element.id;
|
|
580
|
-
})[0];
|
|
581
|
-
var relatedVertexID = relatedLine && (relatedLine.vertices.toArray()[0] == v_b.id ? relatedLine.vertices.toArray()[1] : relatedLine.vertices.toArray()[0]);
|
|
582
|
-
var v_d = relatedVertexID && layer.getIn(['vertices', relatedVertexID]);
|
|
583
|
-
var lineToExtend = relatedVertexID && allLines.filter(function (line) {
|
|
584
|
-
return line.vertices.toArray().includes(relatedVertexID) && line.id != relatedLine.id;
|
|
585
|
-
})[0];
|
|
586
|
-
var v_c = lineToExtend && layer.getIn(['vertices', lineToExtend.vertices.toArray()[0] == v_d.id ? lineToExtend.vertices.toArray()[1] : lineToExtend.vertices.toArray()[0]]);
|
|
587
|
-
return new _immutable.Map({
|
|
588
|
-
vertexOne: v_a,
|
|
589
|
-
vertexTwo: v_b,
|
|
590
|
-
vertexThree: v_c,
|
|
591
|
-
vertexFour: v_d,
|
|
592
|
-
lineToExtend: lineToExtend,
|
|
593
|
-
lineLength: new _immutable.Map({
|
|
594
|
-
length: distance,
|
|
595
|
-
_length: _length,
|
|
596
|
-
_unit: _unit
|
|
597
|
-
}),
|
|
598
|
-
focus: element.focus
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
case 'holes':
|
|
603
|
-
{
|
|
604
|
-
var line = layer.lines.get(element.line);
|
|
605
|
-
var _layer$vertices$get = layer.vertices.get(line.vertices.get(0)),
|
|
606
|
-
x0 = _layer$vertices$get.x,
|
|
607
|
-
y0 = _layer$vertices$get.y;
|
|
608
|
-
var _layer$vertices$get2 = layer.vertices.get(line.vertices.get(1)),
|
|
609
|
-
x1 = _layer$vertices$get2.x,
|
|
610
|
-
y1 = _layer$vertices$get2.y;
|
|
611
|
-
var lineLength = _export.GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
612
|
-
var startAt = lineLength * element.offset - element.properties.get('width').get('length') / 2;
|
|
613
|
-
var endAt = lineLength - lineLength * element.offset - element.properties.get('width').get('length') / 2;
|
|
614
|
-
var _unitA = element.misc.get('_unitA') || _constants.UNIT_INCH;
|
|
615
|
-
var _lengthA = (0, _convertUnitsLite.convert)(x0 > x1 ? endAt : startAt).from(_constants.UNIT_CENTIMETER).to(_unitA);
|
|
616
|
-
var _unitB = element.misc.get('_unitB') || _constants.UNIT_INCH;
|
|
617
|
-
var _lengthB = (0, _convertUnitsLite.convert)(x0 > x1 ? startAt : endAt).from(_constants.UNIT_CENTIMETER).to(_unitB);
|
|
618
|
-
return new _immutable.Map({
|
|
619
|
-
offset: element.offset,
|
|
620
|
-
offsetA: new _immutable.Map({
|
|
621
|
-
length: _export.MathUtils.toFixedFloat(x0 > x1 ? endAt : startAt, PRECISION),
|
|
622
|
-
_length: _export.MathUtils.toFixedFloat(_lengthA, PRECISION),
|
|
623
|
-
_unit: _unitA
|
|
624
|
-
}),
|
|
625
|
-
offsetB: new _immutable.Map({
|
|
626
|
-
length: _export.MathUtils.toFixedFloat(x0 > x1 ? startAt : endAt, PRECISION),
|
|
627
|
-
_length: _export.MathUtils.toFixedFloat(_lengthB, PRECISION),
|
|
628
|
-
_unit: _unitB
|
|
629
|
-
})
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
case 'areas':
|
|
633
|
-
{
|
|
634
|
-
return new _immutable.Map({});
|
|
635
|
-
}
|
|
636
|
-
default:
|
|
637
|
-
return null;
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
// Get properties of current selected element
|
|
641
|
-
function initPropData(element, catalog) {
|
|
642
|
-
var mapped = {};
|
|
643
|
-
if (!catalog.elements.hasOwnProperty(element.type) && !(!catalog.elements[element.type] && !!catalog.elements[(0, _utils.returnReplaceableDeepSearchType)(element.type)])) {
|
|
644
|
-
console.log("Last Selected ".concat(element.type, " Element does not exist in catalog."));
|
|
645
|
-
return new _immutable.Map(mapped);
|
|
646
|
-
}
|
|
647
|
-
var catalogElement = catalog.getElement(element.type);
|
|
648
|
-
var isFiller = catalogElement.long_name ? catalogElement.long_name.toUpperCase().includes('FILLER') : false;
|
|
649
|
-
if (isFiller) {
|
|
650
|
-
var height = {
|
|
651
|
-
defaultValue: element.properties.get('height').toJS(),
|
|
652
|
-
label: 'Height',
|
|
653
|
-
type: 'length-measure'
|
|
654
|
-
};
|
|
655
|
-
var depth = {
|
|
656
|
-
defaultValue: element.properties.get('depth').toJS(),
|
|
657
|
-
label: 'Depth',
|
|
658
|
-
type: 'length-measure'
|
|
659
|
-
};
|
|
660
|
-
catalogElement.properties = {
|
|
661
|
-
altitude: catalogElement.properties.altitude,
|
|
662
|
-
width: catalogElement.properties.width,
|
|
663
|
-
height: height,
|
|
664
|
-
depth: depth,
|
|
665
|
-
flip_doorhandle: catalogElement.properties.flip_doorhandle,
|
|
666
|
-
resize_and_scaling: catalogElement.properties.resize_and_scaling
|
|
667
|
-
};
|
|
668
|
-
}
|
|
669
|
-
for (var name in catalogElement.properties) {
|
|
670
|
-
mapped[name] = new _immutable.Map({
|
|
671
|
-
currentValue: element.properties.has(name) ? element.properties.get(name) : fromJS(catalogElement.properties[name].defaultValue),
|
|
672
|
-
configs: catalogElement.properties[name]
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
return new _immutable.Map(mapped);
|
|
676
|
-
}
|
|
677
|
-
function updateAttributeOfSelectedElement(element, attrPayload, state, layer, catalog, projectActions) {
|
|
678
|
-
var _attributesFormData;
|
|
679
|
-
var callback = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
680
|
-
var attributesFormData = initAttrData(element, layer, state);
|
|
681
|
-
var value = attrPayload.value;
|
|
682
|
-
var attributeName = attrPayload.attributeName;
|
|
683
|
-
// pre process
|
|
684
|
-
if (attributeName === _constants.ATT_ITEM_POS) {
|
|
685
|
-
// calculate the new position of movement
|
|
686
|
-
var rotRad = (value.directionAng + element.rotation) / 180 * Math.PI;
|
|
687
|
-
var newX = element.x + (0, _convertUnitsLite.convert)((value.oldDistance - value.newDistance) * Math.cos(rotRad)).from('in').to('cm');
|
|
688
|
-
var newY = element.y + (0, _convertUnitsLite.convert)((value.oldDistance - value.newDistance) * Math.sin(rotRad)).from('in').to('cm');
|
|
689
|
-
// const reversedDirection =
|
|
690
|
-
// value.directionAng === LEFT_DIST_ANG
|
|
691
|
-
// ? RIGHT_DIST_ANG
|
|
692
|
-
// : value.directionAng === RIGHT_DIST_ANG
|
|
693
|
-
// ? LEFT_DIST_ANG
|
|
694
|
-
// : value.directionAng === BACK_DIST_ANG
|
|
695
|
-
// ? FRONT_DIST_ANG
|
|
696
|
-
// : BACK_DIST_ANG;
|
|
697
|
-
// let dist = convert(
|
|
698
|
-
// element.distArray?.find(v => v[1] === reversedDirection)
|
|
699
|
-
// ? element.distArray?.find(v => v[1] === reversedDirection)[0]
|
|
700
|
-
// : 0
|
|
701
|
-
// )
|
|
702
|
-
// .from('cm')
|
|
703
|
-
// .to('in');
|
|
704
|
-
// if (dist + (value.oldDistance - value.newDistance) <= 0 || value.newDistance < 0) {
|
|
705
|
-
// // confirm "The item will be placed outside the floor plan. Are you sure?"
|
|
706
|
-
// setPopupOpen(true);
|
|
707
|
-
// return;
|
|
708
|
-
// }
|
|
709
|
-
value = {
|
|
710
|
-
x: newX,
|
|
711
|
-
y: newY
|
|
712
|
-
};
|
|
713
|
-
} else if (attributeName === _constants.ATT_LINE_LENGTH || attributeName === _constants.ATT_HOLE_OFFSET_A || attributeName === _constants.ATT_HOLE_OFFSET_B) {
|
|
714
|
-
var att = attributesFormData.has(attributeName) ? attributesFormData.get(attributeName) : element[attributeName];
|
|
715
|
-
if (att) value = att.merge({
|
|
716
|
-
_length: value,
|
|
717
|
-
_unit: _constants.UNIT_INCH,
|
|
718
|
-
length: (0, _convertUnitsLite.convert)(value).from(_constants.UNIT_INCH).to(_constants.UNIT_CENTIMETER)
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
// make the new attrivutes
|
|
722
|
-
switch (element.prototype) {
|
|
723
|
-
case 'items':
|
|
724
|
-
{
|
|
725
|
-
if (attributeName == _constants.ATT_ITEM_POS) {
|
|
726
|
-
var xVal = value.x;
|
|
727
|
-
var yVal = value.y;
|
|
728
|
-
attributesFormData = attributesFormData.set('x', xVal);
|
|
729
|
-
attributesFormData = attributesFormData.set('y', yVal);
|
|
730
|
-
} else {
|
|
731
|
-
attributesFormData = attributesFormData.set(attributeName, value);
|
|
732
|
-
// update the distances from wall
|
|
733
|
-
var _GeometryUtils$calcDi = _export.GeometryUtils.calcDistancesFromItemToWalls(attributesFormData, layer),
|
|
734
|
-
PointArray = _GeometryUtils$calcDi.PointArray;
|
|
735
|
-
attributesFormData = attributesFormData.set('distArray', PointArray);
|
|
736
|
-
}
|
|
737
|
-
break;
|
|
738
|
-
}
|
|
739
|
-
case 'lines':
|
|
740
|
-
{
|
|
741
|
-
switch (attributeName) {
|
|
742
|
-
case _constants.ATT_LINE_LENGTH:
|
|
743
|
-
{
|
|
744
|
-
var v_0 = attributesFormData.get('vertexOne');
|
|
745
|
-
var v_1 = attributesFormData.get('vertexTwo');
|
|
746
|
-
var v_b_new = _export.GeometryUtils.extendLine(v_0.x, v_0.y, v_1.x, v_1.y, value.get('length'), PRECISION);
|
|
747
|
-
attributesFormData = attributesFormData.withMutations(function (attr) {
|
|
748
|
-
attr.set('vertexTwo', v_1.merge(v_b_new));
|
|
749
|
-
attr.set('lineLength', value);
|
|
750
|
-
});
|
|
751
|
-
break;
|
|
752
|
-
}
|
|
753
|
-
case _constants.ATT_VERTEXT_ONE:
|
|
754
|
-
case _constants.ATT_VERTEXT_TWO:
|
|
755
|
-
{
|
|
756
|
-
attributesFormData = attributesFormData.withMutations(function (attr) {
|
|
757
|
-
attr.set(attributeName, attr.get(attributeName).merge(value));
|
|
758
|
-
var newDistance = _export.GeometryUtils.verticesDistance(attr.get('vertexOne'), attr.get('vertexTwo'));
|
|
759
|
-
attr.mergeIn(['lineLength'], attr.get('lineLength').merge({
|
|
760
|
-
length: newDistance,
|
|
761
|
-
_length: (0, _convertUnitsLite.convert)(newDistance).from(_constants.UNIT_CENTIMETER).to(attr.get('lineLength').get('_unit'))
|
|
762
|
-
}));
|
|
763
|
-
});
|
|
764
|
-
break;
|
|
765
|
-
}
|
|
766
|
-
default:
|
|
767
|
-
{
|
|
768
|
-
attributesFormData = attributesFormData.set(attributeName, value);
|
|
769
|
-
break;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
break;
|
|
773
|
-
}
|
|
774
|
-
case 'holes':
|
|
775
|
-
{
|
|
776
|
-
switch (attributeName) {
|
|
777
|
-
case _constants.ATT_HOLE_OFFSET_A:
|
|
778
|
-
{
|
|
779
|
-
var line = layer.lines.get(element.line);
|
|
780
|
-
var _layer$vertices$get3 = layer.vertices.get(line.vertices.get(0)),
|
|
781
|
-
x0 = _layer$vertices$get3.x,
|
|
782
|
-
y0 = _layer$vertices$get3.y;
|
|
783
|
-
var _layer$vertices$get4 = layer.vertices.get(line.vertices.get(1)),
|
|
784
|
-
x1 = _layer$vertices$get4.x,
|
|
785
|
-
y1 = _layer$vertices$get4.y;
|
|
786
|
-
var alpha = _export.GeometryUtils.angleBetweenTwoPoints(x0, y0, x1, y1);
|
|
787
|
-
var lineLength = _export.GeometryUtils.pointsDistance(x0, y0, x1, y1);
|
|
788
|
-
var widthLength = element.properties.get('width').get('length');
|
|
789
|
-
var halfWidthLength = widthLength / 2;
|
|
790
|
-
var lengthValue = value.get('length');
|
|
791
|
-
lengthValue = Math.max(lengthValue, 0);
|
|
792
|
-
lengthValue = Math.min(lengthValue, lineLength - widthLength);
|
|
793
|
-
var xp = (lengthValue + halfWidthLength) * Math.cos(alpha) + x0;
|
|
794
|
-
var yp = (lengthValue + halfWidthLength) * Math.sin(alpha) + y0;
|
|
795
|
-
var offset = _export.GeometryUtils.pointPositionOnLineSegment(x0, y0, x1, y1, xp, yp);
|
|
796
|
-
/*
|
|
797
|
-
if (x0 > x1) offset = 1 - offset;
|
|
798
|
-
*/
|
|
799
|
-
var endAt = _export.MathUtils.toFixedFloat(lineLength - lineLength * offset - halfWidthLength, PRECISION);
|
|
800
|
-
var offsetUnit = attributesFormData.getIn(['offsetB', '_unit']);
|
|
801
|
-
var offsetB = new _immutable.Map({
|
|
802
|
-
length: endAt,
|
|
803
|
-
_length: (0, _convertUnitsLite.convert)(endAt).from(_constants.UNIT_CENTIMETER).to(offsetUnit),
|
|
804
|
-
_unit: offsetUnit
|
|
805
|
-
});
|
|
806
|
-
attributesFormData = attributesFormData.set('offsetB', offsetB).set('offset', offset);
|
|
807
|
-
var offsetAttribute = new _immutable.Map({
|
|
808
|
-
length: _export.MathUtils.toFixedFloat(lengthValue, PRECISION),
|
|
809
|
-
_unit: value.get('_unit'),
|
|
810
|
-
_length: _export.MathUtils.toFixedFloat((0, _convertUnitsLite.convert)(lengthValue).from(_constants.UNIT_CENTIMETER).to(value.get('_unit')), PRECISION)
|
|
811
|
-
});
|
|
812
|
-
attributesFormData = attributesFormData.set(attributeName, offsetAttribute);
|
|
813
|
-
break;
|
|
814
|
-
}
|
|
815
|
-
case _constants.ATT_HOLE_OFFSET_B:
|
|
816
|
-
{
|
|
817
|
-
var _line = layer.lines.get(element.line);
|
|
818
|
-
var _layer$vertices$get5 = layer.vertices.get(_line.vertices.get(0)),
|
|
819
|
-
_x9 = _layer$vertices$get5.x,
|
|
820
|
-
_y = _layer$vertices$get5.y;
|
|
821
|
-
var _layer$vertices$get6 = layer.vertices.get(_line.vertices.get(1)),
|
|
822
|
-
_x0 = _layer$vertices$get6.x,
|
|
823
|
-
_y2 = _layer$vertices$get6.y;
|
|
824
|
-
var _alpha = _export.GeometryUtils.angleBetweenTwoPoints(_x9, _y, _x0, _y2);
|
|
825
|
-
var _lineLength = _export.GeometryUtils.pointsDistance(_x9, _y, _x0, _y2);
|
|
826
|
-
var _widthLength = element.properties.get('width').get('length');
|
|
827
|
-
var _halfWidthLength = _widthLength / 2;
|
|
828
|
-
var _lengthValue = value.get('length');
|
|
829
|
-
_lengthValue = Math.max(_lengthValue, 0);
|
|
830
|
-
_lengthValue = Math.min(_lengthValue, _lineLength - _widthLength);
|
|
831
|
-
var _xp = _x0 - (_lengthValue + _halfWidthLength) * Math.cos(_alpha);
|
|
832
|
-
var _yp = _y2 - (_lengthValue + _halfWidthLength) * Math.sin(_alpha);
|
|
833
|
-
var _offset = _export.GeometryUtils.pointPositionOnLineSegment(_x9, _y, _x0, _y2, _xp, _yp);
|
|
834
|
-
/*
|
|
835
|
-
if (x0 > x1) offset = 1 - offset;
|
|
836
|
-
*/
|
|
837
|
-
var startAt = _export.MathUtils.toFixedFloat(_lineLength * _offset - _halfWidthLength, PRECISION);
|
|
838
|
-
var _offsetUnit = attributesFormData.getIn(['offsetA', '_unit']);
|
|
839
|
-
var offsetA = new _immutable.Map({
|
|
840
|
-
length: startAt,
|
|
841
|
-
_length: (0, _convertUnitsLite.convert)(startAt).from(_constants.UNIT_CENTIMETER).to(_offsetUnit),
|
|
842
|
-
_unit: _offsetUnit
|
|
843
|
-
});
|
|
844
|
-
attributesFormData = attributesFormData.set('offsetA', offsetA).set('offset', _offset);
|
|
845
|
-
var _offsetAttribute = new _immutable.Map({
|
|
846
|
-
length: _export.MathUtils.toFixedFloat(_lengthValue, PRECISION),
|
|
847
|
-
_unit: value.get('_unit'),
|
|
848
|
-
_length: _export.MathUtils.toFixedFloat((0, _convertUnitsLite.convert)(_lengthValue).from(_constants.UNIT_CENTIMETER).to(value.get('_unit')), PRECISION)
|
|
849
|
-
});
|
|
850
|
-
attributesFormData = attributesFormData.set(attributeName, _offsetAttribute);
|
|
851
|
-
break;
|
|
852
|
-
}
|
|
853
|
-
default:
|
|
854
|
-
{
|
|
855
|
-
attributesFormData = attributesFormData.set(attributeName, value);
|
|
856
|
-
break;
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
break;
|
|
860
|
-
}
|
|
861
|
-
default:
|
|
862
|
-
break;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
// update attribute action
|
|
866
|
-
switch (element.prototype) {
|
|
867
|
-
case 'items':
|
|
868
|
-
{
|
|
869
|
-
projectActions.setItemsAttributes(attributesFormData);
|
|
870
|
-
break;
|
|
871
|
-
}
|
|
872
|
-
case 'lines':
|
|
873
|
-
{
|
|
874
|
-
projectActions.setLinesAttributes(attributesFormData);
|
|
875
|
-
break;
|
|
876
|
-
}
|
|
877
|
-
case 'holes':
|
|
878
|
-
{
|
|
879
|
-
projectActions.setHolesAttributes(attributesFormData);
|
|
880
|
-
break;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
// invoke callback
|
|
885
|
-
if (callback) callback((_attributesFormData = attributesFormData) === null || _attributesFormData === void 0 ? void 0 : _attributesFormData.toJS());
|
|
886
|
-
}
|
|
887
|
-
function updatePropertyOfSelectedElement(element, propertyPayload, catalog,
|
|
888
|
-
// class instance of Catalog, get from props
|
|
889
|
-
projectActions) {
|
|
890
|
-
var _propertiesFormData;
|
|
891
|
-
var callback = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
892
|
-
var propertiesFormData = initPropData(element, catalog);
|
|
893
|
-
var value = propertyPayload.value;
|
|
894
|
-
var propertyName = propertyPayload.propertyName;
|
|
895
|
-
// make new properties
|
|
896
|
-
if (propertyName === _constants.PROP_FLIP_DOOR_HANDLE && element.properties.get(_constants.PROP_OPEN_DOORS)) {
|
|
897
|
-
alert('Doors are already open.');
|
|
898
|
-
return;
|
|
899
|
-
}
|
|
900
|
-
propertiesFormData = propertiesFormData.setIn([propertyName, 'currentValue'], value);
|
|
901
|
-
|
|
902
|
-
// update property action
|
|
903
|
-
if (propertiesFormData) {
|
|
904
|
-
var properties = propertiesFormData.map(function (data) {
|
|
905
|
-
return data.get('currentValue');
|
|
906
|
-
});
|
|
907
|
-
projectActions.setProperties(properties);
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
// invoke callback
|
|
911
|
-
if (callback) callback((_propertiesFormData = propertiesFormData) === null || _propertiesFormData === void 0 ? void 0 : _propertiesFormData.toJS());
|
|
912
|
-
}
|
|
913
|
-
function getElement(objProps, state) {
|
|
914
|
-
var layerID = state.scene.selectedLayer;
|
|
915
|
-
var curObject = null;
|
|
916
|
-
if (!(0, _helper.isEmpty)(objProps === null || objProps === void 0 ? void 0 : objProps.elementPrototype) && !(0, _helper.isEmpty)(objProps === null || objProps === void 0 ? void 0 : objProps.elementId)) curObject = state.getIn(['scene', 'layers', layerID, objProps.elementPrototype, objProps.elementId]);else {
|
|
917
|
-
// if no specified object property then get the first selected element
|
|
918
|
-
var layer = state.scene.layers.get(state.scene.selectedLayer);
|
|
919
|
-
var selected = [];
|
|
920
|
-
layer.selected.forEach(function (data, prototype) {
|
|
921
|
-
if (prototype == 'vertices') return;
|
|
922
|
-
if (data.size > 0) {
|
|
923
|
-
var values = data.toJS();
|
|
924
|
-
for (var i = 0; i < values.length; i++) {
|
|
925
|
-
selected.push({
|
|
926
|
-
type: prototype,
|
|
927
|
-
id: values[i]
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
});
|
|
932
|
-
if (selected.length === 1) {
|
|
933
|
-
var selData = selected[0];
|
|
934
|
-
switch (selData.type) {
|
|
935
|
-
case _constants.ELEMENT_HOLE:
|
|
936
|
-
curObject = layer.holes.get(selData.id);
|
|
937
|
-
break;
|
|
938
|
-
case _constants.ELEMENT_ITEM:
|
|
939
|
-
curObject = layer.items.get(selData.id);
|
|
940
|
-
break;
|
|
941
|
-
case _constants.ELEMENT_LINE:
|
|
942
|
-
curObject = layer.lines.get(selData.id);
|
|
943
|
-
break;
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
return curObject;
|
|
948
|
-
}
|
|
949
|
-
function loadMoldingSvg(_x1) {
|
|
950
|
-
return _loadMoldingSvg.apply(this, arguments);
|
|
951
|
-
}
|
|
952
|
-
function _loadMoldingSvg() {
|
|
953
|
-
_loadMoldingSvg = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(molding) {
|
|
954
|
-
return _regenerator["default"].wrap(function (_context6) {
|
|
955
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
956
|
-
case 0:
|
|
957
|
-
return _context6.abrupt("return", new Promise(function (resolve, reject) {
|
|
958
|
-
var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
|
|
959
|
-
if (!url) {
|
|
960
|
-
// Skip if no SVG URL available
|
|
961
|
-
return resolve();
|
|
962
|
-
}
|
|
963
|
-
var loader = new _SVGLoader.SVGLoader();
|
|
964
|
-
loader.load(url, function (data) {
|
|
965
|
-
var _data$xml$viewBox$ani, _data$xml, _data$xml$viewBox$ani2, _data$xml2;
|
|
966
|
-
molding.data = {
|
|
967
|
-
paths: data.paths,
|
|
968
|
-
svg_width: (_data$xml$viewBox$ani = (_data$xml = data.xml) === null || _data$xml === void 0 || (_data$xml = _data$xml.viewBox) === null || _data$xml === void 0 || (_data$xml = _data$xml.animVal) === null || _data$xml === void 0 ? void 0 : _data$xml.width) !== null && _data$xml$viewBox$ani !== void 0 ? _data$xml$viewBox$ani : 0,
|
|
969
|
-
svg_height: (_data$xml$viewBox$ani2 = (_data$xml2 = data.xml) === null || _data$xml2 === void 0 || (_data$xml2 = _data$xml2.viewBox) === null || _data$xml2 === void 0 || (_data$xml2 = _data$xml2.animVal) === null || _data$xml2 === void 0 ? void 0 : _data$xml2.height) !== null && _data$xml$viewBox$ani2 !== void 0 ? _data$xml$viewBox$ani2 : 0
|
|
970
|
-
};
|
|
971
|
-
resolve();
|
|
972
|
-
}, null, function (error) {
|
|
973
|
-
console.error(error);
|
|
974
|
-
reject(error);
|
|
975
|
-
});
|
|
976
|
-
}));
|
|
977
|
-
case 1:
|
|
978
|
-
case "end":
|
|
979
|
-
return _context6.stop();
|
|
980
|
-
}
|
|
981
|
-
}, _callee6);
|
|
982
|
-
}));
|
|
983
|
-
return _loadMoldingSvg.apply(this, arguments);
|
|
984
|
-
}
|
|
985
|
-
function setFinishing(props, state, payload) {
|
|
986
|
-
switch (payload.category) {
|
|
987
|
-
case _constants.FINISHING_TYPE.WALL_COLOR:
|
|
988
|
-
if (state.mode !== _constants.MODE_ELEVATION_VIEW) props.itemsActions.setWallColor(payload.color);
|
|
989
|
-
break;
|
|
990
|
-
case _constants.FINISHING_TYPE.COUNTER_TOP:
|
|
991
|
-
props.itemsActions.setCounterTop({
|
|
992
|
-
uri: payload.texture
|
|
993
|
-
});
|
|
994
|
-
break;
|
|
995
|
-
case _constants.FINISHING_TYPE.FLOOR_STYLE:
|
|
996
|
-
if (state.mode !== _constants.MODE_ELEVATION_VIEW) props.areaActions.setFloorStyles({
|
|
997
|
-
uri: payload.texture
|
|
998
|
-
});
|
|
999
|
-
break;
|
|
1000
|
-
case _constants.FINISHING_TYPE.BACKSPLASH:
|
|
1001
|
-
if (state.mode !== _constants.MODE_ELEVATION_VIEW) props.itemsActions.setBacksplash({
|
|
1002
|
-
uri: payload.texture
|
|
1003
|
-
});
|
|
1004
|
-
break;
|
|
1005
|
-
case _constants.FINISHING_TYPE.DOOR_HANDLE:
|
|
1006
|
-
props.itemsActions.setDoorHandle(payload.gltf);
|
|
1007
|
-
break;
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
function moveAndRotatePan2D3D(eventType, props, payload, state) {
|
|
1011
|
-
if (eventType === _constants.EXTERNAL_EVENT_MOVE_PAN) {
|
|
1012
|
-
var moveType = payload.moveType,
|
|
1013
|
-
moveValue = payload.moveValue;
|
|
1014
|
-
var value = state.getIn(['viewer2D']).toJS();
|
|
1015
|
-
if (state.mode === _constants.MODE_IDLE) {
|
|
1016
|
-
switch (moveType) {
|
|
1017
|
-
case _constants.TOP:
|
|
1018
|
-
value.f -= moveValue;
|
|
1019
|
-
break;
|
|
1020
|
-
case _constants.BOTTOM:
|
|
1021
|
-
value.f += moveValue;
|
|
1022
|
-
break;
|
|
1023
|
-
case _constants.RIGHT:
|
|
1024
|
-
value.e += moveValue;
|
|
1025
|
-
break;
|
|
1026
|
-
case _constants.LEFT:
|
|
1027
|
-
value.e -= moveValue;
|
|
1028
|
-
break;
|
|
1029
|
-
}
|
|
1030
|
-
(0, _helper.updateViwer2D)(value, props.viewer2DActions);
|
|
1031
|
-
} else if (state.mode === _constants.MODE_IDLE_3D) {
|
|
1032
|
-
switch (moveType) {
|
|
1033
|
-
case _constants.TOP:
|
|
1034
|
-
window.interval = setTimeout(function () {
|
|
1035
|
-
window.tDKeyDown({
|
|
1036
|
-
keyCode: 38
|
|
1037
|
-
});
|
|
1038
|
-
}, 50);
|
|
1039
|
-
break;
|
|
1040
|
-
case _constants.BOTTOM:
|
|
1041
|
-
window.interval = setTimeout(function () {
|
|
1042
|
-
window.tDKeyDown({
|
|
1043
|
-
keyCode: 40
|
|
1044
|
-
});
|
|
1045
|
-
}, 50);
|
|
1046
|
-
break;
|
|
1047
|
-
case _constants.RIGHT:
|
|
1048
|
-
window.interval = setTimeout(function () {
|
|
1049
|
-
window.tDKeyDown({
|
|
1050
|
-
keyCode: 37
|
|
1051
|
-
});
|
|
1052
|
-
}, 50);
|
|
1053
|
-
break;
|
|
1054
|
-
case _constants.LEFT:
|
|
1055
|
-
window.interval = setTimeout(function () {
|
|
1056
|
-
window.tDKeyDown({
|
|
1057
|
-
keyCode: 39
|
|
1058
|
-
});
|
|
1059
|
-
}, 50);
|
|
1060
|
-
break;
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
} else if (eventType === _constants.EXTERNAL_EVENT_ROTATE_PAN) {
|
|
1064
|
-
var rotateType = payload.rotateType;
|
|
1065
|
-
switch (rotateType) {
|
|
1066
|
-
case _constants.TOP:
|
|
1067
|
-
window.interval = setTimeout(function () {
|
|
1068
|
-
window.SPKeyDown({
|
|
1069
|
-
keyCode: 87
|
|
1070
|
-
});
|
|
1071
|
-
}, 50);
|
|
1072
|
-
break;
|
|
1073
|
-
case _constants.BOTTOM:
|
|
1074
|
-
window.interval = setTimeout(function () {
|
|
1075
|
-
window.SPKeyDown({
|
|
1076
|
-
keyCode: 83
|
|
1077
|
-
});
|
|
1078
|
-
}, 50);
|
|
1079
|
-
break;
|
|
1080
|
-
case _constants.RIGHT:
|
|
1081
|
-
window.interval = setTimeout(function () {
|
|
1082
|
-
window.SPKeyDown({
|
|
1083
|
-
keyCode: 68
|
|
1084
|
-
});
|
|
1085
|
-
}, 50);
|
|
1086
|
-
break;
|
|
1087
|
-
case _constants.LEFT:
|
|
1088
|
-
window.interval = setTimeout(function () {
|
|
1089
|
-
window.SPKeyDown({
|
|
1090
|
-
keyCode: 65
|
|
1091
|
-
});
|
|
1092
|
-
}, 50);
|
|
1093
|
-
break;
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
function handleExternalEvent(_x10) {
|
|
72
|
+
var compareSVGRect = function compareSVGRect(value) {
|
|
73
|
+
return value.e <= 10 && value.e + value.a * value.SVGWidth + 10 >= value.viewerWidth && value.f <= 80 && value.f + value.d * value.SVGHeight + 10 >= value.viewerHeight ? true : false;
|
|
74
|
+
};
|
|
75
|
+
function handleExternalEvent(_x2) {
|
|
1098
76
|
return _handleExternalEvent.apply(this, arguments);
|
|
1099
77
|
}
|
|
1100
78
|
function _handleExternalEvent() {
|
|
1101
|
-
_handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
1102
|
-
var _evt$
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
while (1) switch (_context1.prev = _context1.next) {
|
|
79
|
+
_handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(props) {
|
|
80
|
+
var evt, state, sLineCnt, element, catalog, outlineSVGData, catalogInstance, elementJs, _evt$payload, moveType, moveValue, value, defaulTitle, _evt$payload2, doorStyle, isAll, _doorStyle, _value, _zoomValue, _value2, _zoomValue2, _t2, _t3;
|
|
81
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
82
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1106
83
|
case 0:
|
|
1107
|
-
// console.log('***external event****', props);
|
|
1108
84
|
evt = props.externalEvent;
|
|
1109
85
|
state = props.state.get('KitchenConfigurator');
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
_t5 = evt === null || evt === void 0 ? void 0 : evt.type;
|
|
1113
|
-
_context1.next = _t5 === _constants.EXTERNAL_EVENT_LOAD_PROJECT ? 1 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 5 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 6 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 7 : _t5 === _constants.EXTERNAL_EVENT_ADD_WALL ? 8 : _t5 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 9 : _t5 === _constants.EXTERNAL_EVENT_ADD_HOLE ? 12 : _t5 === _constants.EXTERNAL_EVENT_ROTATE_PAN ? 13 : _t5 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 13 : _t5 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 14 : _t5 === _constants.EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 15 : _t5 === _constants.EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 19 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_IN ? 20 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_OUT ? 21 : _t5 === _constants.EXTERNAL_EVENT_CENTERING_2D ? 22 : _t5 === _constants.EXTERNAL_EVENT_UNDO ? 23 : _t5 === _constants.EXTERNAL_EVENT_REDO ? 24 : _t5 === _constants.EXTERNAL_EVENT_SET_MOLDING ? 25 : _t5 === _constants.EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 27 : _t5 === _constants.EXTERNAL_EVENT_DELETE_ELEMENT ? 28 : _t5 === _constants.EXTERNAL_EVENT_PROJECT_SETTING ? 29 : _t5 === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 38 : _t5 === _constants.EXTERNAL_EVENT_UPDATE_PROPERTY ? 38 : _t5 === _constants.EXTERNAL_EVENT_REPLACE_CABINET ? 39 : _t5 === _constants.EXTERNAL_EVENT_SET_FINISHING ? 41 : _t5 === _constants.EXTERNAL_EVENT_SYNC_SCENE ? 42 : 43;
|
|
86
|
+
_t2 = evt === null || evt === void 0 ? void 0 : evt.type;
|
|
87
|
+
_context2.next = _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 1 : _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 2 : _t2 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 3 : _t2 === _constants.EXTERNAL_EVENT_ADD_WALL ? 4 : _t2 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 5 : _t2 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 9 : _t2 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 15 : _t2 === _constants.EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 16 : _t2 === _constants.EXTERNAL_EVENT_SET_INITIAL_DATA ? 17 : _t2 === _constants.EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 18 : _t2 === _constants.EXTERNAL_EVENT_ZOOM_IN ? 19 : _t2 === _constants.EXTERNAL_EVENT_ZOOM_OUT ? 22 : 25;
|
|
1114
88
|
break;
|
|
1115
89
|
case 1:
|
|
1116
|
-
// prepare item data request
|
|
1117
|
-
cdsItems = [];
|
|
1118
|
-
itemKeys = Object.keys(evt === null || evt === void 0 || (_evt$payload = evt.payload) === null || _evt$payload === void 0 || (_evt$payload = _evt$payload.layers['layer-1']) === null || _evt$payload === void 0 ? void 0 : _evt$payload.items) || [];
|
|
1119
|
-
_loop3 = /*#__PURE__*/_regenerator["default"].mark(function _loop3() {
|
|
1120
|
-
var _evt$payload2, _it$doorStyle2;
|
|
1121
|
-
var it;
|
|
1122
|
-
return _regenerator["default"].wrap(function (_context8) {
|
|
1123
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
1124
|
-
case 0:
|
|
1125
|
-
it = evt === null || evt === void 0 || (_evt$payload2 = evt.payload) === null || _evt$payload2 === void 0 || (_evt$payload2 = _evt$payload2.layers['layer-1']) === null || _evt$payload2 === void 0 ? void 0 : _evt$payload2.items[itemKeys[i]]; //////// check altitude of item property and change length from _length (convert length from 'in' fo 'cm')
|
|
1126
|
-
if (it.properties.altitude.length !== (0, _convertUnitsLite.convert)(it.properties.altitude._length).from('in').to('cm')) {
|
|
1127
|
-
it.properties.altitude.length = (0, _convertUnitsLite.convert)(it.properties.altitude._length).from('in').to('cm');
|
|
1128
|
-
}
|
|
1129
|
-
/////////
|
|
1130
|
-
if (!cdsItems.some(function (v) {
|
|
1131
|
-
var _it$doorStyle;
|
|
1132
|
-
return it.itemID === v.itemID && it.name === v.name && ((_it$doorStyle = it.doorStyle) === null || _it$doorStyle === void 0 || (_it$doorStyle = _it$doorStyle.doorStyles) === null || _it$doorStyle === void 0 ? void 0 : _it$doorStyle.cabinet_door_style_id) === v.cdsId;
|
|
1133
|
-
})) cdsItems.push({
|
|
1134
|
-
itemID: it.itemID,
|
|
1135
|
-
prototype: it.prototype,
|
|
1136
|
-
category: it.category,
|
|
1137
|
-
name: it.name,
|
|
1138
|
-
type: it.type,
|
|
1139
|
-
sku_number: it.sku_number,
|
|
1140
|
-
cdsId: (_it$doorStyle2 = it.doorStyle) === null || _it$doorStyle2 === void 0 || (_it$doorStyle2 = _it$doorStyle2.doorStyles) === null || _it$doorStyle2 === void 0 ? void 0 : _it$doorStyle2.cabinet_door_style_id
|
|
1141
|
-
});
|
|
1142
|
-
case 1:
|
|
1143
|
-
case "end":
|
|
1144
|
-
return _context8.stop();
|
|
1145
|
-
}
|
|
1146
|
-
}, _loop3);
|
|
1147
|
-
});
|
|
1148
|
-
i = 0;
|
|
1149
|
-
case 2:
|
|
1150
|
-
if (!(i < itemKeys.length)) {
|
|
1151
|
-
_context1.next = 4;
|
|
1152
|
-
break;
|
|
1153
|
-
}
|
|
1154
|
-
return _context1.delegateYield(_loop3(), "t0", 3);
|
|
1155
|
-
case 3:
|
|
1156
|
-
i++;
|
|
1157
|
-
_context1.next = 2;
|
|
1158
|
-
break;
|
|
1159
|
-
case 4:
|
|
1160
|
-
// request item catalog data to host app
|
|
1161
|
-
if (cdsItems.length > 0) {
|
|
1162
|
-
(_props$onInternalEven = props.onInternalEvent) === null || _props$onInternalEven === void 0 || _props$onInternalEven.call(props, {
|
|
1163
|
-
type: _constants.INTERNAL_EVENT_ITEMS_CATALOG,
|
|
1164
|
-
value: {
|
|
1165
|
-
cdsItems: cdsItems
|
|
1166
|
-
}
|
|
1167
|
-
}, /*#__PURE__*/function () {
|
|
1168
|
-
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(result) {
|
|
1169
|
-
var _i, _result$elements;
|
|
1170
|
-
return _regenerator["default"].wrap(function (_context7) {
|
|
1171
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
1172
|
-
case 0:
|
|
1173
|
-
_i = 0;
|
|
1174
|
-
case 1:
|
|
1175
|
-
if (!(_i < (result === null || result === void 0 || (_result$elements = result.elements) === null || _result$elements === void 0 ? void 0 : _result$elements.length))) {
|
|
1176
|
-
_context7.next = 3;
|
|
1177
|
-
break;
|
|
1178
|
-
}
|
|
1179
|
-
_context7.next = 2;
|
|
1180
|
-
return addItemToCatalog(result.elements[_i], state, props.catalog, props.projectActions);
|
|
1181
|
-
case 2:
|
|
1182
|
-
_i++;
|
|
1183
|
-
_context7.next = 1;
|
|
1184
|
-
break;
|
|
1185
|
-
case 3:
|
|
1186
|
-
props.projectActions.loadProject(evt.payload);
|
|
1187
|
-
case 4:
|
|
1188
|
-
case "end":
|
|
1189
|
-
return _context7.stop();
|
|
1190
|
-
}
|
|
1191
|
-
}, _callee7);
|
|
1192
|
-
}));
|
|
1193
|
-
return function (_x11) {
|
|
1194
|
-
return _ref2.apply(this, arguments);
|
|
1195
|
-
};
|
|
1196
|
-
}());
|
|
1197
|
-
}
|
|
1198
|
-
return _context1.abrupt("continue", 43);
|
|
1199
|
-
case 5:
|
|
1200
90
|
props.projectActions.setMode(_constants.MODE_IDLE_3D);
|
|
1201
|
-
return
|
|
1202
|
-
case
|
|
91
|
+
return _context2.abrupt("continue", 25);
|
|
92
|
+
case 2:
|
|
1203
93
|
props.projectActions.setMode(_constants.MODE_IDLE);
|
|
1204
|
-
return
|
|
1205
|
-
case
|
|
1206
|
-
sLineCnt = layer
|
|
94
|
+
return _context2.abrupt("continue", 25);
|
|
95
|
+
case 3:
|
|
96
|
+
sLineCnt = state.getIn(['scene', 'layers', 'layer-1', 'selected', 'lines']).size;
|
|
1207
97
|
if (sLineCnt > 0) props.projectActions.setMode(_constants.MODE_ELEVATION_VIEW);
|
|
1208
|
-
return
|
|
1209
|
-
case
|
|
98
|
+
return _context2.abrupt("continue", 25);
|
|
99
|
+
case 4:
|
|
1210
100
|
if (state.mode === _constants.MODE_IDLE || state.mode === _constants.MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
1211
101
|
props.projectActions.setMode(_constants.MODE_IDLE);
|
|
1212
102
|
props.linesActions.selectToolDrawingLine('wall');
|
|
1213
103
|
}
|
|
1214
|
-
return
|
|
1215
|
-
case
|
|
104
|
+
return _context2.abrupt("continue", 25);
|
|
105
|
+
case 5:
|
|
1216
106
|
if ((0, _helper.isEmpty)(evt === null || evt === void 0 ? void 0 : evt.payload)) {
|
|
1217
|
-
|
|
107
|
+
_context2.next = 8;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
element = evt.payload;
|
|
111
|
+
catalog = state.getIn(['catalog']).toJS(); // add item to catalog of state
|
|
112
|
+
if (!(0, _helper.isEmpty)(catalog === null || catalog === void 0 ? void 0 : catalog.elements[element.name])) {
|
|
113
|
+
_context2.next = 7;
|
|
1218
114
|
break;
|
|
1219
115
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
116
|
+
_context2.next = 6;
|
|
117
|
+
return loadSVGsByItem(element);
|
|
118
|
+
case 6:
|
|
119
|
+
outlineSVGData = _context2.sent;
|
|
120
|
+
catalogInstance = props.catalog;
|
|
121
|
+
elementJs = (0, _exporter["default"])(_objectSpread(_objectSpread({}, element), {}, {
|
|
122
|
+
outlineSVGData: outlineSVGData,
|
|
123
|
+
type: 'cabinet',
|
|
124
|
+
render2DItem: _itemLoader.render2DItem,
|
|
125
|
+
render3DItem: _itemLoader.render3DItem
|
|
126
|
+
}));
|
|
127
|
+
if (catalogInstance !== null && catalogInstance !== void 0 && catalogInstance.validateElement(elementJs)) {
|
|
128
|
+
props.projectActions.addElementToCatalog(elementJs);
|
|
1231
129
|
}
|
|
1232
|
-
|
|
1233
|
-
_context1.next = 10;
|
|
1234
|
-
return addItemToCatalog(element, state, props.catalog, props.projectActions);
|
|
1235
|
-
case 10:
|
|
130
|
+
case 7:
|
|
1236
131
|
// start drawing item
|
|
1237
|
-
|
|
1238
|
-
// in 3d view
|
|
1239
|
-
props.itemsActions.selectToolDrawingItem3D(element.name);
|
|
1240
|
-
} else {
|
|
1241
|
-
// in 2d view
|
|
1242
|
-
// create cabinet
|
|
1243
|
-
props.itemsActions.selectToolDrawingItem(element.name);
|
|
1244
|
-
// mapping the initial position of client coord to viewer2D coord
|
|
1245
|
-
_evt$payload$initialP = evt.payload.initialPosition, mouseX = _evt$payload$initialP.mouseX, mouseY = _evt$payload$initialP.mouseY;
|
|
1246
|
-
v2d = (_state$viewer2D = state.viewer2D) === null || _state$viewer2D === void 0 ? void 0 : _state$viewer2D.toJS();
|
|
1247
|
-
if (mouseX && mouseY && v2d) {
|
|
1248
|
-
vPosX = (mouseX - v2d.e) / v2d.a;
|
|
1249
|
-
vPosY = (mouseY - v2d.f) / v2d.d;
|
|
1250
|
-
layerID = state.scene.selectedLayer; // move cabinet to initial position
|
|
1251
|
-
props.itemsActions.updateDrawingItem(layerID, vPosX, -vPosY + state.scene.height, true);
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
132
|
+
_constants.ARRAY_3D_MODES.includes(state.mode) ? props.itemsActions.selectToolDrawingItem3D(element.name) : props.itemsActions.selectToolDrawingItem(element.name);
|
|
1254
133
|
props.projectActions.pushLastSelectedCatalogElementToHistory(element);
|
|
1255
134
|
props.projectActions.setIsCabinetDrawing(true);
|
|
135
|
+
case 8:
|
|
136
|
+
return _context2.abrupt("continue", 25);
|
|
137
|
+
case 9:
|
|
138
|
+
_evt$payload = evt.payload, moveType = _evt$payload.moveType, moveValue = _evt$payload.moveValue;
|
|
139
|
+
value = state.getIn(['viewer2D']).toJS();
|
|
140
|
+
_t3 = moveType;
|
|
141
|
+
_context2.next = _t3 === _constants.TOP ? 10 : _t3 === _constants.BOTTOM ? 11 : _t3 === _constants.RIGHT ? 12 : _t3 === _constants.LEFT ? 13 : 14;
|
|
142
|
+
break;
|
|
143
|
+
case 10:
|
|
144
|
+
value.f -= moveValue;
|
|
145
|
+
return _context2.abrupt("continue", 14);
|
|
1256
146
|
case 11:
|
|
1257
|
-
|
|
147
|
+
value.f += moveValue;
|
|
148
|
+
return _context2.abrupt("continue", 14);
|
|
1258
149
|
case 12:
|
|
1259
|
-
|
|
1260
|
-
return
|
|
150
|
+
value.e += moveValue;
|
|
151
|
+
return _context2.abrupt("continue", 14);
|
|
1261
152
|
case 13:
|
|
1262
|
-
|
|
1263
|
-
return
|
|
153
|
+
value.e -= moveValue;
|
|
154
|
+
return _context2.abrupt("continue", 14);
|
|
1264
155
|
case 14:
|
|
156
|
+
if (compareSVGRect(value)) props.viewer2DActions.updateCameraView(value);
|
|
157
|
+
return _context2.abrupt("continue", 25);
|
|
158
|
+
case 15:
|
|
1265
159
|
defaulTitle = 'Untitle';
|
|
1266
160
|
props.projectActions.newProject();
|
|
1267
161
|
props.projectActions.rename(defaulTitle);
|
|
1268
|
-
return
|
|
1269
|
-
case 15:
|
|
1270
|
-
_evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, itemCDS = _evt$payload5.itemCDS, isAll = _evt$payload5.isAll; // prepare item data request
|
|
1271
|
-
_layerId = state.getIn(['scene', 'selectedLayer']);
|
|
1272
|
-
_cdsItems = [];
|
|
1273
|
-
allItems = state.getIn(['scene', 'layers', _layerId, 'items']).toJS();
|
|
1274
|
-
selectedItemId = state.getIn(['scene', 'layers', _layerId]).selected.items.toJS()[0];
|
|
1275
|
-
_itemKeys = isAll ? (_Object$keys = Object.keys(allItems)) !== null && _Object$keys !== void 0 ? _Object$keys : [] : [selectedItemId];
|
|
1276
|
-
_loop4 = /*#__PURE__*/_regenerator["default"].mark(function _loop4() {
|
|
1277
|
-
var _itemCDS$find;
|
|
1278
|
-
var item, cdsId;
|
|
1279
|
-
return _regenerator["default"].wrap(function (_context0) {
|
|
1280
|
-
while (1) switch (_context0.prev = _context0.next) {
|
|
1281
|
-
case 0:
|
|
1282
|
-
item = allItems[_itemKeys[_i2]];
|
|
1283
|
-
cdsId = (_itemCDS$find = itemCDS.find(function (itCDS) {
|
|
1284
|
-
return itCDS.itemID === item.itemID;
|
|
1285
|
-
})) === null || _itemCDS$find === void 0 ? void 0 : _itemCDS$find.cabinet_door_style_id;
|
|
1286
|
-
if (cdsId && !_cdsItems.some(function (v) {
|
|
1287
|
-
return item.itemID === v.itemID && item.name === v.name && cdsId === v.cdsId;
|
|
1288
|
-
})) _cdsItems.push({
|
|
1289
|
-
itemID: item.itemID,
|
|
1290
|
-
prototype: item.prototype,
|
|
1291
|
-
category: item.category,
|
|
1292
|
-
name: item.name,
|
|
1293
|
-
type: item.type,
|
|
1294
|
-
sku_number: item.sku_number,
|
|
1295
|
-
cdsId: cdsId
|
|
1296
|
-
});
|
|
1297
|
-
case 1:
|
|
1298
|
-
case "end":
|
|
1299
|
-
return _context0.stop();
|
|
1300
|
-
}
|
|
1301
|
-
}, _loop4);
|
|
1302
|
-
});
|
|
1303
|
-
_i2 = 0;
|
|
162
|
+
return _context2.abrupt("continue", 25);
|
|
1304
163
|
case 16:
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
}
|
|
1309
|
-
return _context1.delegateYield(_loop4(), "t1", 17);
|
|
164
|
+
_evt$payload2 = evt.payload, doorStyle = _evt$payload2.doorStyle, isAll = _evt$payload2.isAll;
|
|
165
|
+
props.itemsActions.setDoorStyle(doorStyle, isAll);
|
|
166
|
+
return _context2.abrupt("continue", 25);
|
|
1310
167
|
case 17:
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
168
|
+
_doorStyle = evt.payload.doorStyle;
|
|
169
|
+
props.itemsActions.setInitialDoorStyle(_doorStyle.doorStyle, _doorStyle.oStyle);
|
|
170
|
+
return _context2.abrupt("continue", 25);
|
|
1314
171
|
case 18:
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
(_props$onInternalEven2 = props.onInternalEvent) === null || _props$onInternalEven2 === void 0 || _props$onInternalEven2.call(props, {
|
|
1318
|
-
type: _constants.INTERNAL_EVENT_ITEMS_CATALOG,
|
|
1319
|
-
value: {
|
|
1320
|
-
cdsItems: _cdsItems
|
|
1321
|
-
}
|
|
1322
|
-
}, /*#__PURE__*/function () {
|
|
1323
|
-
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(result) {
|
|
1324
|
-
var _i3, _result$elements2;
|
|
1325
|
-
return _regenerator["default"].wrap(function (_context9) {
|
|
1326
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
1327
|
-
case 0:
|
|
1328
|
-
_i3 = 0;
|
|
1329
|
-
case 1:
|
|
1330
|
-
if (!(_i3 < (result === null || result === void 0 || (_result$elements2 = result.elements) === null || _result$elements2 === void 0 ? void 0 : _result$elements2.length))) {
|
|
1331
|
-
_context9.next = 3;
|
|
1332
|
-
break;
|
|
1333
|
-
}
|
|
1334
|
-
_context9.next = 2;
|
|
1335
|
-
return addItemToCatalog(result.elements[_i3], state, props.catalog, props.projectActions);
|
|
1336
|
-
case 2:
|
|
1337
|
-
_i3++;
|
|
1338
|
-
_context9.next = 1;
|
|
1339
|
-
break;
|
|
1340
|
-
case 3:
|
|
1341
|
-
props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
|
|
1342
|
-
case 4:
|
|
1343
|
-
case "end":
|
|
1344
|
-
return _context9.stop();
|
|
1345
|
-
}
|
|
1346
|
-
}, _callee8);
|
|
1347
|
-
}));
|
|
1348
|
-
return function (_x12) {
|
|
1349
|
-
return _ref3.apply(this, arguments);
|
|
1350
|
-
};
|
|
1351
|
-
}());
|
|
1352
|
-
} else props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
|
|
1353
|
-
return _context1.abrupt("continue", 43);
|
|
172
|
+
props.projectActions.loadProject(evt.payload, props.categoryData);
|
|
173
|
+
return _context2.abrupt("continue", 25);
|
|
1354
174
|
case 19:
|
|
1355
|
-
_evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, _doorStyle = _evt$payload6.doorStyle;
|
|
1356
|
-
props.projectActions.createRoomWithShape(roomShapeType, width, height, _doorStyle);
|
|
1357
|
-
return _context1.abrupt("continue", 43);
|
|
1358
|
-
case 20:
|
|
1359
|
-
value = state.getIn(['viewer2D']).toJS();
|
|
1360
|
-
value.a += 0.1;
|
|
1361
|
-
value.d += 0.1;
|
|
1362
|
-
value.e -= value.SVGWidth * 0.1 / 2;
|
|
1363
|
-
value.f -= value.SVGHeight * 0.1 / 2;
|
|
1364
|
-
(0, _helper.updateViwer2D)(value, props.viewer2DActions);
|
|
1365
|
-
return _context1.abrupt("continue", 43);
|
|
1366
|
-
case 21:
|
|
1367
175
|
_value = state.getIn(['viewer2D']).toJS();
|
|
1368
176
|
_value.a -= 0.1;
|
|
1369
177
|
_value.d -= 0.1;
|
|
1370
178
|
_value.e += _value.SVGWidth * 0.1 / 2;
|
|
1371
179
|
_value.f += _value.SVGHeight * 0.1 / 2;
|
|
1372
|
-
(0
|
|
1373
|
-
|
|
180
|
+
_zoomValue = parseInt((_value.a - 0.5) / _constants.ZOOM_VARIABLE);
|
|
181
|
+
if (!(_zoomValue > 404)) {
|
|
182
|
+
_context2.next = 20;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
return _context2.abrupt("return");
|
|
186
|
+
case 20:
|
|
187
|
+
if (!(_zoomValue < 35 || Number.isNaN(_zoomValue))) {
|
|
188
|
+
_context2.next = 21;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
return _context2.abrupt("return");
|
|
192
|
+
case 21:
|
|
193
|
+
while (!(_value.e <= 10)) {
|
|
194
|
+
_value.e -= 0.1;
|
|
195
|
+
}
|
|
196
|
+
while (!(_value.e + _value.a * _value.SVGWidth + 10 >= _value.viewerWidth)) {
|
|
197
|
+
_value.e += 0.1;
|
|
198
|
+
}
|
|
199
|
+
while (!(_value.f <= 80)) {
|
|
200
|
+
_value.f -= 0.1;
|
|
201
|
+
}
|
|
202
|
+
while (!(_value.f + _value.a * _value.SVGHeight + 10 >= _value.viewerHeight)) {
|
|
203
|
+
_value.f += 0.1;
|
|
204
|
+
}
|
|
205
|
+
if (compareSVGRect(_value)) props.viewer2DActions.updateCameraView(_value);
|
|
206
|
+
return _context2.abrupt("continue", 25);
|
|
1374
207
|
case 22:
|
|
1375
|
-
|
|
1376
|
-
|
|
208
|
+
_value2 = state.getIn(['viewer2D']).toJS();
|
|
209
|
+
_value2.a += 0.1;
|
|
210
|
+
_value2.d += 0.1;
|
|
211
|
+
_value2.e -= _value2.SVGWidth * 0.1 / 2;
|
|
212
|
+
_value2.f -= _value2.SVGHeight * 0.1 / 2;
|
|
213
|
+
_zoomValue2 = parseInt((_value2.a - 0.5) / _constants.ZOOM_VARIABLE);
|
|
214
|
+
if (!(_zoomValue2 > 404)) {
|
|
215
|
+
_context2.next = 23;
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
return _context2.abrupt("return");
|
|
1377
219
|
case 23:
|
|
1378
|
-
|
|
1379
|
-
|
|
220
|
+
if (!(_zoomValue2 < 35 || Number.isNaN(_zoomValue2))) {
|
|
221
|
+
_context2.next = 24;
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
return _context2.abrupt("return");
|
|
1380
225
|
case 24:
|
|
1381
|
-
props.
|
|
1382
|
-
return
|
|
226
|
+
if (compareSVGRect(_value2)) props.viewer2DActions.updateCameraView(_value2);
|
|
227
|
+
return _context2.abrupt("continue", 25);
|
|
1383
228
|
case 25:
|
|
1384
|
-
_evt$payload7 = evt.payload, moldingInfo = _evt$payload7.moldingInfo, isGlobal = _evt$payload7.isGlobal;
|
|
1385
|
-
_context1.next = 26;
|
|
1386
|
-
return loadMoldingSvg(moldingInfo);
|
|
1387
|
-
case 26:
|
|
1388
|
-
props.itemsActions.setMolding(moldingInfo, isGlobal);
|
|
1389
|
-
return _context1.abrupt("continue", 43);
|
|
1390
|
-
case 27:
|
|
1391
|
-
distElement = getElement(evt.payload, state);
|
|
1392
|
-
if (distElement) props.itemsActions.duplicateSelected(distElement, props.onInternalEvent);
|
|
1393
|
-
return _context1.abrupt("continue", 43);
|
|
1394
|
-
case 28:
|
|
1395
|
-
_distElement = getElement(evt.payload, state);
|
|
1396
|
-
if (_distElement) props.projectActions.remove(_distElement);
|
|
1397
|
-
return _context1.abrupt("continue", 43);
|
|
1398
|
-
case 29:
|
|
1399
|
-
_evt$payload8 = evt.payload, option = _evt$payload8.option, _value2 = _evt$payload8.value;
|
|
1400
|
-
_t6 = option;
|
|
1401
|
-
_context1.next = _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 30 : _t6 === _constants.PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 31 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 32 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 33 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 34 : _t6 === _constants.PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 35 : 36;
|
|
1402
|
-
break;
|
|
1403
|
-
case 30:
|
|
1404
|
-
props.viewer2DActions.updateCeilHeightUnit(_value2);
|
|
1405
|
-
case 31:
|
|
1406
|
-
props.viewer2DActions.updateCeilHeight(_value2);
|
|
1407
|
-
props.viewer3DActions.update3DCeilHeight(_value2);
|
|
1408
|
-
return _context1.abrupt("continue", 37);
|
|
1409
|
-
case 32:
|
|
1410
|
-
props.viewer2DActions.changeWallLengthMeasure(_value2);
|
|
1411
|
-
return _context1.abrupt("continue", 37);
|
|
1412
|
-
case 33:
|
|
1413
|
-
props.viewer2DActions.changeBaseCabinetMeasure(_value2);
|
|
1414
|
-
return _context1.abrupt("continue", 37);
|
|
1415
|
-
case 34:
|
|
1416
|
-
props.viewer2DActions.changeWallCabinetMeasure(_value2);
|
|
1417
|
-
return _context1.abrupt("continue", 37);
|
|
1418
|
-
case 35:
|
|
1419
|
-
props.viewer2DActions.changeWindowDoorMeasure(_value2);
|
|
1420
|
-
return _context1.abrupt("continue", 37);
|
|
1421
|
-
case 36:
|
|
1422
|
-
return _context1.abrupt("continue", 37);
|
|
1423
|
-
case 37:
|
|
1424
|
-
return _context1.abrupt("continue", 43);
|
|
1425
|
-
case 38:
|
|
1426
|
-
_layerId2 = state.getIn(['scene', 'selectedLayer']);
|
|
1427
|
-
_layer = state.getIn(['scene', 'layers', _layerId2]);
|
|
1428
|
-
_layer$getIn = _layer.getIn(['selected']), selectedLines = _layer$getIn.lines, selectedHoles = _layer$getIn.holes, selectedItems = _layer$getIn.items;
|
|
1429
|
-
for (_i4 = 0; _i4 < selectedLines.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['lines', selectedLines.get(_i4)]), evt.payload, props.catalog, props.projectActions, evt.callback);
|
|
1430
|
-
for (_i5 = 0; _i5 < selectedHoles.size; _i5++) (evt === null || evt === void 0 ? void 0 : evt.type) === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['holes', selectedHoles.get(_i5)]), evt.payload, props.catalog, props.projectActions, evt.callback);
|
|
1431
|
-
for (_i6 = 0; _i6 < selectedItems.size; _i6++) (evt === null || evt === void 0 ? void 0 : evt.type) === _constants.EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? updateAttributeOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, state, _layer, props.catalog, props.projectActions, evt.callback) : updatePropertyOfSelectedElement(_layer.getIn(['items', selectedItems.get(_i6)]), evt.payload, props.catalog, props.projectActions, evt.callback);
|
|
1432
|
-
return _context1.abrupt("continue", 43);
|
|
1433
|
-
case 39:
|
|
1434
|
-
_layerID = state.scene.selectedLayer;
|
|
1435
|
-
_layer2 = state.scene.getIn(['layers', _layerID]).toJS();
|
|
1436
|
-
orginalItemInfo = evt === null || evt === void 0 || (_evt$payload9 = evt.payload) === null || _evt$payload9 === void 0 ? void 0 : _evt$payload9.orginalItemInfo;
|
|
1437
|
-
originalItem = _layer2 === null || _layer2 === void 0 ? void 0 : _layer2.items[orginalItemInfo.id];
|
|
1438
|
-
_context1.next = 40;
|
|
1439
|
-
return addItemToCatalog(evt.payload.replaceItemInfo, state, props.catalog, props.projectActions);
|
|
1440
|
-
case 40:
|
|
1441
|
-
originalItemPos = {
|
|
1442
|
-
rotation: originalItem.rotation,
|
|
1443
|
-
selectedItemId: originalItem.id,
|
|
1444
|
-
x: originalItem.x,
|
|
1445
|
-
y: originalItem.y
|
|
1446
|
-
};
|
|
1447
|
-
replaceItem = {
|
|
1448
|
-
name: evt === null || evt === void 0 || (_evt$payload0 = evt.payload) === null || _evt$payload0 === void 0 || (_evt$payload0 = _evt$payload0.replaceItemInfo) === null || _evt$payload0 === void 0 ? void 0 : _evt$payload0.name,
|
|
1449
|
-
info: {
|
|
1450
|
-
width: evt === null || evt === void 0 || (_evt$payload1 = evt.payload) === null || _evt$payload1 === void 0 || (_evt$payload1 = _evt$payload1.replaceItemInfo) === null || _evt$payload1 === void 0 || (_evt$payload1 = _evt$payload1.sizeinfo) === null || _evt$payload1 === void 0 ? void 0 : _evt$payload1.width,
|
|
1451
|
-
height: evt === null || evt === void 0 || (_evt$payload10 = evt.payload) === null || _evt$payload10 === void 0 || (_evt$payload10 = _evt$payload10.replaceItemInfo) === null || _evt$payload10 === void 0 || (_evt$payload10 = _evt$payload10.sizeinfo) === null || _evt$payload10 === void 0 ? void 0 : _evt$payload10.height
|
|
1452
|
-
}
|
|
1453
|
-
};
|
|
1454
|
-
props.itemsActions.replaceItem(originalItemPos, originalItem, replaceItem);
|
|
1455
|
-
return _context1.abrupt("continue", 43);
|
|
1456
|
-
case 41:
|
|
1457
|
-
setFinishing(props, state, evt.payload);
|
|
1458
|
-
return _context1.abrupt("continue", 43);
|
|
1459
|
-
case 42:
|
|
1460
|
-
sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
|
|
1461
|
-
currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
|
|
1462
|
-
sceneData.layers[layerId].moldingData = (0, _molding.getMoldingDataOfScene)(layer, props.catalog, currentTexture);
|
|
1463
|
-
// send scene object from 3DTool to HostApp using internalEvent
|
|
1464
|
-
(_props$onInternalEven3 = props.onInternalEvent) === null || _props$onInternalEven3 === void 0 || _props$onInternalEven3.call(props, {
|
|
1465
|
-
type: _constants.INTERNAL_EVENT_SYNC_SCENE,
|
|
1466
|
-
value: {
|
|
1467
|
-
scene: sceneData
|
|
1468
|
-
}
|
|
1469
|
-
});
|
|
1470
|
-
return _context1.abrupt("continue", 43);
|
|
1471
|
-
case 43:
|
|
1472
229
|
case "end":
|
|
1473
|
-
return
|
|
230
|
+
return _context2.stop();
|
|
1474
231
|
}
|
|
1475
|
-
},
|
|
232
|
+
}, _callee2);
|
|
1476
233
|
}));
|
|
1477
234
|
return _handleExternalEvent.apply(this, arguments);
|
|
1478
235
|
}
|