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.
@@ -310,13 +310,26 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
310
310
  }, {
311
311
  key: "componentDidUpdate",
312
312
  value: function componentDidUpdate(prevProps) {
313
- var _this2 = this,
314
- _extractedState$getIn2;
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
- cancelAnimationFrame(this._scheduledExternalEventRaf);
348
+ clearTimeout(this._scheduledExternalEventRaf);
336
349
  this._scheduledExternalEventRaf = null;
337
350
  }
338
- this._scheduledExternalEventRaf = requestAnimationFrame(function () {
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$getIn2 = extractedState.getIn) === null || _extractedState$getIn2 === void 0 ? void 0 : _extractedState$getIn2.call(extractedState, ['catalog', 'ready']);
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 = merged;
423
- return merged;
421
+ this._cachedExtractedState = extractedState;
422
+ return extractedState;
424
423
  }
425
424
  }, {
426
425
  key: "render",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "5.10.11-react.18",
3
+ "version": "5.10.13-react.18",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "module": "es/index.js",