kitchen-simulator 4.4.0 → 4.4.1
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/components/viewer2d/viewer2d.js +3 -4
- package/es/components/viewer3d/scene-creator.js +34 -5
- package/es/utils/geometry.js +79 -0
- package/es/utils/isolate-event-handler.js +122 -502
- package/lib/components/viewer2d/viewer2d.js +3 -4
- package/lib/components/viewer3d/scene-creator.js +33 -4
- package/lib/utils/geometry.js +81 -0
- package/lib/utils/isolate-event-handler.js +122 -502
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@ var __svgCache = new Map(); // url -> Promise<svgData|null>
|
|
|
40
40
|
function loadJSON(_x) {
|
|
41
41
|
return _loadJSON.apply(this, arguments);
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
/***** Update cabinetPayloadData with updatedTempPlaceholders *****/
|
|
44
44
|
function _loadJSON() {
|
|
45
45
|
_loadJSON = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(path) {
|
|
46
46
|
var p;
|
|
@@ -79,407 +79,27 @@ function _loadJSON() {
|
|
|
79
79
|
}));
|
|
80
80
|
return _loadJSON.apply(this, arguments);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
84
|
-
}
|
|
85
|
-
/***** Update cabinetPayloadData with updatedTempPlaceholders *****/
|
|
86
|
-
function _parseTempPlaceholdersFromCabinetPayload() {
|
|
87
|
-
_parseTempPlaceholdersFromCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
|
|
88
|
-
var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, tempPlaceholdersData, _loop3, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, k, _cabinetPayload$struc3, _t2, _t3, _t4;
|
|
89
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
90
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
91
|
-
case 0:
|
|
92
|
-
link = '';
|
|
93
|
-
keys = Object.keys(cabinetPayload.structure_json);
|
|
94
|
-
temp = [];
|
|
95
|
-
i = 0;
|
|
96
|
-
case 1:
|
|
97
|
-
if (!(i < keys.length)) {
|
|
98
|
-
_context5.next = 4;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
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'))) {
|
|
102
|
-
_context5.next = 3;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
link = cabinetPayload.structure_json[keys[i]];
|
|
106
|
-
_t2 = temp;
|
|
107
|
-
_t3 = keys[i];
|
|
108
|
-
_context5.next = 2;
|
|
109
|
-
return loadJSON(link);
|
|
110
|
-
case 2:
|
|
111
|
-
_t4 = _context5.sent;
|
|
112
|
-
_t2.push.call(_t2, {
|
|
113
|
-
name: _t3,
|
|
114
|
-
data: _t4
|
|
115
|
-
});
|
|
116
|
-
case 3:
|
|
117
|
-
i++;
|
|
118
|
-
_context5.next = 1;
|
|
119
|
-
break;
|
|
120
|
-
case 4:
|
|
121
|
-
tempPlaceholdersData = [];
|
|
122
|
-
_loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3(k) {
|
|
123
|
-
var el;
|
|
124
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
125
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
126
|
-
case 0:
|
|
127
|
-
el = cabinetPayload.structure_json.tempPlaceholders[k].id;
|
|
128
|
-
tempData = {};
|
|
129
|
-
doorKey = 0;
|
|
130
|
-
drawerKey = 0;
|
|
131
|
-
fixedKey = 0;
|
|
132
|
-
doorPHs = 0;
|
|
133
|
-
drawerPHs = 0;
|
|
134
|
-
has_single_door = false;
|
|
135
|
-
fixedPHs = 0;
|
|
136
|
-
temp.forEach(function (t, index) {
|
|
137
|
-
var nodes = t.data.nodes;
|
|
138
|
-
if (nodes === undefined) {
|
|
139
|
-
nodes = [];
|
|
140
|
-
}
|
|
141
|
-
var tempPlaceholders = nodes.filter(function (element) {
|
|
142
|
-
return element.name.startsWith('ph_');
|
|
143
|
-
});
|
|
144
|
-
tempPlaceholders.sort(function (a, b) {
|
|
145
|
-
return a.name > b.name ? 1 : -1;
|
|
146
|
-
});
|
|
147
|
-
if (tempPlaceholders.length > 0) {
|
|
148
|
-
if (t.name === 'base') {
|
|
149
|
-
tempPlaceholders.map(function (element) {
|
|
150
|
-
var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
|
|
151
|
-
if (sink_match && sink_match.length >= 2) {
|
|
152
|
-
var _process$env$API_URL, _cabinetPayload$struc4;
|
|
153
|
-
tempData['sink'] = tempData['sink'] || [];
|
|
154
|
-
tempData['sink'].push(element.name);
|
|
155
|
-
var sink_url = (_process$env$API_URL = process.env.API_URL) !== null && _process$env$API_URL !== void 0 ? _process$env$API_URL :
|
|
156
|
-
// server url from 3DTool env
|
|
157
|
-
import.meta.env.VITE_APP_API_URL + // server url from Host env
|
|
158
|
-
"/uploads/assets/default/".concat(sink_match[1], ".gltf");
|
|
159
|
-
if (cabinetPayload !== null && cabinetPayload !== void 0 && (_cabinetPayload$struc4 = cabinetPayload.structure_json) !== null && _cabinetPayload$struc4 !== void 0 && (_cabinetPayload$struc4 = _cabinetPayload$struc4.tempPlaceholders[k]) !== null && _cabinetPayload$struc4 !== void 0 && _cabinetPayload$struc4.structure) cabinetPayload.structure_json.tempPlaceholders[k].structure.sink = sink_url;
|
|
160
|
-
} else if (temp.some(function (felement) {
|
|
161
|
-
return felement.name.includes('base_drawer');
|
|
162
|
-
}) && element.name.includes('interior_drawer')) {
|
|
163
|
-
var objCnt = temp.filter(function (felement) {
|
|
164
|
-
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
165
|
-
}).length;
|
|
166
|
-
var phCnt = tempPlaceholders.filter(function (felement) {
|
|
167
|
-
return felement.name.includes('interior');
|
|
168
|
-
}).length;
|
|
169
|
-
drawerPHs = phCnt;
|
|
170
|
-
if (objCnt === 1 || phCnt % objCnt !== 0) {
|
|
171
|
-
if (tempData['base_drawer_1'] === undefined) {
|
|
172
|
-
tempData['base_drawer_1'] = [];
|
|
173
|
-
}
|
|
174
|
-
tempData['base_drawer_1'].push(element.name);
|
|
175
|
-
drawerKey++;
|
|
176
|
-
} else if (objCnt > 1 && phCnt % objCnt === 0) {
|
|
177
|
-
if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
|
|
178
|
-
tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
|
|
179
|
-
}
|
|
180
|
-
tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
|
|
181
|
-
drawerKey++;
|
|
182
|
-
}
|
|
183
|
-
} else if (temp.some(function (felement) {
|
|
184
|
-
return felement.name.includes('base_door');
|
|
185
|
-
}) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
|
|
186
|
-
var _objCnt = temp.filter(function (felement) {
|
|
187
|
-
return felement.name.includes('base_door');
|
|
188
|
-
}).length;
|
|
189
|
-
var _phCnt = tempPlaceholders.filter(function (felement) {
|
|
190
|
-
return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
|
|
191
|
-
}).length;
|
|
192
|
-
doorPHs = _phCnt;
|
|
193
|
-
if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
|
|
194
|
-
if (tempData['base_door_1'] === undefined) {
|
|
195
|
-
tempData['base_door_1'] = [];
|
|
196
|
-
}
|
|
197
|
-
tempData['base_door_1'].push(element.name);
|
|
198
|
-
doorKey++;
|
|
199
|
-
} else if (_objCnt > 1) {
|
|
200
|
-
if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
|
|
201
|
-
tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
|
|
202
|
-
}
|
|
203
|
-
tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
|
|
204
|
-
doorKey++;
|
|
205
|
-
}
|
|
206
|
-
} else if (temp.some(function (felement) {
|
|
207
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
208
|
-
}) && element.name.includes('_drawer_door_fixed')) {
|
|
209
|
-
var _objCnt2 = temp.filter(function (felement) {
|
|
210
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
211
|
-
}).length;
|
|
212
|
-
var _phCnt2 = tempPlaceholders.filter(function (felement) {
|
|
213
|
-
return felement.name.includes('_drawer_door_fixed');
|
|
214
|
-
}).length;
|
|
215
|
-
fixedPHs = _phCnt2;
|
|
216
|
-
if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
|
|
217
|
-
if (tempData['base_fixed_drawer_door_1'] === undefined) {
|
|
218
|
-
tempData['base_fixed_drawer_door_1'] = [];
|
|
219
|
-
}
|
|
220
|
-
tempData['base_fixed_drawer_door_1'].push(element.name);
|
|
221
|
-
fixedKey++;
|
|
222
|
-
} else if (_objCnt2 > 1) {
|
|
223
|
-
if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
|
|
224
|
-
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
|
|
225
|
-
}
|
|
226
|
-
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
|
|
227
|
-
fixedKey++;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
} else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
|
|
232
|
-
var objCnt = temp.filter(function (felement) {
|
|
233
|
-
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
234
|
-
}).length;
|
|
235
|
-
if (objCnt === 1 || drawerPHs % objCnt !== 0) {
|
|
236
|
-
if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
|
|
237
|
-
//get drawer door handle placeholders
|
|
238
|
-
var ph_temp = temp.find(function (felement) {
|
|
239
|
-
return felement.name === 'base_drawer_door_1';
|
|
240
|
-
});
|
|
241
|
-
if (ph_temp != undefined) {
|
|
242
|
-
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
243
|
-
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
244
|
-
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
245
|
-
});
|
|
246
|
-
for (var w = 0; w < drawerPHs; w++) {
|
|
247
|
-
if (!tempData['base_drawer_door_1'].some(function (el) {
|
|
248
|
-
return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
|
|
249
|
-
})) {
|
|
250
|
-
tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
|
|
251
|
-
//add drawer door handle placeholders
|
|
252
|
-
if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
|
|
253
|
-
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
} else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
|
|
258
|
-
if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
|
|
259
|
-
//get drawer door handle placeholders
|
|
260
|
-
var ph_temp = temp.find(function (felement) {
|
|
261
|
-
return felement.name === 'base_drawer_door' + t.name.slice(-2);
|
|
262
|
-
});
|
|
263
|
-
if (ph_temp != undefined) {
|
|
264
|
-
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
265
|
-
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
266
|
-
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
267
|
-
});
|
|
268
|
-
tempPlaceholders.forEach(function (element) {
|
|
269
|
-
if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
|
|
270
|
-
return el === t.name + '/' + element.name;
|
|
271
|
-
})) {
|
|
272
|
-
tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
|
|
273
|
-
//add drawer door handle placeholders
|
|
274
|
-
if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
|
|
275
|
-
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);
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
} else if (t.name.includes('base_door')) {
|
|
281
|
-
var _objCnt3 = temp.filter(function (felement) {
|
|
282
|
-
return felement.name.includes('base_door');
|
|
283
|
-
}).length;
|
|
284
|
-
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
285
|
-
return el.name.includes('handle');
|
|
286
|
-
});
|
|
287
|
-
if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
|
|
288
|
-
if (tempData['door_handle_1'] === undefined) {
|
|
289
|
-
tempData['door_handle_1'] = [];
|
|
290
|
-
}
|
|
291
|
-
var _loop4 = function _loop4() {
|
|
292
|
-
var phname = tempPlaceholders[0].name;
|
|
293
|
-
var newph = undefined;
|
|
294
|
-
if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
|
|
295
|
-
newph = tempPlaceholders.find(function (el) {
|
|
296
|
-
return el.name.isRightPlaceholder();
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
if (tempData['base_door_1'][_w].isRightPlaceholder()) {
|
|
300
|
-
newph = tempPlaceholders.find(function (el) {
|
|
301
|
-
return el.name.isLeftPlaceholder();
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
if (newph != undefined) {
|
|
305
|
-
phname = newph.name;
|
|
306
|
-
}
|
|
307
|
-
if (doorPHs === 1 && tempPlaceholders.find(function (el) {
|
|
308
|
-
return el.name.isLeftPlaceholder();
|
|
309
|
-
}) != undefined && tempPlaceholders.find(function (el) {
|
|
310
|
-
return el.name.isRightPlaceholder();
|
|
311
|
-
}) != undefined) {
|
|
312
|
-
has_single_door = true;
|
|
313
|
-
}
|
|
314
|
-
if (!tempData['door_handle_1'].some(function (el) {
|
|
315
|
-
return el === 'door_handle_1/' + phname;
|
|
316
|
-
})) {
|
|
317
|
-
tempData['door_handle_1'].push('base_door_1/' + phname);
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
for (var _w = 0; _w < doorPHs; _w++) {
|
|
321
|
-
_loop4();
|
|
322
|
-
}
|
|
323
|
-
} else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
|
|
324
|
-
if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
|
|
325
|
-
var phname = tempPlaceholders[0].name;
|
|
326
|
-
var newph = undefined;
|
|
327
|
-
var blAdd = true;
|
|
328
|
-
if (cabinetPayload.is_corner) {
|
|
329
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
330
|
-
newph = tempPlaceholders.find(function (el) {
|
|
331
|
-
return el.name.isLeftPlaceholder();
|
|
332
|
-
});
|
|
333
|
-
} else {
|
|
334
|
-
blAdd = false;
|
|
335
|
-
}
|
|
336
|
-
} else {
|
|
337
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
338
|
-
newph = tempPlaceholders.find(function (el) {
|
|
339
|
-
return el.name.isRightPlaceholder();
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
343
|
-
newph = tempPlaceholders.find(function (el) {
|
|
344
|
-
return el.name.isLeftPlaceholder();
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (blAdd) {
|
|
349
|
-
if (newph != undefined) {
|
|
350
|
-
phname = newph.name;
|
|
351
|
-
}
|
|
352
|
-
if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
|
|
353
|
-
return el === t.name + '/' + phname;
|
|
354
|
-
})) {
|
|
355
|
-
tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
} else if (t.name.includes('base_fixed_drawer_door')) {
|
|
360
|
-
var _objCnt4 = temp.filter(function (felement) {
|
|
361
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
362
|
-
}).length;
|
|
363
|
-
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
364
|
-
return el.name.includes('handle');
|
|
365
|
-
});
|
|
366
|
-
if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
|
|
367
|
-
if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
|
|
368
|
-
var _loop5 = function _loop5() {
|
|
369
|
-
var phname = tempPlaceholders[0].name;
|
|
370
|
-
var newph = undefined;
|
|
371
|
-
if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
|
|
372
|
-
newph = tempPlaceholders.find(function (el) {
|
|
373
|
-
return el.name.isRightPlaceholder();
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
|
|
377
|
-
newph = tempPlaceholders.find(function (el) {
|
|
378
|
-
return el.name.isLeftPlaceholder();
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
if (newph != undefined) {
|
|
382
|
-
phname = newph.name;
|
|
383
|
-
}
|
|
384
|
-
if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
|
|
385
|
-
return el === 'fixed_drawer_door_handle_1/' + phname;
|
|
386
|
-
})) {
|
|
387
|
-
tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
|
|
391
|
-
_loop5();
|
|
392
|
-
}
|
|
393
|
-
} else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
|
|
394
|
-
if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
|
|
395
|
-
tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
|
|
396
|
-
}
|
|
397
|
-
var _phname = tempPlaceholders[0].name;
|
|
398
|
-
var _newph = undefined;
|
|
399
|
-
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
400
|
-
_newph = tempPlaceholders.find(function (el) {
|
|
401
|
-
return el.name.isRightPlaceholder();
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
405
|
-
_newph = tempPlaceholders.find(function (el) {
|
|
406
|
-
return el.name.isLeftPlaceholder();
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
if (_newph != undefined) {
|
|
410
|
-
_phname = _newph.name;
|
|
411
|
-
}
|
|
412
|
-
if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
|
|
413
|
-
return el === t.name + '/' + _phname;
|
|
414
|
-
})) {
|
|
415
|
-
tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
tempPlaceholdersData.push({
|
|
422
|
-
id: parseInt(el, 10),
|
|
423
|
-
placeholders: tempData,
|
|
424
|
-
structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
|
|
425
|
-
});
|
|
426
|
-
case 1:
|
|
427
|
-
case "end":
|
|
428
|
-
return _context4.stop();
|
|
429
|
-
}
|
|
430
|
-
}, _loop3);
|
|
431
|
-
});
|
|
432
|
-
k = 0;
|
|
433
|
-
case 5:
|
|
434
|
-
if (!(k < (cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$struc3 = cabinetPayload.structure_json) === null || _cabinetPayload$struc3 === void 0 || (_cabinetPayload$struc3 = _cabinetPayload$struc3.tempPlaceholders) === null || _cabinetPayload$struc3 === void 0 ? void 0 : _cabinetPayload$struc3.length))) {
|
|
435
|
-
_context5.next = 7;
|
|
436
|
-
break;
|
|
437
|
-
}
|
|
438
|
-
return _context5.delegateYield(_loop3(k), "t0", 6);
|
|
439
|
-
case 6:
|
|
440
|
-
k++;
|
|
441
|
-
_context5.next = 5;
|
|
442
|
-
break;
|
|
443
|
-
case 7:
|
|
444
|
-
return _context5.abrupt("return", tempPlaceholdersData);
|
|
445
|
-
case 8:
|
|
446
|
-
case "end":
|
|
447
|
-
return _context5.stop();
|
|
448
|
-
}
|
|
449
|
-
}, _callee4);
|
|
450
|
-
}));
|
|
451
|
-
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
452
|
-
}
|
|
453
|
-
function updateCabinetPayload(_x3) {
|
|
82
|
+
function updateCabinetPayload(_x2) {
|
|
454
83
|
return _updateCabinetPayload.apply(this, arguments);
|
|
455
84
|
}
|
|
456
85
|
function _updateCabinetPayload() {
|
|
457
|
-
_updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
86
|
+
_updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
|
|
458
87
|
var cabinetPayloadKeys, i, _cabinetPayload$cabin, _cabinetPayload$cabin2;
|
|
459
|
-
return _regeneratorRuntime.wrap(function (
|
|
460
|
-
while (1) switch (
|
|
88
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
89
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
461
90
|
case 0:
|
|
462
|
-
// let tempPlaceholders = [];
|
|
463
|
-
// tempPlaceholders = await parseTempPlaceholdersFromCabinetPayload(
|
|
464
|
-
// cabinetPayload
|
|
465
|
-
// );
|
|
466
91
|
cabinetPayloadKeys = Object.keys(cabinetPayload);
|
|
467
92
|
for (i = 0; i < cabinetPayloadKeys.length; i++) {
|
|
468
93
|
if (cabinetPayloadKeys[i] === 'structure_json') {
|
|
469
94
|
cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] = (_cabinetPayload$cabin = (_cabinetPayload$cabin2 = cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'][0]) === null || _cabinetPayload$cabin2 === void 0 ? void 0 : _cabinetPayload$cabin2.placeholders) !== null && _cabinetPayload$cabin !== void 0 ? _cabinetPayload$cabin : [];
|
|
470
|
-
|
|
471
|
-
// cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] =
|
|
472
|
-
// tempPlaceholders[0].placeholders;
|
|
473
|
-
// cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] =
|
|
474
|
-
// tempPlaceholders;
|
|
475
95
|
}
|
|
476
96
|
}
|
|
477
|
-
return
|
|
97
|
+
return _context4.abrupt("return", cabinetPayload);
|
|
478
98
|
case 1:
|
|
479
99
|
case "end":
|
|
480
|
-
return
|
|
100
|
+
return _context4.stop();
|
|
481
101
|
}
|
|
482
|
-
},
|
|
102
|
+
}, _callee4);
|
|
483
103
|
}));
|
|
484
104
|
return _updateCabinetPayload.apply(this, arguments);
|
|
485
105
|
}
|
|
@@ -551,34 +171,34 @@ var loadSVGsByItem = /*#__PURE__*/function () {
|
|
|
551
171
|
}
|
|
552
172
|
}, _callee2);
|
|
553
173
|
}));
|
|
554
|
-
return function loadSVGsByItem(
|
|
174
|
+
return function loadSVGsByItem(_x3) {
|
|
555
175
|
return _ref.apply(this, arguments);
|
|
556
176
|
};
|
|
557
177
|
}();
|
|
558
|
-
function addItemToCatalog(_x5, _x6, _x7
|
|
178
|
+
function addItemToCatalog(_x4, _x5, _x6, _x7) {
|
|
559
179
|
return _addItemToCatalog.apply(this, arguments);
|
|
560
180
|
} // Get attributs of current selected element
|
|
561
181
|
function _addItemToCatalog() {
|
|
562
|
-
_addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
182
|
+
_addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(element, state, catalogInstance, projectActions) {
|
|
563
183
|
var _elementJs, _elementJs3;
|
|
564
184
|
var elementJs, outlineSVGData, _state$getIn, _elementJs$structure_, _elementJs$structure_2, _elementJs$structure_3, cds, _cds$find, _elementJs2, currentCdsId, cdsIdx, ttph, updatedStructureJson, catalogElements, catalogElementKeys, catalogItem, k, _catalogElements$cata, tempPlaceholderArray, _catalogItem$structur, newTempPlaceholderArray, mergedTempPlaceholder;
|
|
565
|
-
return _regeneratorRuntime.wrap(function (
|
|
566
|
-
while (1) switch (
|
|
185
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
186
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
567
187
|
case 0:
|
|
568
188
|
if (!isEmpty(element === null || element === void 0 ? void 0 : element.name)) {
|
|
569
|
-
|
|
189
|
+
_context5.next = 1;
|
|
570
190
|
break;
|
|
571
191
|
}
|
|
572
|
-
return
|
|
192
|
+
return _context5.abrupt("return");
|
|
573
193
|
case 1:
|
|
574
194
|
// clone element
|
|
575
195
|
elementJs = Object.assign({}, element); // if (isEmpty(catalog?.elements[element.name])) {
|
|
576
|
-
|
|
196
|
+
_context5.next = 2;
|
|
577
197
|
return loadSVGsByItem(elementJs);
|
|
578
198
|
case 2:
|
|
579
|
-
outlineSVGData =
|
|
199
|
+
outlineSVGData = _context5.sent;
|
|
580
200
|
if (!(((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet')) {
|
|
581
|
-
|
|
201
|
+
_context5.next = 4;
|
|
582
202
|
break;
|
|
583
203
|
}
|
|
584
204
|
// move the tempPlaceholder of current door style to first of tempPlaceholders array
|
|
@@ -606,13 +226,13 @@ function _addItemToCatalog() {
|
|
|
606
226
|
}
|
|
607
227
|
});
|
|
608
228
|
if (isEmpty((_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.tempPlaceholders)) {
|
|
609
|
-
|
|
229
|
+
_context5.next = 4;
|
|
610
230
|
break;
|
|
611
231
|
}
|
|
612
|
-
|
|
232
|
+
_context5.next = 3;
|
|
613
233
|
return updateCabinetPayload(elementJs);
|
|
614
234
|
case 3:
|
|
615
|
-
elementJs =
|
|
235
|
+
elementJs = _context5.sent;
|
|
616
236
|
case 4:
|
|
617
237
|
elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
|
|
618
238
|
outlineSVGData: outlineSVGData,
|
|
@@ -629,18 +249,18 @@ function _addItemToCatalog() {
|
|
|
629
249
|
k = 0;
|
|
630
250
|
case 5:
|
|
631
251
|
if (!(k < catalogElementKeys.length)) {
|
|
632
|
-
|
|
252
|
+
_context5.next = 7;
|
|
633
253
|
break;
|
|
634
254
|
}
|
|
635
255
|
if (!(((_catalogElements$cata = catalogElements[catalogElementKeys[k]]) === null || _catalogElements$cata === void 0 ? void 0 : _catalogElements$cata.itemID) === elementJs.itemID)) {
|
|
636
|
-
|
|
256
|
+
_context5.next = 6;
|
|
637
257
|
break;
|
|
638
258
|
}
|
|
639
259
|
catalogItem = catalogElements[catalogElementKeys[k]];
|
|
640
|
-
return
|
|
260
|
+
return _context5.abrupt("continue", 7);
|
|
641
261
|
case 6:
|
|
642
262
|
k++;
|
|
643
|
-
|
|
263
|
+
_context5.next = 5;
|
|
644
264
|
break;
|
|
645
265
|
case 7:
|
|
646
266
|
// get old tempPlaceholder array from catalog item
|
|
@@ -671,9 +291,9 @@ function _addItemToCatalog() {
|
|
|
671
291
|
}
|
|
672
292
|
case 8:
|
|
673
293
|
case "end":
|
|
674
|
-
return
|
|
294
|
+
return _context5.stop();
|
|
675
295
|
}
|
|
676
|
-
},
|
|
296
|
+
}, _callee5);
|
|
677
297
|
}));
|
|
678
298
|
return _addItemToCatalog.apply(this, arguments);
|
|
679
299
|
}
|
|
@@ -1033,15 +653,15 @@ function getElement(objProps, state) {
|
|
|
1033
653
|
}
|
|
1034
654
|
return curObject;
|
|
1035
655
|
}
|
|
1036
|
-
function loadMoldingSvg(
|
|
656
|
+
function loadMoldingSvg(_x8) {
|
|
1037
657
|
return _loadMoldingSvg.apply(this, arguments);
|
|
1038
658
|
}
|
|
1039
659
|
function _loadMoldingSvg() {
|
|
1040
|
-
_loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1041
|
-
return _regeneratorRuntime.wrap(function (
|
|
1042
|
-
while (1) switch (
|
|
660
|
+
_loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(molding) {
|
|
661
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
662
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1043
663
|
case 0:
|
|
1044
|
-
return
|
|
664
|
+
return _context6.abrupt("return", new Promise(function (resolve, reject) {
|
|
1045
665
|
var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
|
|
1046
666
|
if (!url) {
|
|
1047
667
|
// Skip if no SVG URL available
|
|
@@ -1063,9 +683,9 @@ function _loadMoldingSvg() {
|
|
|
1063
683
|
}));
|
|
1064
684
|
case 1:
|
|
1065
685
|
case "end":
|
|
1066
|
-
return
|
|
686
|
+
return _context6.stop();
|
|
1067
687
|
}
|
|
1068
|
-
},
|
|
688
|
+
}, _callee6);
|
|
1069
689
|
}));
|
|
1070
690
|
return _loadMoldingSvg.apply(this, arguments);
|
|
1071
691
|
}
|
|
@@ -1206,43 +826,43 @@ function mergeSameElements(projectItemsCatalog) {
|
|
|
1206
826
|
}
|
|
1207
827
|
return result;
|
|
1208
828
|
}
|
|
1209
|
-
export function handleExternalEvent(
|
|
829
|
+
export function handleExternalEvent(_x9) {
|
|
1210
830
|
return _handleExternalEvent.apply(this, arguments);
|
|
1211
831
|
}
|
|
1212
832
|
function _handleExternalEvent() {
|
|
1213
|
-
_handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
833
|
+
_handleExternalEvent = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(props) {
|
|
1214
834
|
var _evt$payload3, _evt$payload4;
|
|
1215
|
-
var evt, state, layerId, layer, _evt$payload, _state$catalog, cdsItems, itemKeys,
|
|
1216
|
-
return _regeneratorRuntime.wrap(function (
|
|
1217
|
-
while (1) switch (
|
|
835
|
+
var evt, state, layerId, layer, _evt$payload, _state$catalog, cdsItems, itemKeys, _loop3, i, newScene, tempState, _props$onInternalEven, sLineCnt, element, _state$viewer2D, _evt$payload$initialP, mouseX, mouseY, v2d, vPosX, vPosY, layerID, defaulTitle, _evt$payload5, doorStyle, itemCDS, applyScope, _evt$payload5$itemIds, itemIds, _layerId, allItems, targetItems, idSet, selectedItemIds, _cdsItems, _loop4, _i2, _props$onInternalEven2, _evt$payload6, roomShapeType, width, height, measurementUnit, _doorStyle, value, _value, _evt$payload7, moldingInfo, isGlobal, distElement, _distElement, _evt$payload8, option, _value2, _layerId2, _layer, _layer$getIn, selectedLines, selectedHoles, selectedItems, _i4, _i5, _i6, _evt$payload9, _evt$payload0, _evt$payload1, _evt$payload10, _layerID, _layer2, orginalItemInfo, originalItem, originalItemPos, replaceItem, _props$onInternalEven3, sceneData, currentTexture, _t2, _t3, _t4;
|
|
836
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
837
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
1218
838
|
case 0:
|
|
1219
839
|
// console.log('***external event****', props.externalEvent);
|
|
1220
840
|
evt = props.externalEvent;
|
|
1221
841
|
state = getPlannerStateFromProps(props);
|
|
1222
842
|
if (state) {
|
|
1223
|
-
|
|
843
|
+
_context1.next = 1;
|
|
1224
844
|
break;
|
|
1225
845
|
}
|
|
1226
|
-
return
|
|
846
|
+
return _context1.abrupt("return");
|
|
1227
847
|
case 1:
|
|
1228
848
|
layerId = state.getIn(['scene', 'selectedLayer']);
|
|
1229
849
|
layer = state.getIn(['scene', 'layers', layerId]);
|
|
1230
|
-
|
|
1231
|
-
|
|
850
|
+
_t2 = evt === null || evt === void 0 ? void 0 : evt.type;
|
|
851
|
+
_context1.next = _t2 === EXTERNAL_EVENT_LOAD_PROJECT ? 2 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_3D ? 7 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_2D ? 8 : _t2 === EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 9 : _t2 === EXTERNAL_EVENT_ADD_WALL ? 10 : _t2 === EXTERNAL_EVENT_ADD_ITEM ? 11 : _t2 === EXTERNAL_EVENT_ADD_HOLE ? 14 : _t2 === EXTERNAL_EVENT_ROTATE_PAN ? 15 : _t2 === EXTERNAL_EVENT_MOVE_PAN ? 15 : _t2 === EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t2 === EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t2 === EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 25 : _t2 === EXTERNAL_EVENT_ZOOM_IN ? 26 : _t2 === EXTERNAL_EVENT_ZOOM_OUT ? 27 : _t2 === EXTERNAL_EVENT_CENTERING_2D ? 28 : _t2 === EXTERNAL_EVENT_UNDO ? 29 : _t2 === EXTERNAL_EVENT_REDO ? 30 : _t2 === EXTERNAL_EVENT_SET_MOLDING ? 31 : _t2 === EXTERNAL_EVENT_DUPLICATE_ELEMENT ? 33 : _t2 === EXTERNAL_EVENT_DELETE_ELEMENT ? 34 : _t2 === EXTERNAL_EVENT_PROJECT_SETTING ? 35 : _t2 === EXTERNAL_EVENT_UPDATE_ATTRIBUTE ? 44 : _t2 === EXTERNAL_EVENT_UPDATE_PROPERTY ? 44 : _t2 === EXTERNAL_EVENT_REPLACE_CABINET ? 45 : _t2 === EXTERNAL_EVENT_SET_FINISHING ? 47 : _t2 === EXTERNAL_EVENT_SYNC_SCENE ? 48 : 49;
|
|
1232
852
|
break;
|
|
1233
853
|
case 2:
|
|
1234
854
|
if (!(evt !== null && evt !== void 0 && evt.payload)) {
|
|
1235
|
-
|
|
855
|
+
_context1.next = 6;
|
|
1236
856
|
break;
|
|
1237
857
|
}
|
|
1238
858
|
// prepare item data request
|
|
1239
859
|
cdsItems = [];
|
|
1240
860
|
itemKeys = 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 && _evt$payload.items ? Object.keys(evt.payload.layers['layer-1'].items) : [];
|
|
1241
|
-
|
|
861
|
+
_loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3() {
|
|
1242
862
|
var _evt$payload2, _it$properties, _it$properties2, _it$properties3, _it$doorStyle2;
|
|
1243
863
|
var it;
|
|
1244
|
-
return _regeneratorRuntime.wrap(function (
|
|
1245
|
-
while (1) switch (
|
|
864
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
865
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1246
866
|
case 0:
|
|
1247
867
|
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')
|
|
1248
868
|
if (it !== null && it !== void 0 && (_it$properties = it.properties) !== null && _it$properties !== void 0 && (_it$properties = _it$properties.altitude) !== null && _it$properties !== void 0 && _it$properties.length && it !== null && it !== void 0 && (_it$properties2 = it.properties) !== null && _it$properties2 !== void 0 && (_it$properties2 = _it$properties2.altitude) !== null && _it$properties2 !== void 0 && _it$properties2._unit && it !== null && it !== void 0 && (_it$properties3 = it.properties) !== null && _it$properties3 !== void 0 && (_it$properties3 = _it$properties3.altitude) !== null && _it$properties3 !== void 0 && _it$properties3._length && it.properties.altitude.length !== convert(it.properties.altitude._length).from(it.properties.altitude._unit).to('cm')) {
|
|
@@ -1263,20 +883,20 @@ function _handleExternalEvent() {
|
|
|
1263
883
|
});
|
|
1264
884
|
case 1:
|
|
1265
885
|
case "end":
|
|
1266
|
-
return
|
|
886
|
+
return _context8.stop();
|
|
1267
887
|
}
|
|
1268
|
-
},
|
|
888
|
+
}, _loop3);
|
|
1269
889
|
});
|
|
1270
890
|
i = 0;
|
|
1271
891
|
case 3:
|
|
1272
892
|
if (!(i < itemKeys.length)) {
|
|
1273
|
-
|
|
893
|
+
_context1.next = 5;
|
|
1274
894
|
break;
|
|
1275
895
|
}
|
|
1276
|
-
return
|
|
896
|
+
return _context1.delegateYield(_loop3(), "t0", 4);
|
|
1277
897
|
case 4:
|
|
1278
898
|
i++;
|
|
1279
|
-
|
|
899
|
+
_context1.next = 3;
|
|
1280
900
|
break;
|
|
1281
901
|
case 5:
|
|
1282
902
|
newScene = new Scene(evt === null || evt === void 0 ? void 0 : evt.payload);
|
|
@@ -1291,63 +911,63 @@ function _handleExternalEvent() {
|
|
|
1291
911
|
cdsItems: cdsItems
|
|
1292
912
|
}
|
|
1293
913
|
}, /*#__PURE__*/function () {
|
|
1294
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
914
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(result) {
|
|
1295
915
|
var rt, _i;
|
|
1296
|
-
return _regeneratorRuntime.wrap(function (
|
|
1297
|
-
while (1) switch (
|
|
916
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
917
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1298
918
|
case 0:
|
|
1299
919
|
rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
|
|
1300
920
|
_i = 0;
|
|
1301
921
|
case 1:
|
|
1302
922
|
if (!(_i < (rt === null || rt === void 0 ? void 0 : rt.length))) {
|
|
1303
|
-
|
|
923
|
+
_context7.next = 3;
|
|
1304
924
|
break;
|
|
1305
925
|
}
|
|
1306
|
-
|
|
926
|
+
_context7.next = 2;
|
|
1307
927
|
return addItemToCatalog(rt[_i], tempState, props.catalog, props.projectActions);
|
|
1308
928
|
case 2:
|
|
1309
929
|
_i++;
|
|
1310
|
-
|
|
930
|
+
_context7.next = 1;
|
|
1311
931
|
break;
|
|
1312
932
|
case 3:
|
|
1313
933
|
props.projectActions.loadProject(evt.payload);
|
|
1314
934
|
case 4:
|
|
1315
935
|
case "end":
|
|
1316
|
-
return
|
|
936
|
+
return _context7.stop();
|
|
1317
937
|
}
|
|
1318
|
-
},
|
|
938
|
+
}, _callee7);
|
|
1319
939
|
}));
|
|
1320
|
-
return function (
|
|
940
|
+
return function (_x0) {
|
|
1321
941
|
return _ref3.apply(this, arguments);
|
|
1322
942
|
};
|
|
1323
943
|
}());
|
|
1324
944
|
} else props.projectActions.loadProject(evt.payload);
|
|
1325
945
|
case 6:
|
|
1326
|
-
return
|
|
946
|
+
return _context1.abrupt("continue", 49);
|
|
1327
947
|
case 7:
|
|
1328
948
|
props.projectActions.unselectAll();
|
|
1329
949
|
props.projectActions.setMode(MODE_IDLE_3D);
|
|
1330
|
-
return
|
|
950
|
+
return _context1.abrupt("continue", 49);
|
|
1331
951
|
case 8:
|
|
1332
952
|
props.projectActions.setMode(MODE_IDLE);
|
|
1333
|
-
return
|
|
953
|
+
return _context1.abrupt("continue", 49);
|
|
1334
954
|
case 9:
|
|
1335
955
|
sLineCnt = layer.selected.lines.size;
|
|
1336
956
|
if (sLineCnt > 0) props.projectActions.setMode(MODE_ELEVATION_VIEW);
|
|
1337
|
-
return
|
|
957
|
+
return _context1.abrupt("continue", 49);
|
|
1338
958
|
case 10:
|
|
1339
959
|
if (state.mode === MODE_IDLE || state.mode === MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
1340
960
|
props.projectActions.setMode(MODE_IDLE);
|
|
1341
961
|
props.linesActions.selectToolDrawingLine('wall');
|
|
1342
962
|
}
|
|
1343
|
-
return
|
|
963
|
+
return _context1.abrupt("continue", 49);
|
|
1344
964
|
case 11:
|
|
1345
965
|
if (isEmpty(evt === null || evt === void 0 ? void 0 : evt.payload)) {
|
|
1346
|
-
|
|
966
|
+
_context1.next = 13;
|
|
1347
967
|
break;
|
|
1348
968
|
}
|
|
1349
969
|
element = evt.payload;
|
|
1350
|
-
|
|
970
|
+
_context1.next = 12;
|
|
1351
971
|
return addItemToCatalog(element, state, props.catalog, props.projectActions);
|
|
1352
972
|
case 12:
|
|
1353
973
|
// start drawing item
|
|
@@ -1371,18 +991,18 @@ function _handleExternalEvent() {
|
|
|
1371
991
|
props.projectActions.pushLastSelectedCatalogElementToHistory(element);
|
|
1372
992
|
props.projectActions.setIsCabinetDrawing(true);
|
|
1373
993
|
case 13:
|
|
1374
|
-
return
|
|
994
|
+
return _context1.abrupt("continue", 49);
|
|
1375
995
|
case 14:
|
|
1376
996
|
ARRAY_3D_MODES.includes(state.mode) ? props.holesActions.selectToolDrawingHole3D(evt === null || evt === void 0 || (_evt$payload3 = evt.payload) === null || _evt$payload3 === void 0 ? void 0 : _evt$payload3.holeName) : props.holesActions.selectToolDrawingHole(evt === null || evt === void 0 || (_evt$payload4 = evt.payload) === null || _evt$payload4 === void 0 ? void 0 : _evt$payload4.holeName);
|
|
1377
|
-
return
|
|
997
|
+
return _context1.abrupt("continue", 49);
|
|
1378
998
|
case 15:
|
|
1379
999
|
moveAndRotatePan2D3D(evt.type, props, evt.payload, state);
|
|
1380
|
-
return
|
|
1000
|
+
return _context1.abrupt("continue", 49);
|
|
1381
1001
|
case 16:
|
|
1382
1002
|
defaulTitle = 'Untitle';
|
|
1383
1003
|
props.projectActions.newProject();
|
|
1384
1004
|
props.projectActions.rename(defaulTitle);
|
|
1385
|
-
return
|
|
1005
|
+
return _context1.abrupt("continue", 49);
|
|
1386
1006
|
case 17:
|
|
1387
1007
|
_evt$payload5 = evt.payload, doorStyle = _evt$payload5.doorStyle, itemCDS = _evt$payload5.itemCDS, applyScope = _evt$payload5.applyScope, _evt$payload5$itemIds = _evt$payload5.itemIds, itemIds = _evt$payload5$itemIds === void 0 ? [] : _evt$payload5$itemIds;
|
|
1388
1008
|
_layerId = state.getIn(['scene', 'selectedLayer']);
|
|
@@ -1397,27 +1017,27 @@ function _handleExternalEvent() {
|
|
|
1397
1017
|
// itemIds contains item.id (instance IDs)
|
|
1398
1018
|
idSet = new Set(itemIds);
|
|
1399
1019
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1020
|
+
_t3 = applyScope;
|
|
1021
|
+
_context1.next = _t3 === DOORSTYLE_SCOPE_ALL ? 18 : _t3 === DOORSTYLE_SCOPE_SINGLE ? 19 : _t3 === DOORSTYLE_SCOPE_MULTIPLE ? 19 : 20;
|
|
1402
1022
|
break;
|
|
1403
1023
|
case 18:
|
|
1404
1024
|
targetItems = Object.values(allItems);
|
|
1405
|
-
return
|
|
1025
|
+
return _context1.abrupt("continue", 21);
|
|
1406
1026
|
case 19:
|
|
1407
1027
|
targetItems = Object.values(allItems).filter(function (item) {
|
|
1408
1028
|
var _idSet;
|
|
1409
1029
|
return (_idSet = idSet) === null || _idSet === void 0 ? void 0 : _idSet.has(item.id);
|
|
1410
1030
|
});
|
|
1411
|
-
return
|
|
1031
|
+
return _context1.abrupt("continue", 21);
|
|
1412
1032
|
case 20:
|
|
1413
|
-
return
|
|
1033
|
+
return _context1.abrupt("continue", 21);
|
|
1414
1034
|
case 21:
|
|
1415
1035
|
_cdsItems = [];
|
|
1416
|
-
|
|
1036
|
+
_loop4 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop4() {
|
|
1417
1037
|
var _itemCDS$find;
|
|
1418
1038
|
var item, cdsId;
|
|
1419
|
-
return _regeneratorRuntime.wrap(function (
|
|
1420
|
-
while (1) switch (
|
|
1039
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
1040
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
1421
1041
|
case 0:
|
|
1422
1042
|
item = targetItems[_i2];
|
|
1423
1043
|
cdsId = (_itemCDS$find = itemCDS.find(function (itCDS) {
|
|
@@ -1438,20 +1058,20 @@ function _handleExternalEvent() {
|
|
|
1438
1058
|
}
|
|
1439
1059
|
case 1:
|
|
1440
1060
|
case "end":
|
|
1441
|
-
return
|
|
1061
|
+
return _context0.stop();
|
|
1442
1062
|
}
|
|
1443
|
-
},
|
|
1063
|
+
}, _loop4);
|
|
1444
1064
|
});
|
|
1445
1065
|
_i2 = 0;
|
|
1446
1066
|
case 22:
|
|
1447
1067
|
if (!(_i2 < targetItems.length)) {
|
|
1448
|
-
|
|
1068
|
+
_context1.next = 24;
|
|
1449
1069
|
break;
|
|
1450
1070
|
}
|
|
1451
|
-
return
|
|
1071
|
+
return _context1.delegateYield(_loop4(), "t1", 23);
|
|
1452
1072
|
case 23:
|
|
1453
1073
|
_i2++;
|
|
1454
|
-
|
|
1074
|
+
_context1.next = 22;
|
|
1455
1075
|
break;
|
|
1456
1076
|
case 24:
|
|
1457
1077
|
if (_cdsItems.length > 0) {
|
|
@@ -1461,44 +1081,44 @@ function _handleExternalEvent() {
|
|
|
1461
1081
|
cdsItems: _cdsItems
|
|
1462
1082
|
}
|
|
1463
1083
|
}, /*#__PURE__*/function () {
|
|
1464
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1084
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(result) {
|
|
1465
1085
|
var rt, _i3;
|
|
1466
|
-
return _regeneratorRuntime.wrap(function (
|
|
1467
|
-
while (1) switch (
|
|
1086
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
1087
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1468
1088
|
case 0:
|
|
1469
1089
|
rt = mergeSameElements(result === null || result === void 0 ? void 0 : result.elements);
|
|
1470
1090
|
_i3 = 0;
|
|
1471
1091
|
case 1:
|
|
1472
1092
|
if (!(_i3 < (rt === null || rt === void 0 ? void 0 : rt.length))) {
|
|
1473
|
-
|
|
1093
|
+
_context9.next = 3;
|
|
1474
1094
|
break;
|
|
1475
1095
|
}
|
|
1476
|
-
|
|
1096
|
+
_context9.next = 2;
|
|
1477
1097
|
return addItemToCatalog(rt[_i3], state, props.catalog, props.projectActions);
|
|
1478
1098
|
case 2:
|
|
1479
1099
|
_i3++;
|
|
1480
|
-
|
|
1100
|
+
_context9.next = 1;
|
|
1481
1101
|
break;
|
|
1482
1102
|
case 3:
|
|
1483
1103
|
props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
|
|
1484
1104
|
case 4:
|
|
1485
1105
|
case "end":
|
|
1486
|
-
return
|
|
1106
|
+
return _context9.stop();
|
|
1487
1107
|
}
|
|
1488
|
-
},
|
|
1108
|
+
}, _callee8);
|
|
1489
1109
|
}));
|
|
1490
|
-
return function (
|
|
1110
|
+
return function (_x1) {
|
|
1491
1111
|
return _ref4.apply(this, arguments);
|
|
1492
1112
|
};
|
|
1493
1113
|
}());
|
|
1494
1114
|
} else {
|
|
1495
1115
|
props.itemsActions.setDoorStyle(doorStyle, itemCDS, applyScope, itemIds);
|
|
1496
1116
|
}
|
|
1497
|
-
return
|
|
1117
|
+
return _context1.abrupt("continue", 49);
|
|
1498
1118
|
case 25:
|
|
1499
1119
|
_evt$payload6 = evt.payload, roomShapeType = _evt$payload6.roomShapeType, width = _evt$payload6.width, height = _evt$payload6.height, measurementUnit = _evt$payload6.measurementUnit, _doorStyle = _evt$payload6.doorStyle;
|
|
1500
1120
|
props.projectActions.createRoomWithShape(roomShapeType, width, height, measurementUnit, _doorStyle);
|
|
1501
|
-
return
|
|
1121
|
+
return _context1.abrupt("continue", 49);
|
|
1502
1122
|
case 26:
|
|
1503
1123
|
value = state.getIn(['viewer2D']).toJS();
|
|
1504
1124
|
value.a += 0.1;
|
|
@@ -1506,7 +1126,7 @@ function _handleExternalEvent() {
|
|
|
1506
1126
|
value.e -= value.SVGWidth * 0.1 / 2;
|
|
1507
1127
|
value.f -= value.SVGHeight * 0.1 / 2;
|
|
1508
1128
|
updateViwer2D(value, props.viewer2DActions);
|
|
1509
|
-
return
|
|
1129
|
+
return _context1.abrupt("continue", 49);
|
|
1510
1130
|
case 27:
|
|
1511
1131
|
_value = state.getIn(['viewer2D']).toJS();
|
|
1512
1132
|
_value.a -= 0.1;
|
|
@@ -1514,62 +1134,62 @@ function _handleExternalEvent() {
|
|
|
1514
1134
|
_value.e += _value.SVGWidth * 0.1 / 2;
|
|
1515
1135
|
_value.f += _value.SVGHeight * 0.1 / 2;
|
|
1516
1136
|
updateViwer2D(_value, props.viewer2DActions);
|
|
1517
|
-
return
|
|
1137
|
+
return _context1.abrupt("continue", 49);
|
|
1518
1138
|
case 28:
|
|
1519
1139
|
centering2D(state, props.viewer2DActions);
|
|
1520
|
-
return
|
|
1140
|
+
return _context1.abrupt("continue", 49);
|
|
1521
1141
|
case 29:
|
|
1522
1142
|
props.projectActions.undo();
|
|
1523
|
-
return
|
|
1143
|
+
return _context1.abrupt("continue", 49);
|
|
1524
1144
|
case 30:
|
|
1525
1145
|
props.projectActions.redo();
|
|
1526
|
-
return
|
|
1146
|
+
return _context1.abrupt("continue", 49);
|
|
1527
1147
|
case 31:
|
|
1528
1148
|
_evt$payload7 = evt.payload, moldingInfo = _evt$payload7.moldingInfo, isGlobal = _evt$payload7.isGlobal;
|
|
1529
|
-
|
|
1149
|
+
_context1.next = 32;
|
|
1530
1150
|
return loadMoldingSvg(moldingInfo);
|
|
1531
1151
|
case 32:
|
|
1532
1152
|
props.itemsActions.setMolding(moldingInfo, isGlobal);
|
|
1533
|
-
return
|
|
1153
|
+
return _context1.abrupt("continue", 49);
|
|
1534
1154
|
case 33:
|
|
1535
1155
|
distElement = getElement(evt.payload, state);
|
|
1536
1156
|
if (distElement) props.itemsActions.duplicateSelected(distElement, props.onInternalEvent);
|
|
1537
|
-
return
|
|
1157
|
+
return _context1.abrupt("continue", 49);
|
|
1538
1158
|
case 34:
|
|
1539
1159
|
_distElement = getElement(evt.payload, state);
|
|
1540
1160
|
if (_distElement) props.projectActions.remove(_distElement);
|
|
1541
|
-
return
|
|
1161
|
+
return _context1.abrupt("continue", 49);
|
|
1542
1162
|
case 35:
|
|
1543
1163
|
_evt$payload8 = evt.payload, option = _evt$payload8.option, _value2 = _evt$payload8.value;
|
|
1544
|
-
|
|
1545
|
-
|
|
1164
|
+
_t4 = option;
|
|
1165
|
+
_context1.next = _t4 === PROJECT_SETTING_OPTION.CHANGE_MEASUREMENT_UNIT ? 36 : _t4 === PROJECT_SETTING_OPTION.UPDATE_CEIL_HEIGHT ? 37 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WALL_LENGTH_MEASURE ? 38 : _t4 === PROJECT_SETTING_OPTION.CHANGE_BASE_CABINET_MEASURE ? 39 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WALL_CABINET_MEASURE ? 40 : _t4 === PROJECT_SETTING_OPTION.CHANGE_WINDOW_DOOR_MEASURE ? 41 : 42;
|
|
1546
1166
|
break;
|
|
1547
1167
|
case 36:
|
|
1548
1168
|
props.viewer2DActions.updateCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(_value2));
|
|
1549
1169
|
props.viewer2DActions.updateCeilHeightUnit(_value2);
|
|
1550
1170
|
props.viewer3DActions.update3DCeilHeightUnit(_value2);
|
|
1551
1171
|
props.viewer3DActions.update3DCeilHeight(convert(layer.ceilHeight).from(layer.unit).to(_value2));
|
|
1552
|
-
return
|
|
1172
|
+
return _context1.abrupt("continue", 43);
|
|
1553
1173
|
case 37:
|
|
1554
1174
|
props.viewer2DActions.updateCeilHeight(_value2);
|
|
1555
1175
|
props.viewer3DActions.update3DCeilHeight(_value2);
|
|
1556
|
-
return
|
|
1176
|
+
return _context1.abrupt("continue", 43);
|
|
1557
1177
|
case 38:
|
|
1558
1178
|
props.viewer2DActions.changeWallLengthMeasure(_value2);
|
|
1559
|
-
return
|
|
1179
|
+
return _context1.abrupt("continue", 43);
|
|
1560
1180
|
case 39:
|
|
1561
1181
|
props.viewer2DActions.changeBaseCabinetMeasure(_value2);
|
|
1562
|
-
return
|
|
1182
|
+
return _context1.abrupt("continue", 43);
|
|
1563
1183
|
case 40:
|
|
1564
1184
|
props.viewer2DActions.changeWallCabinetMeasure(_value2);
|
|
1565
|
-
return
|
|
1185
|
+
return _context1.abrupt("continue", 43);
|
|
1566
1186
|
case 41:
|
|
1567
1187
|
props.viewer2DActions.changeWindowDoorMeasure(_value2);
|
|
1568
|
-
return
|
|
1188
|
+
return _context1.abrupt("continue", 43);
|
|
1569
1189
|
case 42:
|
|
1570
|
-
return
|
|
1190
|
+
return _context1.abrupt("continue", 43);
|
|
1571
1191
|
case 43:
|
|
1572
|
-
return
|
|
1192
|
+
return _context1.abrupt("continue", 49);
|
|
1573
1193
|
case 44:
|
|
1574
1194
|
_layerId2 = state.getIn(['scene', 'selectedLayer']);
|
|
1575
1195
|
_layer = state.getIn(['scene', 'layers', _layerId2]);
|
|
@@ -1577,13 +1197,13 @@ function _handleExternalEvent() {
|
|
|
1577
1197
|
for (_i4 = 0; _i4 < selectedLines.size; _i4++) (evt === null || evt === void 0 ? void 0 : evt.type) === 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);
|
|
1578
1198
|
for (_i5 = 0; _i5 < selectedHoles.size; _i5++) (evt === null || evt === void 0 ? void 0 : evt.type) === 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);
|
|
1579
1199
|
for (_i6 = 0; _i6 < selectedItems.size; _i6++) (evt === null || evt === void 0 ? void 0 : evt.type) === 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);
|
|
1580
|
-
return
|
|
1200
|
+
return _context1.abrupt("continue", 49);
|
|
1581
1201
|
case 45:
|
|
1582
1202
|
_layerID = state.scene.selectedLayer;
|
|
1583
1203
|
_layer2 = state.scene.getIn(['layers', _layerID]).toJS();
|
|
1584
1204
|
orginalItemInfo = evt === null || evt === void 0 || (_evt$payload9 = evt.payload) === null || _evt$payload9 === void 0 ? void 0 : _evt$payload9.orginalItemInfo;
|
|
1585
1205
|
originalItem = _layer2 === null || _layer2 === void 0 ? void 0 : _layer2.items[orginalItemInfo.id];
|
|
1586
|
-
|
|
1206
|
+
_context1.next = 46;
|
|
1587
1207
|
return addItemToCatalog(evt.payload.replaceItemInfo, state, props.catalog, props.projectActions);
|
|
1588
1208
|
case 46:
|
|
1589
1209
|
originalItemPos = {
|
|
@@ -1600,10 +1220,10 @@ function _handleExternalEvent() {
|
|
|
1600
1220
|
}
|
|
1601
1221
|
};
|
|
1602
1222
|
props.itemsActions.replaceItem(originalItemPos, originalItem, replaceItem);
|
|
1603
|
-
return
|
|
1223
|
+
return _context1.abrupt("continue", 49);
|
|
1604
1224
|
case 47:
|
|
1605
1225
|
setFinishing(props, state, evt.payload);
|
|
1606
|
-
return
|
|
1226
|
+
return _context1.abrupt("continue", 49);
|
|
1607
1227
|
case 48:
|
|
1608
1228
|
sceneData = state.scene.toJS(); // get molding data for "ReviewForQuote"
|
|
1609
1229
|
currentTexture = layer.doorStyle !== null || layer.doorStyle !== undefined ? layer.doorStyle : props.state.doorStyle.toJS();
|
|
@@ -1619,12 +1239,12 @@ function _handleExternalEvent() {
|
|
|
1619
1239
|
scene: sceneData
|
|
1620
1240
|
}
|
|
1621
1241
|
});
|
|
1622
|
-
return
|
|
1242
|
+
return _context1.abrupt("continue", 49);
|
|
1623
1243
|
case 49:
|
|
1624
1244
|
case "end":
|
|
1625
|
-
return
|
|
1245
|
+
return _context1.stop();
|
|
1626
1246
|
}
|
|
1627
|
-
},
|
|
1247
|
+
}, _callee9);
|
|
1628
1248
|
}));
|
|
1629
1249
|
return _handleExternalEvent.apply(this, arguments);
|
|
1630
1250
|
}
|