kitchen-simulator 3.16.1-test-renderer-fix → 3.16.3-test-renderer-fix
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 +28 -20
- package/es/index.js +277 -220
- package/es/utils/isolate-event-handler.js +1 -1
- package/lib/LiteKitchenConfigurator.js +28 -20
- package/lib/index.js +277 -220
- package/lib/utils/isolate-event-handler.js +1 -1
- package/package.json +1 -1
|
@@ -122,6 +122,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
122
122
|
_this.setShowProperty = _this.setShowProperty.bind(_this);
|
|
123
123
|
|
|
124
124
|
// cache for viewer2D init so we don't allocate merges every render
|
|
125
|
+
_this._lastExtractedStateRef = null;
|
|
125
126
|
_this._cachedViewer2DKey = null;
|
|
126
127
|
_this._cachedExtractedState = null;
|
|
127
128
|
return _this;
|
|
@@ -370,32 +371,38 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
370
371
|
key: "getExtractedStateWithViewer2DInit",
|
|
371
372
|
value: function getExtractedStateWithViewer2DInit(extractedState, width, height) {
|
|
372
373
|
if (!extractedState) return extractedState;
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
|
|
375
|
+
// ✅ If the extractedState reference changed, drop cache immediately.
|
|
376
|
+
if (this._lastExtractedStateRef !== extractedState) {
|
|
377
|
+
this._lastExtractedStateRef = extractedState;
|
|
378
|
+
this._cachedViewer2DKey = null;
|
|
379
|
+
this._cachedExtractedState = null;
|
|
380
|
+
}
|
|
375
381
|
var _viewer2D = extractedState.getIn(['viewer2D']);
|
|
376
382
|
if (!_viewer2D || _viewer2D.size <= 0) return extractedState;
|
|
377
383
|
var v = _viewer2D.toJS();
|
|
378
|
-
|
|
384
|
+
|
|
385
|
+
// Only do the "center viewer2D if e/f are zero" logic.
|
|
386
|
+
// ✅ No need to build keys from unrelated parts of state.
|
|
387
|
+
if (v.e !== 0 || v.f !== 0) return extractedState;
|
|
388
|
+
|
|
389
|
+
// Build a cache key ONLY for this viewer2D-centering computation.
|
|
390
|
+
var cacheKey = "".concat(width, ":").concat(height, ":").concat(v.viewerWidth, ":").concat(v.viewerHeight, ":").concat(v.SVGWidth, ":").concat(v.SVGHeight);
|
|
379
391
|
if (this._cachedViewer2DKey === cacheKey && this._cachedExtractedState) {
|
|
380
392
|
return this._cachedExtractedState;
|
|
381
393
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
});
|
|
392
|
-
this._cachedViewer2DKey = cacheKey;
|
|
393
|
-
this._cachedExtractedState = merged;
|
|
394
|
-
return merged;
|
|
395
|
-
}
|
|
394
|
+
var centeredViewer2D = _viewer2D.merge({
|
|
395
|
+
e: v.viewerWidth / 2 - v.SVGWidth / 2,
|
|
396
|
+
f: v.viewerHeight / 2 - v.SVGHeight / 2,
|
|
397
|
+
a: 0.99,
|
|
398
|
+
d: 0.99
|
|
399
|
+
});
|
|
400
|
+
var merged = extractedState.merge({
|
|
401
|
+
viewer2D: centeredViewer2D
|
|
402
|
+
});
|
|
396
403
|
this._cachedViewer2DKey = cacheKey;
|
|
397
|
-
this._cachedExtractedState =
|
|
398
|
-
return
|
|
404
|
+
this._cachedExtractedState = merged;
|
|
405
|
+
return merged;
|
|
399
406
|
}
|
|
400
407
|
}, {
|
|
401
408
|
key: "render",
|
|
@@ -499,7 +506,8 @@ function mapStateToProps(reduxState, ownProps) {
|
|
|
499
506
|
};
|
|
500
507
|
var extractedState = stateExtractor(reduxState);
|
|
501
508
|
return {
|
|
502
|
-
extractedState: extractedState
|
|
509
|
+
extractedState: extractedState,
|
|
510
|
+
state: extractedState
|
|
503
511
|
};
|
|
504
512
|
}
|
|
505
513
|
function mapDispatchToProps(dispatch) {
|