kitchen-simulator 5.10.11-react.18 → 5.10.13-react.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/LiteKitchenConfigurator.js +22 -23
- package/package.json +1 -1
|
@@ -310,13 +310,26 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
310
310
|
}, {
|
|
311
311
|
key: "componentDidUpdate",
|
|
312
312
|
value: function componentDidUpdate(prevProps) {
|
|
313
|
-
var
|
|
314
|
-
|
|
313
|
+
var _extractedState$getIn2,
|
|
314
|
+
_this2 = this,
|
|
315
|
+
_extractedState$getIn3;
|
|
315
316
|
var _this$props2 = this.props,
|
|
316
317
|
externalEvent = _this$props2.externalEvent,
|
|
317
318
|
extractedState = _this$props2.extractedState,
|
|
318
319
|
projectActions = _this$props2.projectActions,
|
|
319
320
|
catalog = _this$props2.catalog;
|
|
321
|
+
var viewer2D = extractedState === null || extractedState === void 0 || (_extractedState$getIn2 = extractedState.getIn) === null || _extractedState$getIn2 === void 0 ? void 0 : _extractedState$getIn2.call(extractedState, ['viewer2D']);
|
|
322
|
+
if (viewer2D) {
|
|
323
|
+
var v = viewer2D.toJS();
|
|
324
|
+
if (v.e === 0 && v.f === 0) {
|
|
325
|
+
projectActions.updateViewer2D({
|
|
326
|
+
e: v.viewerWidth / 2 - v.SVGWidth / 2,
|
|
327
|
+
f: v.viewerHeight / 2 - v.SVGHeight / 2,
|
|
328
|
+
a: 0.99,
|
|
329
|
+
d: 0.99
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
320
333
|
|
|
321
334
|
// ---- (A) External event handling (snapshot + defer) ----
|
|
322
335
|
if (prevProps.externalEvent !== externalEvent && externalEvent) {
|
|
@@ -332,31 +345,26 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
332
345
|
var propsSnapshot = this.props;
|
|
333
346
|
var type = (externalEvent === null || externalEvent === void 0 ? void 0 : externalEvent.type) || 'unknown';
|
|
334
347
|
if (this._scheduledExternalEventRaf) {
|
|
335
|
-
|
|
348
|
+
clearTimeout(this._scheduledExternalEventRaf);
|
|
336
349
|
this._scheduledExternalEventRaf = null;
|
|
337
350
|
}
|
|
338
|
-
this._scheduledExternalEventRaf =
|
|
351
|
+
this._scheduledExternalEventRaf = setTimeout(function () {
|
|
339
352
|
_this2._scheduledExternalEventRaf = null;
|
|
340
353
|
console.time("[handleExternalEvent] ".concat(type));
|
|
341
354
|
try {
|
|
342
|
-
// IMPORTANT: use snapshot so handler sees matching props
|
|
343
355
|
handleExternalEvent(propsSnapshot);
|
|
344
356
|
} catch (e) {
|
|
345
357
|
console.error('[LiteKitchenConfigurator] handleExternalEvent crashed', e);
|
|
346
358
|
} finally {
|
|
347
359
|
console.timeEnd("[handleExternalEvent] ".concat(type));
|
|
348
|
-
|
|
349
|
-
// clear flag in a macrotask so we definitely yield once
|
|
350
|
-
setTimeout(function () {
|
|
351
|
-
_this2._handlingExternalEvent = false;
|
|
352
|
-
}, 0);
|
|
360
|
+
_this2._handlingExternalEvent = false;
|
|
353
361
|
}
|
|
354
|
-
});
|
|
362
|
+
}, 0);
|
|
355
363
|
}
|
|
356
364
|
}
|
|
357
365
|
|
|
358
366
|
// ---- (B) initCatalog: request once until ready ----
|
|
359
|
-
var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$
|
|
367
|
+
var catalogReady = extractedState === null || extractedState === void 0 || (_extractedState$getIn3 = extractedState.getIn) === null || _extractedState$getIn3 === void 0 ? void 0 : _extractedState$getIn3.call(extractedState, ['catalog', 'ready']);
|
|
360
368
|
if (catalogReady) {
|
|
361
369
|
if (this._catalogInitRequested) console.log('[LiteKitchenConfigurator] catalog ready');
|
|
362
370
|
this._catalogInitRequested = false;
|
|
@@ -409,18 +417,9 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
409
417
|
if (this._cachedViewer2DKey === cacheKey && this._cachedExtractedState) {
|
|
410
418
|
return this._cachedExtractedState;
|
|
411
419
|
}
|
|
412
|
-
var centeredViewer2D = _viewer2D.merge({
|
|
413
|
-
e: v.viewerWidth / 2 - v.SVGWidth / 2,
|
|
414
|
-
f: v.viewerHeight / 2 - v.SVGHeight / 2,
|
|
415
|
-
a: 0.99,
|
|
416
|
-
d: 0.99
|
|
417
|
-
});
|
|
418
|
-
var merged = extractedState.merge({
|
|
419
|
-
viewer2D: centeredViewer2D
|
|
420
|
-
});
|
|
421
420
|
this._cachedViewer2DKey = cacheKey;
|
|
422
|
-
this._cachedExtractedState =
|
|
423
|
-
return
|
|
421
|
+
this._cachedExtractedState = extractedState;
|
|
422
|
+
return extractedState;
|
|
424
423
|
}
|
|
425
424
|
}, {
|
|
426
425
|
key: "render",
|