kitchen-simulator 1.0.0-clark.55 → 1.0.0-clark.57
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/index.js +0 -7
- package/es/utils/isolate-event-handler.js +475 -69
- package/lib/index.js +3 -9
- package/lib/utils/isolate-event-handler.js +476 -69
- package/package.json +1 -1
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.handleExternalEvent = handleExternalEvent;
|
|
8
|
+
exports.parseTempPlaceholdersFromCabinetPayload = parseTempPlaceholdersFromCabinetPayload;
|
|
9
|
+
exports.updateCabinetPayload = updateCabinetPayload;
|
|
8
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
@@ -72,53 +74,458 @@ var loadSVGsByItem = /*#__PURE__*/function () {
|
|
|
72
74
|
var compareSVGRect = function compareSVGRect(value) {
|
|
73
75
|
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
76
|
};
|
|
75
|
-
function
|
|
76
|
-
return
|
|
77
|
+
function loadJSON(_x2, _x3, _x4) {
|
|
78
|
+
return _loadJSON.apply(this, arguments);
|
|
77
79
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
/********Parse TempPlaceholder from cabinetPayloadData **************/
|
|
81
|
+
function _loadJSON() {
|
|
82
|
+
_loadJSON = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(path, success, error) {
|
|
81
83
|
return _regenerator["default"].wrap(function (_context2) {
|
|
82
84
|
while (1) switch (_context2.prev = _context2.next) {
|
|
85
|
+
case 0:
|
|
86
|
+
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
87
|
+
var xhr = new XMLHttpRequest();
|
|
88
|
+
xhr.onreadystatechange = function () {
|
|
89
|
+
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
90
|
+
if (xhr.status === 200) {
|
|
91
|
+
resolve(JSON.parse(xhr.responseText));
|
|
92
|
+
} else {
|
|
93
|
+
reject(xhr);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
xhr.open('GET', path, true);
|
|
98
|
+
xhr.send();
|
|
99
|
+
}));
|
|
100
|
+
case 1:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context2.stop();
|
|
103
|
+
}
|
|
104
|
+
}, _callee2);
|
|
105
|
+
}));
|
|
106
|
+
return _loadJSON.apply(this, arguments);
|
|
107
|
+
}
|
|
108
|
+
function parseTempPlaceholdersFromCabinetPayload(_x5) {
|
|
109
|
+
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
110
|
+
}
|
|
111
|
+
/***** Update cabinetPayloadData with updatedTempPlaceholders *****/
|
|
112
|
+
function _parseTempPlaceholdersFromCabinetPayload() {
|
|
113
|
+
_parseTempPlaceholdersFromCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(cabinetPayload) {
|
|
114
|
+
var link, keys, temp, i, _cabinetPayload$struc, el, tempPlaceholdersData, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, _t2, _t3, _t4;
|
|
115
|
+
return _regenerator["default"].wrap(function (_context3) {
|
|
116
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
117
|
+
case 0:
|
|
118
|
+
link = '';
|
|
119
|
+
keys = Object.keys(cabinetPayload.structure_json);
|
|
120
|
+
temp = [];
|
|
121
|
+
i = 0;
|
|
122
|
+
case 1:
|
|
123
|
+
if (!(i < keys.length)) {
|
|
124
|
+
_context3.next = 4;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
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'))) {
|
|
128
|
+
_context3.next = 3;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
link = cabinetPayload.structure_json[keys[i]];
|
|
132
|
+
_t2 = temp;
|
|
133
|
+
_t3 = keys[i];
|
|
134
|
+
_context3.next = 2;
|
|
135
|
+
return loadJSON(link);
|
|
136
|
+
case 2:
|
|
137
|
+
_t4 = _context3.sent;
|
|
138
|
+
_t2.push.call(_t2, {
|
|
139
|
+
name: _t3,
|
|
140
|
+
data: _t4
|
|
141
|
+
});
|
|
142
|
+
case 3:
|
|
143
|
+
i++;
|
|
144
|
+
_context3.next = 1;
|
|
145
|
+
break;
|
|
146
|
+
case 4:
|
|
147
|
+
el = cabinetPayload.structure_json.tempPlaceholders[0].id;
|
|
148
|
+
tempPlaceholdersData = [];
|
|
149
|
+
tempData = {};
|
|
150
|
+
doorKey = 0;
|
|
151
|
+
drawerKey = 0;
|
|
152
|
+
fixedKey = 0;
|
|
153
|
+
doorPHs = 0;
|
|
154
|
+
drawerPHs = 0;
|
|
155
|
+
has_single_door = false;
|
|
156
|
+
fixedPHs = 0;
|
|
157
|
+
temp.forEach(function (t, index) {
|
|
158
|
+
var nodes = t.data.nodes;
|
|
159
|
+
if (nodes === undefined) {
|
|
160
|
+
nodes = [];
|
|
161
|
+
}
|
|
162
|
+
var tempPlaceholders = nodes.filter(function (element) {
|
|
163
|
+
return element.name.startsWith('ph_');
|
|
164
|
+
});
|
|
165
|
+
tempPlaceholders.sort(function (a, b) {
|
|
166
|
+
return a.name > b.name ? 1 : -1;
|
|
167
|
+
});
|
|
168
|
+
if (tempPlaceholders.length > 0) {
|
|
169
|
+
if (t.name === 'base') {
|
|
170
|
+
tempPlaceholders.map(function (element) {
|
|
171
|
+
var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
|
|
172
|
+
if (sink_match && sink_match.length >= 2) {
|
|
173
|
+
tempData['sink'] = tempData['sink'] || [];
|
|
174
|
+
tempData['sink'].push(element.name);
|
|
175
|
+
var sink_url = process.env.DEV_HTTP + process.env.DEV_PORT + "/uploads/assets/default/".concat(sink_match[1], ".gltf");
|
|
176
|
+
json_data.sink = sink_url;
|
|
177
|
+
} else if (temp.some(function (felement) {
|
|
178
|
+
return felement.name.includes('base_drawer');
|
|
179
|
+
}) && element.name.includes('interior_drawer')) {
|
|
180
|
+
var objCnt = temp.filter(function (felement) {
|
|
181
|
+
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
182
|
+
}).length;
|
|
183
|
+
var phCnt = tempPlaceholders.filter(function (felement) {
|
|
184
|
+
return felement.name.includes('interior');
|
|
185
|
+
}).length;
|
|
186
|
+
drawerPHs = phCnt;
|
|
187
|
+
if (objCnt === 1 || phCnt % objCnt !== 0) {
|
|
188
|
+
if (tempData['base_drawer_1'] === undefined) {
|
|
189
|
+
tempData['base_drawer_1'] = [];
|
|
190
|
+
}
|
|
191
|
+
tempData['base_drawer_1'].push(element.name);
|
|
192
|
+
drawerKey++;
|
|
193
|
+
} else if (objCnt > 1 && phCnt % objCnt === 0) {
|
|
194
|
+
if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
|
|
195
|
+
tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
|
|
196
|
+
}
|
|
197
|
+
tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
|
|
198
|
+
drawerKey++;
|
|
199
|
+
}
|
|
200
|
+
} else if (temp.some(function (felement) {
|
|
201
|
+
return felement.name.includes('base_door');
|
|
202
|
+
}) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
|
|
203
|
+
var _objCnt = temp.filter(function (felement) {
|
|
204
|
+
return felement.name.includes('base_door');
|
|
205
|
+
}).length;
|
|
206
|
+
var _phCnt = tempPlaceholders.filter(function (felement) {
|
|
207
|
+
return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
|
|
208
|
+
}).length;
|
|
209
|
+
doorPHs = _phCnt;
|
|
210
|
+
if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
|
|
211
|
+
if (tempData['base_door_1'] === undefined) {
|
|
212
|
+
tempData['base_door_1'] = [];
|
|
213
|
+
}
|
|
214
|
+
tempData['base_door_1'].push(element.name);
|
|
215
|
+
doorKey++;
|
|
216
|
+
} else if (_objCnt > 1) {
|
|
217
|
+
if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
|
|
218
|
+
tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
|
|
219
|
+
}
|
|
220
|
+
tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
|
|
221
|
+
doorKey++;
|
|
222
|
+
}
|
|
223
|
+
} else if (temp.some(function (felement) {
|
|
224
|
+
return felement.name.includes('base_fixed_drawer_door');
|
|
225
|
+
}) && element.name.includes('_drawer_door_fixed')) {
|
|
226
|
+
var _objCnt2 = temp.filter(function (felement) {
|
|
227
|
+
return felement.name.includes('base_fixed_drawer_door');
|
|
228
|
+
}).length;
|
|
229
|
+
var _phCnt2 = tempPlaceholders.filter(function (felement) {
|
|
230
|
+
return felement.name.includes('_drawer_door_fixed');
|
|
231
|
+
}).length;
|
|
232
|
+
fixedPHs = _phCnt2;
|
|
233
|
+
if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
|
|
234
|
+
if (tempData['base_fixed_drawer_door_1'] === undefined) {
|
|
235
|
+
tempData['base_fixed_drawer_door_1'] = [];
|
|
236
|
+
}
|
|
237
|
+
tempData['base_fixed_drawer_door_1'].push(element.name);
|
|
238
|
+
fixedKey++;
|
|
239
|
+
} else if (_objCnt2 > 1) {
|
|
240
|
+
if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
|
|
241
|
+
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
|
|
242
|
+
}
|
|
243
|
+
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
|
|
244
|
+
fixedKey++;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
} else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
|
|
249
|
+
var objCnt = temp.filter(function (felement) {
|
|
250
|
+
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
251
|
+
}).length;
|
|
252
|
+
if (objCnt === 1 || drawerPHs % objCnt !== 0) {
|
|
253
|
+
if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
|
|
254
|
+
//get drawer door handle placeholders
|
|
255
|
+
var ph_temp = temp.find(function (felement) {
|
|
256
|
+
return felement.name === 'base_drawer_door_1';
|
|
257
|
+
});
|
|
258
|
+
if (ph_temp != undefined) {
|
|
259
|
+
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
260
|
+
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
261
|
+
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
262
|
+
});
|
|
263
|
+
for (var w = 0; w < drawerPHs; w++) {
|
|
264
|
+
if (!tempData['base_drawer_door_1'].some(function (el) {
|
|
265
|
+
return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
|
|
266
|
+
})) {
|
|
267
|
+
tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
|
|
268
|
+
//add drawer door handle placeholders
|
|
269
|
+
if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
|
|
270
|
+
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
|
|
275
|
+
if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
|
|
276
|
+
//get drawer door handle placeholders
|
|
277
|
+
var ph_temp = temp.find(function (felement) {
|
|
278
|
+
return felement.name === 'base_drawer_door' + t.name.slice(-2);
|
|
279
|
+
});
|
|
280
|
+
if (ph_temp != undefined) {
|
|
281
|
+
var ph_drawer_door_handle = ph_temp.data.data.nodes;
|
|
282
|
+
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
283
|
+
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
284
|
+
});
|
|
285
|
+
tempPlaceholders.forEach(function (element) {
|
|
286
|
+
if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
|
|
287
|
+
return el === t.name + '/' + element.name;
|
|
288
|
+
})) {
|
|
289
|
+
tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
|
|
290
|
+
//add drawer door handle placeholders
|
|
291
|
+
if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
|
|
292
|
+
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);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
} else if (t.name.includes('base_door')) {
|
|
298
|
+
var _objCnt3 = temp.filter(function (felement) {
|
|
299
|
+
return felement.name.includes('base_door');
|
|
300
|
+
}).length;
|
|
301
|
+
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
302
|
+
return el.name.includes('handle');
|
|
303
|
+
});
|
|
304
|
+
if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
|
|
305
|
+
if (tempData['door_handle_1'] === undefined) {
|
|
306
|
+
tempData['door_handle_1'] = [];
|
|
307
|
+
}
|
|
308
|
+
var _loop = function _loop() {
|
|
309
|
+
var phname = tempPlaceholders[0].name;
|
|
310
|
+
var newph = undefined;
|
|
311
|
+
if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
|
|
312
|
+
newph = tempPlaceholders.find(function (el) {
|
|
313
|
+
return el.name.isRightPlaceholder();
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
if (tempData['base_door_1'][_w].isRightPlaceholder()) {
|
|
317
|
+
newph = tempPlaceholders.find(function (el) {
|
|
318
|
+
return el.name.isLeftPlaceholder();
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
if (newph != undefined) {
|
|
322
|
+
phname = newph.name;
|
|
323
|
+
}
|
|
324
|
+
if (doorPHs === 1 && tempPlaceholders.find(function (el) {
|
|
325
|
+
return el.name.isLeftPlaceholder();
|
|
326
|
+
}) != undefined && tempPlaceholders.find(function (el) {
|
|
327
|
+
return el.name.isRightPlaceholder();
|
|
328
|
+
}) != undefined) {
|
|
329
|
+
has_single_door = true;
|
|
330
|
+
}
|
|
331
|
+
if (!tempData['door_handle_1'].some(function (el) {
|
|
332
|
+
return el === 'door_handle_1/' + phname;
|
|
333
|
+
})) {
|
|
334
|
+
tempData['door_handle_1'].push('base_door_1/' + phname);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
for (var _w = 0; _w < doorPHs; _w++) {
|
|
338
|
+
_loop();
|
|
339
|
+
}
|
|
340
|
+
} else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
|
|
341
|
+
if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
|
|
342
|
+
phname = tempPlaceholders[0].name;
|
|
343
|
+
newph = undefined;
|
|
344
|
+
var blAdd = true;
|
|
345
|
+
if (element.is_corner) {
|
|
346
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
347
|
+
newph = tempPlaceholders.find(function (el) {
|
|
348
|
+
return el.name.isLeftPlaceholder();
|
|
349
|
+
});
|
|
350
|
+
} else {
|
|
351
|
+
blAdd = false;
|
|
352
|
+
}
|
|
353
|
+
} else {
|
|
354
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
355
|
+
newph = tempPlaceholders.find(function (el) {
|
|
356
|
+
return el.name.isRightPlaceholder();
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
360
|
+
newph = tempPlaceholders.find(function (el) {
|
|
361
|
+
return el.name.isLeftPlaceholder();
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (blAdd) {
|
|
366
|
+
if (newph != undefined) {
|
|
367
|
+
phname = newph.name;
|
|
368
|
+
}
|
|
369
|
+
if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
|
|
370
|
+
return el === t.name + '/' + phname;
|
|
371
|
+
})) {
|
|
372
|
+
tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
} else if (t.name.includes('base_fixed_drawer_door')) {
|
|
377
|
+
var _objCnt4 = temp.filter(function (felement) {
|
|
378
|
+
return felement.name.includes('base_fixed_drawer_door');
|
|
379
|
+
}).length;
|
|
380
|
+
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
381
|
+
return el.name.includes('handle');
|
|
382
|
+
});
|
|
383
|
+
if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
|
|
384
|
+
if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
|
|
385
|
+
for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
|
|
386
|
+
phname = tempPlaceholders[0].name;
|
|
387
|
+
newph = undefined;
|
|
388
|
+
if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
|
|
389
|
+
newph = tempPlaceholders.find(function (el) {
|
|
390
|
+
return el.name.isRightPlaceholder();
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
|
|
394
|
+
newph = tempPlaceholders.find(function (el) {
|
|
395
|
+
return el.name.isLeftPlaceholder();
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
if (newph != undefined) {
|
|
399
|
+
phname = newph.name;
|
|
400
|
+
}
|
|
401
|
+
if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
|
|
402
|
+
return el === 'fixed_drawer_door_handle_1/' + phname;
|
|
403
|
+
})) {
|
|
404
|
+
tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
} else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
|
|
408
|
+
if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
|
|
409
|
+
tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
|
|
410
|
+
}
|
|
411
|
+
phname = tempPlaceholders[0].name;
|
|
412
|
+
newph = undefined;
|
|
413
|
+
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
414
|
+
newph = tempPlaceholders.find(function (el) {
|
|
415
|
+
return el.name.isRightPlaceholder();
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
419
|
+
newph = tempPlaceholders.find(function (el) {
|
|
420
|
+
return el.name.isLeftPlaceholder();
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
if (newph != undefined) {
|
|
424
|
+
phname = newph.name;
|
|
425
|
+
}
|
|
426
|
+
if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
|
|
427
|
+
return el === t.name + '/' + phname;
|
|
428
|
+
})) {
|
|
429
|
+
tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
tempPlaceholdersData.push({
|
|
436
|
+
id: parseInt(el, 10),
|
|
437
|
+
placeholders: tempData
|
|
438
|
+
});
|
|
439
|
+
return _context3.abrupt("return", tempPlaceholdersData);
|
|
440
|
+
case 5:
|
|
441
|
+
case "end":
|
|
442
|
+
return _context3.stop();
|
|
443
|
+
}
|
|
444
|
+
}, _callee3);
|
|
445
|
+
}));
|
|
446
|
+
return _parseTempPlaceholdersFromCabinetPayload.apply(this, arguments);
|
|
447
|
+
}
|
|
448
|
+
function updateCabinetPayload(_x6) {
|
|
449
|
+
return _updateCabinetPayload.apply(this, arguments);
|
|
450
|
+
}
|
|
451
|
+
function _updateCabinetPayload() {
|
|
452
|
+
_updateCabinetPayload = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(cabinetPayload) {
|
|
453
|
+
var tempPlaceholders, cabinetPayloadKeys, i;
|
|
454
|
+
return _regenerator["default"].wrap(function (_context4) {
|
|
455
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
456
|
+
case 0:
|
|
457
|
+
tempPlaceholders = [];
|
|
458
|
+
_context4.next = 1;
|
|
459
|
+
return parseTempPlaceholdersFromCabinetPayload(cabinetPayload);
|
|
460
|
+
case 1:
|
|
461
|
+
tempPlaceholders = _context4.sent;
|
|
462
|
+
cabinetPayloadKeys = Object.keys(cabinetPayload);
|
|
463
|
+
for (i = 0; i < cabinetPayloadKeys.length; i++) {
|
|
464
|
+
if (cabinetPayloadKeys[i] === 'structure_json') {
|
|
465
|
+
cabinetPayload[cabinetPayloadKeys[i]]['placeholders'] = tempPlaceholders[0].placeholders;
|
|
466
|
+
cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] = tempPlaceholders;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return _context4.abrupt("return", cabinetPayload);
|
|
470
|
+
case 2:
|
|
471
|
+
case "end":
|
|
472
|
+
return _context4.stop();
|
|
473
|
+
}
|
|
474
|
+
}, _callee4);
|
|
475
|
+
}));
|
|
476
|
+
return _updateCabinetPayload.apply(this, arguments);
|
|
477
|
+
}
|
|
478
|
+
function handleExternalEvent(_x7) {
|
|
479
|
+
return _handleExternalEvent.apply(this, arguments);
|
|
480
|
+
}
|
|
481
|
+
function _handleExternalEvent() {
|
|
482
|
+
_handleExternalEvent = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(props) {
|
|
483
|
+
var evt, state, sLineCnt, elementJs, _element, catalog, outlineSVGData, catalogInstance, _evt$payload, moveType, moveValue, value, defaulTitle, _evt$payload2, doorStyle, itemCDS, isAll, _doorStyle, _value, _zoomValue, _value2, _zoomValue2, _evt$payload3, moldingInfo, isGlobal, _t5, _t6;
|
|
484
|
+
return _regenerator["default"].wrap(function (_context5) {
|
|
485
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
83
486
|
case 0:
|
|
84
487
|
evt = props.externalEvent;
|
|
85
488
|
state = props.state.get('KitchenConfigurator');
|
|
86
|
-
|
|
87
|
-
|
|
489
|
+
_t5 = evt === null || evt === void 0 ? void 0 : evt.type;
|
|
490
|
+
_context5.next = _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_3D ? 1 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_2D ? 2 : _t5 === _constants.EXTERNAL_EVENT_TOGGLE_TO_ELEVATION ? 3 : _t5 === _constants.EXTERNAL_EVENT_ADD_WALL ? 4 : _t5 === _constants.EXTERNAL_EVENT_ADD_ITEM ? 5 : _t5 === _constants.EXTERNAL_EVENT_MOVE_PAN ? 10 : _t5 === _constants.EXTERNAL_EVENT_NEW_PROJECT ? 16 : _t5 === _constants.EXTERNAL_EVENT_CHANGE_DOORSTYLE ? 17 : _t5 === _constants.EXTERNAL_EVENT_SET_INITIAL_DATA ? 18 : _t5 === _constants.EXTERNAL_EVENT_ADD_ROOM_SHAPE ? 19 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_IN ? 20 : _t5 === _constants.EXTERNAL_EVENT_ZOOM_OUT ? 23 : _t5 === _constants.EXTERNAL_EVENT_UNDO ? 26 : _t5 === _constants.EXTERNAL_EVENT_REDO ? 27 : _t5 === _constants.EXTERNAL_EVENT_SET_MOLDING ? 28 : 29;
|
|
88
491
|
break;
|
|
89
492
|
case 1:
|
|
90
493
|
props.projectActions.setMode(_constants.MODE_IDLE_3D);
|
|
91
|
-
return
|
|
494
|
+
return _context5.abrupt("continue", 29);
|
|
92
495
|
case 2:
|
|
93
496
|
props.projectActions.setMode(_constants.MODE_IDLE);
|
|
94
|
-
return
|
|
497
|
+
return _context5.abrupt("continue", 29);
|
|
95
498
|
case 3:
|
|
96
499
|
sLineCnt = state.getIn(['scene', 'layers', 'layer-1', 'selected', 'lines']).size;
|
|
97
500
|
if (sLineCnt > 0) props.projectActions.setMode(_constants.MODE_ELEVATION_VIEW);
|
|
98
|
-
return
|
|
501
|
+
return _context5.abrupt("continue", 29);
|
|
99
502
|
case 4:
|
|
100
503
|
if (state.mode === _constants.MODE_IDLE || state.mode === _constants.MODE_2D_PAN) props.linesActions.selectToolDrawingLine('wall');else {
|
|
101
504
|
props.projectActions.setMode(_constants.MODE_IDLE);
|
|
102
505
|
props.linesActions.selectToolDrawingLine('wall');
|
|
103
506
|
}
|
|
104
|
-
return
|
|
507
|
+
return _context5.abrupt("continue", 29);
|
|
105
508
|
case 5:
|
|
106
509
|
if ((0, _helper.isEmpty)(evt === null || evt === void 0 ? void 0 : evt.payload)) {
|
|
107
|
-
|
|
510
|
+
_context5.next = 9;
|
|
108
511
|
break;
|
|
109
512
|
}
|
|
110
|
-
|
|
513
|
+
_element = evt.payload;
|
|
111
514
|
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[
|
|
113
|
-
|
|
515
|
+
if (!(0, _helper.isEmpty)(catalog === null || catalog === void 0 ? void 0 : catalog.elements[_element.name])) {
|
|
516
|
+
_context5.next = 8;
|
|
114
517
|
break;
|
|
115
518
|
}
|
|
116
|
-
|
|
117
|
-
return loadSVGsByItem(
|
|
519
|
+
_context5.next = 6;
|
|
520
|
+
return loadSVGsByItem(_element);
|
|
118
521
|
case 6:
|
|
119
|
-
outlineSVGData =
|
|
522
|
+
outlineSVGData = _context5.sent;
|
|
120
523
|
catalogInstance = props.catalog;
|
|
121
|
-
|
|
524
|
+
_context5.next = 7;
|
|
525
|
+
return updateCabinetPayload(_element);
|
|
526
|
+
case 7:
|
|
527
|
+
elementJs = _context5.sent;
|
|
528
|
+
elementJs = (0, _exporter["default"])(_objectSpread(_objectSpread({}, elementJs), {}, {
|
|
122
529
|
outlineSVGData: outlineSVGData,
|
|
123
530
|
type: 'cabinet',
|
|
124
531
|
render2DItem: _itemLoader.render2DItem,
|
|
@@ -128,51 +535,51 @@ function _handleExternalEvent() {
|
|
|
128
535
|
catalogInstance.registerElement(elementJs);
|
|
129
536
|
props.projectActions.addElementToCatalog(elementJs);
|
|
130
537
|
}
|
|
131
|
-
case
|
|
538
|
+
case 8:
|
|
132
539
|
// start drawing item
|
|
133
|
-
_constants.ARRAY_3D_MODES.includes(state.mode) ? props.itemsActions.selectToolDrawingItem3D(
|
|
134
|
-
props.projectActions.pushLastSelectedCatalogElementToHistory(
|
|
540
|
+
_constants.ARRAY_3D_MODES.includes(state.mode) ? props.itemsActions.selectToolDrawingItem3D(_element.name) : props.itemsActions.selectToolDrawingItem(_element.name);
|
|
541
|
+
props.projectActions.pushLastSelectedCatalogElementToHistory(_element);
|
|
135
542
|
props.projectActions.setIsCabinetDrawing(true);
|
|
136
|
-
case 8:
|
|
137
|
-
return _context2.abrupt("continue", 28);
|
|
138
543
|
case 9:
|
|
544
|
+
return _context5.abrupt("continue", 29);
|
|
545
|
+
case 10:
|
|
139
546
|
_evt$payload = evt.payload, moveType = _evt$payload.moveType, moveValue = _evt$payload.moveValue;
|
|
140
547
|
value = state.getIn(['viewer2D']).toJS();
|
|
141
|
-
|
|
142
|
-
|
|
548
|
+
_t6 = moveType;
|
|
549
|
+
_context5.next = _t6 === _constants.TOP ? 11 : _t6 === _constants.BOTTOM ? 12 : _t6 === _constants.RIGHT ? 13 : _t6 === _constants.LEFT ? 14 : 15;
|
|
143
550
|
break;
|
|
144
|
-
case 10:
|
|
145
|
-
value.f -= moveValue;
|
|
146
|
-
return _context2.abrupt("continue", 14);
|
|
147
551
|
case 11:
|
|
148
|
-
value.f
|
|
149
|
-
return
|
|
552
|
+
value.f -= moveValue;
|
|
553
|
+
return _context5.abrupt("continue", 15);
|
|
150
554
|
case 12:
|
|
151
|
-
value.
|
|
152
|
-
return
|
|
555
|
+
value.f += moveValue;
|
|
556
|
+
return _context5.abrupt("continue", 15);
|
|
153
557
|
case 13:
|
|
154
|
-
value.e
|
|
155
|
-
return
|
|
558
|
+
value.e += moveValue;
|
|
559
|
+
return _context5.abrupt("continue", 15);
|
|
156
560
|
case 14:
|
|
157
|
-
|
|
158
|
-
return
|
|
561
|
+
value.e -= moveValue;
|
|
562
|
+
return _context5.abrupt("continue", 15);
|
|
159
563
|
case 15:
|
|
564
|
+
if (compareSVGRect(value)) props.viewer2DActions.updateCameraView(value);
|
|
565
|
+
return _context5.abrupt("continue", 29);
|
|
566
|
+
case 16:
|
|
160
567
|
defaulTitle = 'Untitle';
|
|
161
568
|
props.projectActions.newProject();
|
|
162
569
|
props.projectActions.rename(defaulTitle);
|
|
163
|
-
return
|
|
164
|
-
case
|
|
570
|
+
return _context5.abrupt("continue", 29);
|
|
571
|
+
case 17:
|
|
165
572
|
_evt$payload2 = evt.payload, doorStyle = _evt$payload2.doorStyle, itemCDS = _evt$payload2.itemCDS, isAll = _evt$payload2.isAll;
|
|
166
573
|
props.itemsActions.setDoorStyle(doorStyle, itemCDS, isAll);
|
|
167
|
-
return
|
|
168
|
-
case
|
|
574
|
+
return _context5.abrupt("continue", 29);
|
|
575
|
+
case 18:
|
|
169
576
|
_doorStyle = evt.payload.doorStyle;
|
|
170
577
|
props.itemsActions.setInitialDoorStyle(_doorStyle.doorStyle);
|
|
171
|
-
return
|
|
172
|
-
case 18:
|
|
173
|
-
props.projectActions.loadProject(evt.payload);
|
|
174
|
-
return _context2.abrupt("continue", 28);
|
|
578
|
+
return _context5.abrupt("continue", 29);
|
|
175
579
|
case 19:
|
|
580
|
+
props.projectActions.loadProject(evt.payload);
|
|
581
|
+
return _context5.abrupt("continue", 29);
|
|
582
|
+
case 20:
|
|
176
583
|
_value = state.getIn(['viewer2D']).toJS();
|
|
177
584
|
_value.a -= 0.1;
|
|
178
585
|
_value.d -= 0.1;
|
|
@@ -180,17 +587,17 @@ function _handleExternalEvent() {
|
|
|
180
587
|
_value.f += _value.SVGHeight * 0.1 / 2;
|
|
181
588
|
_zoomValue = parseInt((_value.a - 0.5) / _constants.ZOOM_VARIABLE);
|
|
182
589
|
if (!(_zoomValue > 404)) {
|
|
183
|
-
|
|
590
|
+
_context5.next = 21;
|
|
184
591
|
break;
|
|
185
592
|
}
|
|
186
|
-
return
|
|
187
|
-
case
|
|
593
|
+
return _context5.abrupt("return");
|
|
594
|
+
case 21:
|
|
188
595
|
if (!(_zoomValue < 35 || Number.isNaN(_zoomValue))) {
|
|
189
|
-
|
|
596
|
+
_context5.next = 22;
|
|
190
597
|
break;
|
|
191
598
|
}
|
|
192
|
-
return
|
|
193
|
-
case
|
|
599
|
+
return _context5.abrupt("return");
|
|
600
|
+
case 22:
|
|
194
601
|
while (!(_value.e <= 10)) {
|
|
195
602
|
_value.e -= 0.1;
|
|
196
603
|
}
|
|
@@ -204,8 +611,8 @@ function _handleExternalEvent() {
|
|
|
204
611
|
_value.f += 0.1;
|
|
205
612
|
}
|
|
206
613
|
if (compareSVGRect(_value)) props.viewer2DActions.updateCameraView(_value);
|
|
207
|
-
return
|
|
208
|
-
case
|
|
614
|
+
return _context5.abrupt("continue", 29);
|
|
615
|
+
case 23:
|
|
209
616
|
_value2 = state.getIn(['viewer2D']).toJS();
|
|
210
617
|
_value2.a += 0.1;
|
|
211
618
|
_value2.d += 0.1;
|
|
@@ -213,34 +620,34 @@ function _handleExternalEvent() {
|
|
|
213
620
|
_value2.f -= _value2.SVGHeight * 0.1 / 2;
|
|
214
621
|
_zoomValue2 = parseInt((_value2.a - 0.5) / _constants.ZOOM_VARIABLE);
|
|
215
622
|
if (!(_zoomValue2 > 404)) {
|
|
216
|
-
|
|
623
|
+
_context5.next = 24;
|
|
217
624
|
break;
|
|
218
625
|
}
|
|
219
|
-
return
|
|
220
|
-
case
|
|
626
|
+
return _context5.abrupt("return");
|
|
627
|
+
case 24:
|
|
221
628
|
if (!(_zoomValue2 < 35 || Number.isNaN(_zoomValue2))) {
|
|
222
|
-
|
|
629
|
+
_context5.next = 25;
|
|
223
630
|
break;
|
|
224
631
|
}
|
|
225
|
-
return
|
|
226
|
-
case 24:
|
|
227
|
-
if (compareSVGRect(_value2)) props.viewer2DActions.updateCameraView(_value2);
|
|
228
|
-
return _context2.abrupt("continue", 28);
|
|
632
|
+
return _context5.abrupt("return");
|
|
229
633
|
case 25:
|
|
230
|
-
props.
|
|
231
|
-
return
|
|
634
|
+
if (compareSVGRect(_value2)) props.viewer2DActions.updateCameraView(_value2);
|
|
635
|
+
return _context5.abrupt("continue", 29);
|
|
232
636
|
case 26:
|
|
233
|
-
props.projectActions.
|
|
234
|
-
return
|
|
637
|
+
props.projectActions.undo();
|
|
638
|
+
return _context5.abrupt("continue", 29);
|
|
235
639
|
case 27:
|
|
640
|
+
props.projectActions.redo();
|
|
641
|
+
return _context5.abrupt("continue", 29);
|
|
642
|
+
case 28:
|
|
236
643
|
_evt$payload3 = evt.payload, moldingInfo = _evt$payload3.moldingInfo, isGlobal = _evt$payload3.isGlobal;
|
|
237
644
|
props.itemsActions.setMolding(moldingInfo, isGlobal);
|
|
238
|
-
return
|
|
239
|
-
case
|
|
645
|
+
return _context5.abrupt("continue", 29);
|
|
646
|
+
case 29:
|
|
240
647
|
case "end":
|
|
241
|
-
return
|
|
648
|
+
return _context5.stop();
|
|
242
649
|
}
|
|
243
|
-
},
|
|
650
|
+
}, _callee5);
|
|
244
651
|
}));
|
|
245
652
|
return _handleExternalEvent.apply(this, arguments);
|
|
246
653
|
}
|