kitchen-simulator 10.10.0 → 10.11.0
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.
|
@@ -84,9 +84,9 @@ function parseTempPlaceholdersFromCabinetPayload(_x2) {
|
|
|
84
84
|
/***** Update cabinetPayloadData with updatedTempPlaceholders *****/
|
|
85
85
|
function _parseTempPlaceholdersFromCabinetPayload() {
|
|
86
86
|
_parseTempPlaceholdersFromCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(cabinetPayload) {
|
|
87
|
-
var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, tempPlaceholdersData,
|
|
88
|
-
return _regeneratorRuntime.wrap(function (
|
|
89
|
-
while (1) switch (
|
|
87
|
+
var link, keys, temp, i, _cabinetPayload$struc, _cabinetPayload$struc2, tempPlaceholdersData, k, _cabinetPayload$struc3, el, tempData, doorKey, drawerKey, fixedKey, doorPHs, drawerPHs, has_single_door, fixedPHs, _t2, _t3, _t4;
|
|
88
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
89
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
90
90
|
case 0:
|
|
91
91
|
link = '';
|
|
92
92
|
keys = Object.keys(cabinetPayload.structure_json);
|
|
@@ -94,356 +94,341 @@ function _parseTempPlaceholdersFromCabinetPayload() {
|
|
|
94
94
|
i = 0;
|
|
95
95
|
case 1:
|
|
96
96
|
if (!(i < keys.length)) {
|
|
97
|
-
|
|
97
|
+
_context4.next = 4;
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
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'))) {
|
|
101
|
-
|
|
101
|
+
_context4.next = 3;
|
|
102
102
|
break;
|
|
103
103
|
}
|
|
104
104
|
link = cabinetPayload.structure_json[keys[i]];
|
|
105
105
|
_t2 = temp;
|
|
106
106
|
_t3 = keys[i];
|
|
107
|
-
|
|
107
|
+
_context4.next = 2;
|
|
108
108
|
return loadJSON(link);
|
|
109
109
|
case 2:
|
|
110
|
-
_t4 =
|
|
110
|
+
_t4 = _context4.sent;
|
|
111
111
|
_t2.push.call(_t2, {
|
|
112
112
|
name: _t3,
|
|
113
113
|
data: _t4
|
|
114
114
|
});
|
|
115
115
|
case 3:
|
|
116
116
|
i++;
|
|
117
|
-
|
|
117
|
+
_context4.next = 1;
|
|
118
118
|
break;
|
|
119
119
|
case 4:
|
|
120
120
|
tempPlaceholdersData = [];
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
164
|
-
}).length;
|
|
165
|
-
var phCnt = tempPlaceholders.filter(function (felement) {
|
|
166
|
-
return felement.name.includes('interior');
|
|
167
|
-
}).length;
|
|
168
|
-
drawerPHs = phCnt;
|
|
169
|
-
if (objCnt === 1 || phCnt % objCnt !== 0) {
|
|
170
|
-
if (tempData['base_drawer_1'] === undefined) {
|
|
171
|
-
tempData['base_drawer_1'] = [];
|
|
172
|
-
}
|
|
173
|
-
tempData['base_drawer_1'].push(element.name);
|
|
174
|
-
drawerKey++;
|
|
175
|
-
} else if (objCnt > 1 && phCnt % objCnt === 0) {
|
|
176
|
-
if (tempData['base_drawer_' + (drawerKey % objCnt + 1)] === undefined) {
|
|
177
|
-
tempData['base_drawer_' + (drawerKey % objCnt + 1)] = [];
|
|
178
|
-
}
|
|
179
|
-
tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
|
|
180
|
-
drawerKey++;
|
|
181
|
-
}
|
|
182
|
-
} else if (temp.some(function (felement) {
|
|
183
|
-
return felement.name.includes('base_door');
|
|
184
|
-
}) && !element.name.includes('interior_drawer') && !element.name.includes('drawer') && element.name.includes('door')) {
|
|
185
|
-
var _objCnt = temp.filter(function (felement) {
|
|
186
|
-
return felement.name.includes('base_door');
|
|
187
|
-
}).length;
|
|
188
|
-
var _phCnt = tempPlaceholders.filter(function (felement) {
|
|
189
|
-
return !felement.name.includes('interior') && !felement.name.includes('drawer') && felement.name.includes('door');
|
|
190
|
-
}).length;
|
|
191
|
-
doorPHs = _phCnt;
|
|
192
|
-
if (_objCnt === 1 || _phCnt % _objCnt !== 0) {
|
|
193
|
-
if (tempData['base_door_1'] === undefined) {
|
|
194
|
-
tempData['base_door_1'] = [];
|
|
195
|
-
}
|
|
196
|
-
tempData['base_door_1'].push(element.name);
|
|
197
|
-
doorKey++;
|
|
198
|
-
} else if (_objCnt > 1) {
|
|
199
|
-
if (tempData['base_door_' + (doorKey % _objCnt + 1)] === undefined) {
|
|
200
|
-
tempData['base_door_' + (doorKey % _objCnt + 1)] = [];
|
|
201
|
-
}
|
|
202
|
-
tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
|
|
203
|
-
doorKey++;
|
|
204
|
-
}
|
|
205
|
-
} else if (temp.some(function (felement) {
|
|
206
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
207
|
-
}) && element.name.includes('_drawer_door_fixed')) {
|
|
208
|
-
var _objCnt2 = temp.filter(function (felement) {
|
|
209
|
-
return felement.name.includes('base_fixed_drawer_door');
|
|
210
|
-
}).length;
|
|
211
|
-
var _phCnt2 = tempPlaceholders.filter(function (felement) {
|
|
212
|
-
return felement.name.includes('_drawer_door_fixed');
|
|
213
|
-
}).length;
|
|
214
|
-
fixedPHs = _phCnt2;
|
|
215
|
-
if (_objCnt2 === 1 || _phCnt2 % _objCnt2 !== 0) {
|
|
216
|
-
if (tempData['base_fixed_drawer_door_1'] === undefined) {
|
|
217
|
-
tempData['base_fixed_drawer_door_1'] = [];
|
|
218
|
-
}
|
|
219
|
-
tempData['base_fixed_drawer_door_1'].push(element.name);
|
|
220
|
-
fixedKey++;
|
|
221
|
-
} else if (_objCnt2 > 1) {
|
|
222
|
-
if (tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] === undefined) {
|
|
223
|
-
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)] = [];
|
|
224
|
-
}
|
|
225
|
-
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
|
|
226
|
-
fixedKey++;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
} else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
|
|
121
|
+
for (k = 0; 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); k++) {
|
|
122
|
+
el = cabinetPayload.structure_json.tempPlaceholders[k].id;
|
|
123
|
+
tempData = {};
|
|
124
|
+
doorKey = 0;
|
|
125
|
+
drawerKey = 0;
|
|
126
|
+
fixedKey = 0;
|
|
127
|
+
doorPHs = 0;
|
|
128
|
+
drawerPHs = 0;
|
|
129
|
+
has_single_door = false;
|
|
130
|
+
fixedPHs = 0;
|
|
131
|
+
temp.forEach(function (t, index) {
|
|
132
|
+
var nodes = t.data.nodes;
|
|
133
|
+
if (nodes === undefined) {
|
|
134
|
+
nodes = [];
|
|
135
|
+
}
|
|
136
|
+
var tempPlaceholders = nodes.filter(function (element) {
|
|
137
|
+
return element.name.startsWith('ph_');
|
|
138
|
+
});
|
|
139
|
+
tempPlaceholders.sort(function (a, b) {
|
|
140
|
+
return a.name > b.name ? 1 : -1;
|
|
141
|
+
});
|
|
142
|
+
if (tempPlaceholders.length > 0) {
|
|
143
|
+
if (t.name === 'base') {
|
|
144
|
+
tempPlaceholders.map(function (element) {
|
|
145
|
+
var sink_match = element.name.match(/\d_(sink_[^LR12]*)(_[LR12])?$/);
|
|
146
|
+
if (sink_match && sink_match.length >= 2) {
|
|
147
|
+
var _cabinetPayload$ccdf_;
|
|
148
|
+
tempData['sink'] = tempData['sink'] || [];
|
|
149
|
+
tempData['sink'].push(element.name);
|
|
150
|
+
// Resolve sink asset via ccdf.assets3d based on placeholder_name
|
|
151
|
+
var sinkPlaceholderName = sink_match[1]; // e.g. sink_farm_large
|
|
152
|
+
var assets3d = cabinetPayload === null || cabinetPayload === void 0 || (_cabinetPayload$ccdf_ = cabinetPayload.ccdf_list) === null || _cabinetPayload$ccdf_ === void 0 ? void 0 : _cabinetPayload$ccdf_.find(function (ccdf) {
|
|
153
|
+
return ccdf.cabinet_id === cabinetPayload.itemID;
|
|
154
|
+
}).assets3d;
|
|
155
|
+
var sinkAsset = Array.isArray(assets3d) && assets3d.find(function (a) {
|
|
156
|
+
return a && a.placeholder_name === sinkPlaceholderName && a.gltf;
|
|
157
|
+
});
|
|
158
|
+
if (sinkAsset !== null && sinkAsset !== void 0 && sinkAsset.gltf && cabinetPayload !== null && cabinetPayload !== void 0 && cabinetPayload.structure_json) {
|
|
159
|
+
cabinetPayload.structure_json.sink = sinkAsset.gltf;
|
|
160
|
+
} else if (temp.some(function (felement) {
|
|
161
|
+
return felement.name.includes('base_drawer');
|
|
162
|
+
}) && element.name.includes('interior_drawer')) {
|
|
231
163
|
var objCnt = temp.filter(function (felement) {
|
|
232
164
|
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
233
165
|
}).length;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
242
|
-
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
243
|
-
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
244
|
-
});
|
|
245
|
-
for (var w = 0; w < drawerPHs; w++) {
|
|
246
|
-
if (!tempData['base_drawer_door_1'].some(function (el) {
|
|
247
|
-
return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
|
|
248
|
-
})) {
|
|
249
|
-
tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
|
|
250
|
-
//add drawer door handle placeholders
|
|
251
|
-
if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
|
|
252
|
-
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
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'] = [];
|
|
255
173
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
});
|
|
262
|
-
if (ph_temp != undefined) {
|
|
263
|
-
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
264
|
-
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
265
|
-
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
266
|
-
});
|
|
267
|
-
tempPlaceholders.forEach(function (element) {
|
|
268
|
-
if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
|
|
269
|
-
return el === t.name + '/' + element.name;
|
|
270
|
-
})) {
|
|
271
|
-
tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
|
|
272
|
-
//add drawer door handle placeholders
|
|
273
|
-
if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
|
|
274
|
-
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);
|
|
275
|
-
}
|
|
276
|
-
});
|
|
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)] = [];
|
|
277
179
|
}
|
|
180
|
+
tempData['base_drawer_' + (drawerKey % objCnt + 1)].push(element.name);
|
|
181
|
+
drawerKey++;
|
|
278
182
|
}
|
|
279
|
-
} else if (
|
|
280
|
-
|
|
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) {
|
|
281
187
|
return felement.name.includes('base_door');
|
|
282
188
|
}).length;
|
|
283
|
-
|
|
284
|
-
return
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
var _loop4 = function _loop4() {
|
|
291
|
-
var phname = tempPlaceholders[0].name;
|
|
292
|
-
var newph = undefined;
|
|
293
|
-
if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
|
|
294
|
-
newph = tempPlaceholders.find(function (el) {
|
|
295
|
-
return el.name.isRightPlaceholder();
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
if (tempData['base_door_1'][_w].isRightPlaceholder()) {
|
|
299
|
-
newph = tempPlaceholders.find(function (el) {
|
|
300
|
-
return el.name.isLeftPlaceholder();
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
if (newph != undefined) {
|
|
304
|
-
phname = newph.name;
|
|
305
|
-
}
|
|
306
|
-
if (doorPHs === 1 && tempPlaceholders.find(function (el) {
|
|
307
|
-
return el.name.isLeftPlaceholder();
|
|
308
|
-
}) != undefined && tempPlaceholders.find(function (el) {
|
|
309
|
-
return el.name.isRightPlaceholder();
|
|
310
|
-
}) != undefined) {
|
|
311
|
-
has_single_door = true;
|
|
312
|
-
}
|
|
313
|
-
if (!tempData['door_handle_1'].some(function (el) {
|
|
314
|
-
return el === 'door_handle_1/' + phname;
|
|
315
|
-
})) {
|
|
316
|
-
tempData['door_handle_1'].push('base_door_1/' + phname);
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
for (var _w = 0; _w < doorPHs; _w++) {
|
|
320
|
-
_loop4();
|
|
321
|
-
}
|
|
322
|
-
} else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
|
|
323
|
-
if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
|
|
324
|
-
var phname = tempPlaceholders[0].name;
|
|
325
|
-
var newph = undefined;
|
|
326
|
-
var blAdd = true;
|
|
327
|
-
if (cabinetPayload.is_corner) {
|
|
328
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
329
|
-
newph = tempPlaceholders.find(function (el) {
|
|
330
|
-
return el.name.isLeftPlaceholder();
|
|
331
|
-
});
|
|
332
|
-
} else {
|
|
333
|
-
blAdd = false;
|
|
334
|
-
}
|
|
335
|
-
} else {
|
|
336
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
337
|
-
newph = tempPlaceholders.find(function (el) {
|
|
338
|
-
return el.name.isRightPlaceholder();
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
342
|
-
newph = tempPlaceholders.find(function (el) {
|
|
343
|
-
return el.name.isLeftPlaceholder();
|
|
344
|
-
});
|
|
345
|
-
}
|
|
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'] = [];
|
|
346
196
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return el === t.name + '/' + phname;
|
|
353
|
-
})) {
|
|
354
|
-
tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
|
|
355
|
-
}
|
|
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)] = [];
|
|
356
202
|
}
|
|
203
|
+
tempData['base_door_' + (doorKey % _objCnt + 1)].push(element.name);
|
|
204
|
+
doorKey++;
|
|
357
205
|
}
|
|
358
|
-
} else if (
|
|
359
|
-
|
|
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) {
|
|
360
210
|
return felement.name.includes('base_fixed_drawer_door');
|
|
361
211
|
}).length;
|
|
362
|
-
|
|
363
|
-
return
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
var newph = undefined;
|
|
370
|
-
if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
|
|
371
|
-
newph = tempPlaceholders.find(function (el) {
|
|
372
|
-
return el.name.isRightPlaceholder();
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
|
|
376
|
-
newph = tempPlaceholders.find(function (el) {
|
|
377
|
-
return el.name.isLeftPlaceholder();
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
if (newph != undefined) {
|
|
381
|
-
phname = newph.name;
|
|
382
|
-
}
|
|
383
|
-
if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
|
|
384
|
-
return el === 'fixed_drawer_door_handle_1/' + phname;
|
|
385
|
-
})) {
|
|
386
|
-
tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
|
|
390
|
-
_loop5();
|
|
391
|
-
}
|
|
392
|
-
} else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
|
|
393
|
-
if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
|
|
394
|
-
tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
|
|
395
|
-
}
|
|
396
|
-
var _phname = tempPlaceholders[0].name;
|
|
397
|
-
var _newph = undefined;
|
|
398
|
-
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
399
|
-
_newph = tempPlaceholders.find(function (el) {
|
|
400
|
-
return el.name.isRightPlaceholder();
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
404
|
-
_newph = tempPlaceholders.find(function (el) {
|
|
405
|
-
return el.name.isLeftPlaceholder();
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
if (_newph != undefined) {
|
|
409
|
-
_phname = _newph.name;
|
|
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'] = [];
|
|
410
219
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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)] = [];
|
|
415
225
|
}
|
|
226
|
+
tempData['base_fixed_drawer_door_' + (fixedKey % _objCnt2 + 1)].push(element.name);
|
|
227
|
+
fixedKey++;
|
|
416
228
|
}
|
|
417
229
|
}
|
|
418
230
|
}
|
|
419
231
|
});
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
232
|
+
} else if (t.name.includes('base_drawer') && !t.name.includes('_door')) {
|
|
233
|
+
var objCnt = temp.filter(function (felement) {
|
|
234
|
+
return felement.name.includes('base_drawer') && !felement.name.includes('_door');
|
|
235
|
+
}).length;
|
|
236
|
+
if (objCnt === 1 || drawerPHs % objCnt !== 0) {
|
|
237
|
+
if (tempData['base_drawer_door_1'] === undefined) tempData['base_drawer_door_1'] = [];
|
|
238
|
+
//get drawer door handle placeholders
|
|
239
|
+
var ph_temp = temp.find(function (felement) {
|
|
240
|
+
return felement.name === 'base_drawer_door_1';
|
|
241
|
+
});
|
|
242
|
+
if (ph_temp != undefined) {
|
|
243
|
+
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
244
|
+
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
245
|
+
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
246
|
+
});
|
|
247
|
+
for (var w = 0; w < drawerPHs; w++) {
|
|
248
|
+
if (!tempData['base_drawer_door_1'].some(function (el) {
|
|
249
|
+
return el === 'base_drawer_door_1/' + tempPlaceholders[0].name;
|
|
250
|
+
})) {
|
|
251
|
+
tempData['base_drawer_door_1'].push('base_drawer_1/' + tempPlaceholders[0].name);
|
|
252
|
+
//add drawer door handle placeholders
|
|
253
|
+
if (tempData['drawer_door_handle_1'] === undefined) tempData['drawer_door_handle_1'] = [];
|
|
254
|
+
if (ph_drawer_door_handle.length > 0) tempData['drawer_door_handle_1'].push('base_drawer_door_1/' + ph_drawer_door_handle[0].name);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
} else if (objCnt > 1 && drawerPHs > 0 && drawerPHs % objCnt === 0) {
|
|
259
|
+
if (tempData['base_drawer_door' + t.name.slice(-2)] === undefined) tempData['base_drawer_door' + t.name.slice(-2)] = [];
|
|
260
|
+
//get drawer door handle placeholders
|
|
261
|
+
var ph_temp = temp.find(function (felement) {
|
|
262
|
+
return felement.name === 'base_drawer_door' + t.name.slice(-2);
|
|
263
|
+
});
|
|
264
|
+
if (ph_temp != undefined) {
|
|
265
|
+
var ph_drawer_door_handle = ph_temp.data.nodes;
|
|
266
|
+
ph_drawer_door_handle = ph_drawer_door_handle.filter(function (element) {
|
|
267
|
+
return element.name.startsWith('ph_') && element.name.includes('handle');
|
|
268
|
+
});
|
|
269
|
+
tempPlaceholders.forEach(function (element) {
|
|
270
|
+
if (!tempData['base_drawer_door' + t.name.slice(-2)].some(function (el) {
|
|
271
|
+
return el === t.name + '/' + element.name;
|
|
272
|
+
})) {
|
|
273
|
+
tempData['base_drawer_door' + t.name.slice(-2)].push(t.name + '/' + element.name);
|
|
274
|
+
//add drawer door handle placeholders
|
|
275
|
+
if (tempData['drawer_door_handle' + t.name.slice(-2)] === undefined) tempData['drawer_door_handle' + t.name.slice(-2)] = [];
|
|
276
|
+
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);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
} else if (t.name.includes('base_door')) {
|
|
282
|
+
var _objCnt3 = temp.filter(function (felement) {
|
|
283
|
+
return felement.name.includes('base_door');
|
|
284
|
+
}).length;
|
|
285
|
+
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
286
|
+
return el.name.includes('handle');
|
|
424
287
|
});
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
288
|
+
if (tempPlaceholders.length > 0) if (_objCnt3 === 1 || doorPHs % _objCnt3 !== 0) {
|
|
289
|
+
if (tempData['door_handle_1'] === undefined) {
|
|
290
|
+
tempData['door_handle_1'] = [];
|
|
291
|
+
}
|
|
292
|
+
var _loop3 = function _loop3() {
|
|
293
|
+
var phname = tempPlaceholders[0].name;
|
|
294
|
+
var newph = undefined;
|
|
295
|
+
if (tempData['base_door_1'][_w].isLeftPlaceholder()) {
|
|
296
|
+
newph = tempPlaceholders.find(function (el) {
|
|
297
|
+
return el.name.isRightPlaceholder();
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (tempData['base_door_1'][_w].isRightPlaceholder()) {
|
|
301
|
+
newph = tempPlaceholders.find(function (el) {
|
|
302
|
+
return el.name.isLeftPlaceholder();
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
if (newph != undefined) {
|
|
306
|
+
phname = newph.name;
|
|
307
|
+
}
|
|
308
|
+
if (doorPHs === 1 && tempPlaceholders.find(function (el) {
|
|
309
|
+
return el.name.isLeftPlaceholder();
|
|
310
|
+
}) != undefined && tempPlaceholders.find(function (el) {
|
|
311
|
+
return el.name.isRightPlaceholder();
|
|
312
|
+
}) != undefined) {
|
|
313
|
+
has_single_door = true;
|
|
314
|
+
}
|
|
315
|
+
if (!tempData['door_handle_1'].some(function (el) {
|
|
316
|
+
return el === 'door_handle_1/' + phname;
|
|
317
|
+
})) {
|
|
318
|
+
tempData['door_handle_1'].push('base_door_1/' + phname);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
for (var _w = 0; _w < doorPHs; _w++) {
|
|
322
|
+
_loop3();
|
|
323
|
+
}
|
|
324
|
+
} else if (_objCnt3 > 1 && doorPHs > 0 && doorPHs % _objCnt3 === 0) {
|
|
325
|
+
if (tempData['door_handle' + t.name.slice(-2)] === undefined) tempData['door_handle' + t.name.slice(-2)] = [];
|
|
326
|
+
var phname = tempPlaceholders[0].name;
|
|
327
|
+
var newph = undefined;
|
|
328
|
+
var blAdd = true;
|
|
329
|
+
if (cabinetPayload.is_corner) {
|
|
330
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
331
|
+
newph = tempPlaceholders.find(function (el) {
|
|
332
|
+
return el.name.isLeftPlaceholder();
|
|
333
|
+
});
|
|
334
|
+
} else {
|
|
335
|
+
blAdd = false;
|
|
336
|
+
}
|
|
337
|
+
} else {
|
|
338
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
339
|
+
newph = tempPlaceholders.find(function (el) {
|
|
340
|
+
return el.name.isRightPlaceholder();
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
if (tempData['base_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
344
|
+
newph = tempPlaceholders.find(function (el) {
|
|
345
|
+
return el.name.isLeftPlaceholder();
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (blAdd) {
|
|
350
|
+
if (newph != undefined) {
|
|
351
|
+
phname = newph.name;
|
|
352
|
+
}
|
|
353
|
+
if (!tempData['door_handle' + t.name.slice(-2)].some(function (el) {
|
|
354
|
+
return el === t.name + '/' + phname;
|
|
355
|
+
})) {
|
|
356
|
+
tempData['door_handle' + t.name.slice(-2)].push(t.name + '/' + phname);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
} else if (t.name.includes('base_fixed_drawer_door')) {
|
|
361
|
+
var _objCnt4 = temp.filter(function (felement) {
|
|
362
|
+
return felement.name.includes('base_fixed_drawer_door');
|
|
363
|
+
}).length;
|
|
364
|
+
tempPlaceholders = tempPlaceholders.filter(function (el) {
|
|
365
|
+
return el.name.includes('handle');
|
|
366
|
+
});
|
|
367
|
+
if (tempPlaceholders.length > 0) if (_objCnt4 === 1 || fixedPHs % _objCnt4 !== 0) {
|
|
368
|
+
if (tempData['fixed_drawer_door_handle_1'] === undefined) tempData['fixed_drawer_door_handle_1'] = [];
|
|
369
|
+
var _loop4 = function _loop4() {
|
|
370
|
+
var phname = tempPlaceholders[0].name;
|
|
371
|
+
var newph = undefined;
|
|
372
|
+
if (tempData['base_fixed_drawer_door_1'][_w2].isLeftPlaceholder()) {
|
|
373
|
+
newph = tempPlaceholders.find(function (el) {
|
|
374
|
+
return el.name.isRightPlaceholder();
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
if (tempData['base_fixed_drawer_door_1'][_w2].isRightPlaceholder()) {
|
|
378
|
+
newph = tempPlaceholders.find(function (el) {
|
|
379
|
+
return el.name.isLeftPlaceholder();
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
if (newph != undefined) {
|
|
383
|
+
phname = newph.name;
|
|
384
|
+
}
|
|
385
|
+
if (!tempData['fixed_drawer_door_handle_1'].some(function (el) {
|
|
386
|
+
return el === 'fixed_drawer_door_handle_1/' + phname;
|
|
387
|
+
})) {
|
|
388
|
+
tempData['fixed_drawer_door_handle_1'].push('base_fixed_drawer_door_1/' + phname);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
for (var _w2 = 0; _w2 < fixedPHs; _w2++) {
|
|
392
|
+
_loop4();
|
|
393
|
+
}
|
|
394
|
+
} else if (_objCnt4 > 1 && fixedPHs > 0 && fixedPHs % _objCnt4 === 0) {
|
|
395
|
+
if (tempData['fixed_drawer_door_handle' + t.name.slice(-2)] === undefined) {
|
|
396
|
+
tempData['fixed_drawer_door_handle' + t.name.slice(-2)] = [];
|
|
397
|
+
}
|
|
398
|
+
var _phname = tempPlaceholders[0].name;
|
|
399
|
+
var _newph = undefined;
|
|
400
|
+
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isLeftPlaceholder()) {
|
|
401
|
+
_newph = tempPlaceholders.find(function (el) {
|
|
402
|
+
return el.name.isRightPlaceholder();
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
if (tempData['base_fixed_drawer_door' + t.name.slice(-2)][0].isRightPlaceholder()) {
|
|
406
|
+
_newph = tempPlaceholders.find(function (el) {
|
|
407
|
+
return el.name.isLeftPlaceholder();
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
if (_newph != undefined) {
|
|
411
|
+
_phname = _newph.name;
|
|
412
|
+
}
|
|
413
|
+
if (!tempData['fixed_drawer_door_handle' + t.name.slice(-2)].some(function (el) {
|
|
414
|
+
return el === t.name + '/' + _phname;
|
|
415
|
+
})) {
|
|
416
|
+
tempData['fixed_drawer_door_handle' + t.name.slice(-2)].push(t.name + '/' + _phname);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
428
420
|
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
break;
|
|
421
|
+
});
|
|
422
|
+
tempPlaceholdersData.push({
|
|
423
|
+
id: parseInt(el, 10),
|
|
424
|
+
placeholders: tempData,
|
|
425
|
+
structure: cabinetPayload.structure_json.tempPlaceholders[k].structure
|
|
426
|
+
});
|
|
436
427
|
}
|
|
437
|
-
return
|
|
438
|
-
case
|
|
439
|
-
k++;
|
|
440
|
-
_context5.next = 5;
|
|
441
|
-
break;
|
|
442
|
-
case 7:
|
|
443
|
-
return _context5.abrupt("return", tempPlaceholdersData);
|
|
444
|
-
case 8:
|
|
428
|
+
return _context4.abrupt("return", tempPlaceholdersData);
|
|
429
|
+
case 5:
|
|
445
430
|
case "end":
|
|
446
|
-
return
|
|
431
|
+
return _context4.stop();
|
|
447
432
|
}
|
|
448
433
|
}, _callee4);
|
|
449
434
|
}));
|
|
@@ -455,14 +440,14 @@ function updateCabinetPayload(_x3) {
|
|
|
455
440
|
function _updateCabinetPayload() {
|
|
456
441
|
_updateCabinetPayload = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(cabinetPayload) {
|
|
457
442
|
var tempPlaceholders, cabinetPayloadKeys, i;
|
|
458
|
-
return _regeneratorRuntime.wrap(function (
|
|
459
|
-
while (1) switch (
|
|
443
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
444
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
460
445
|
case 0:
|
|
461
446
|
tempPlaceholders = [];
|
|
462
|
-
|
|
447
|
+
_context5.next = 1;
|
|
463
448
|
return parseTempPlaceholdersFromCabinetPayload(cabinetPayload);
|
|
464
449
|
case 1:
|
|
465
|
-
tempPlaceholders =
|
|
450
|
+
tempPlaceholders = _context5.sent;
|
|
466
451
|
cabinetPayloadKeys = Object.keys(cabinetPayload);
|
|
467
452
|
for (i = 0; i < cabinetPayloadKeys.length; i++) {
|
|
468
453
|
if (cabinetPayloadKeys[i] === 'structure_json') {
|
|
@@ -474,10 +459,10 @@ function _updateCabinetPayload() {
|
|
|
474
459
|
cabinetPayload[cabinetPayloadKeys[i]]['tempPlaceholders'] = tempPlaceholders;
|
|
475
460
|
}
|
|
476
461
|
}
|
|
477
|
-
return
|
|
462
|
+
return _context5.abrupt("return", cabinetPayload);
|
|
478
463
|
case 2:
|
|
479
464
|
case "end":
|
|
480
|
-
return
|
|
465
|
+
return _context5.stop();
|
|
481
466
|
}
|
|
482
467
|
}, _callee5);
|
|
483
468
|
}));
|
|
@@ -583,22 +568,22 @@ function _addItemToCatalog() {
|
|
|
583
568
|
_addItemToCatalog = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(element, state, catalogInstance, projectActions) {
|
|
584
569
|
var _elementJs, _elementJs3;
|
|
585
570
|
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;
|
|
586
|
-
return _regeneratorRuntime.wrap(function (
|
|
587
|
-
while (1) switch (
|
|
571
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
572
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
588
573
|
case 0:
|
|
589
574
|
if (!isEmpty(element === null || element === void 0 ? void 0 : element.name)) {
|
|
590
|
-
|
|
575
|
+
_context6.next = 1;
|
|
591
576
|
break;
|
|
592
577
|
}
|
|
593
|
-
return
|
|
578
|
+
return _context6.abrupt("return");
|
|
594
579
|
case 1:
|
|
595
580
|
elementJs = populateCCDFList(element); // if (isEmpty(catalog?.elements[element.name])) {
|
|
596
|
-
|
|
581
|
+
_context6.next = 2;
|
|
597
582
|
return loadSVGsByItem(elementJs);
|
|
598
583
|
case 2:
|
|
599
|
-
outlineSVGData =
|
|
584
|
+
outlineSVGData = _context6.sent;
|
|
600
585
|
if (!(((_elementJs = elementJs) === null || _elementJs === void 0 ? void 0 : _elementJs.type) === 'cabinet')) {
|
|
601
|
-
|
|
586
|
+
_context6.next = 4;
|
|
602
587
|
break;
|
|
603
588
|
}
|
|
604
589
|
// move the tempPlaceholder of current door style to first of tempPlaceholders array
|
|
@@ -626,13 +611,13 @@ function _addItemToCatalog() {
|
|
|
626
611
|
}
|
|
627
612
|
});
|
|
628
613
|
if (isEmpty((_elementJs$structure_3 = elementJs.structure_json) === null || _elementJs$structure_3 === void 0 ? void 0 : _elementJs$structure_3.tempPlaceholders)) {
|
|
629
|
-
|
|
614
|
+
_context6.next = 4;
|
|
630
615
|
break;
|
|
631
616
|
}
|
|
632
|
-
|
|
617
|
+
_context6.next = 3;
|
|
633
618
|
return updateCabinetPayload(elementJs);
|
|
634
619
|
case 3:
|
|
635
|
-
elementJs =
|
|
620
|
+
elementJs = _context6.sent;
|
|
636
621
|
case 4:
|
|
637
622
|
elementJs = _objectSpread(_objectSpread({}, elementJs), {}, {
|
|
638
623
|
outlineSVGData: outlineSVGData,
|
|
@@ -649,18 +634,18 @@ function _addItemToCatalog() {
|
|
|
649
634
|
k = 0;
|
|
650
635
|
case 5:
|
|
651
636
|
if (!(k < catalogElementKeys.length)) {
|
|
652
|
-
|
|
637
|
+
_context6.next = 7;
|
|
653
638
|
break;
|
|
654
639
|
}
|
|
655
640
|
if (!(((_catalogElements$cata = catalogElements[catalogElementKeys[k]]) === null || _catalogElements$cata === void 0 ? void 0 : _catalogElements$cata.itemID) === elementJs.itemID)) {
|
|
656
|
-
|
|
641
|
+
_context6.next = 6;
|
|
657
642
|
break;
|
|
658
643
|
}
|
|
659
644
|
catalogItem = catalogElements[catalogElementKeys[k]];
|
|
660
|
-
return
|
|
645
|
+
return _context6.abrupt("continue", 7);
|
|
661
646
|
case 6:
|
|
662
647
|
k++;
|
|
663
|
-
|
|
648
|
+
_context6.next = 5;
|
|
664
649
|
break;
|
|
665
650
|
case 7:
|
|
666
651
|
// get old tempPlaceholder array from catalog item
|
|
@@ -691,7 +676,7 @@ function _addItemToCatalog() {
|
|
|
691
676
|
}
|
|
692
677
|
case 8:
|
|
693
678
|
case "end":
|
|
694
|
-
return
|
|
679
|
+
return _context6.stop();
|
|
695
680
|
}
|
|
696
681
|
}, _callee6);
|
|
697
682
|
}));
|
|
@@ -1058,10 +1043,10 @@ export function loadMoldingSvg(_x9) {
|
|
|
1058
1043
|
}
|
|
1059
1044
|
function _loadMoldingSvg() {
|
|
1060
1045
|
_loadMoldingSvg = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(molding) {
|
|
1061
|
-
return _regeneratorRuntime.wrap(function (
|
|
1062
|
-
while (1) switch (
|
|
1046
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
1047
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1063
1048
|
case 0:
|
|
1064
|
-
return
|
|
1049
|
+
return _context7.abrupt("return", new Promise(function (resolve, reject) {
|
|
1065
1050
|
var url = molding === null || molding === void 0 ? void 0 : molding.shape_svg;
|
|
1066
1051
|
if (!url) {
|
|
1067
1052
|
// Skip if no SVG URL available
|
|
@@ -1083,7 +1068,7 @@ function _loadMoldingSvg() {
|
|
|
1083
1068
|
}));
|
|
1084
1069
|
case 1:
|
|
1085
1070
|
case "end":
|
|
1086
|
-
return
|
|
1071
|
+
return _context7.stop();
|
|
1087
1072
|
}
|
|
1088
1073
|
}, _callee7);
|
|
1089
1074
|
}));
|