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
|
@@ -130,6 +130,7 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
130
130
|
_this.setShowProperty = _this.setShowProperty.bind(_this);
|
|
131
131
|
|
|
132
132
|
// cache for viewer2D init so we don't allocate merges every render
|
|
133
|
+
_this._lastExtractedStateRef = null;
|
|
133
134
|
_this._cachedViewer2DKey = null;
|
|
134
135
|
_this._cachedExtractedState = null;
|
|
135
136
|
return _this;
|
|
@@ -378,32 +379,38 @@ var LiteKitchenConfigurator = /*#__PURE__*/function (_Component) {
|
|
|
378
379
|
key: "getExtractedStateWithViewer2DInit",
|
|
379
380
|
value: function getExtractedStateWithViewer2DInit(extractedState, width, height) {
|
|
380
381
|
if (!extractedState) return extractedState;
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
|
|
383
|
+
// ✅ If the extractedState reference changed, drop cache immediately.
|
|
384
|
+
if (this._lastExtractedStateRef !== extractedState) {
|
|
385
|
+
this._lastExtractedStateRef = extractedState;
|
|
386
|
+
this._cachedViewer2DKey = null;
|
|
387
|
+
this._cachedExtractedState = null;
|
|
388
|
+
}
|
|
383
389
|
var _viewer2D = extractedState.getIn(['viewer2D']);
|
|
384
390
|
if (!_viewer2D || _viewer2D.size <= 0) return extractedState;
|
|
385
391
|
var v = _viewer2D.toJS();
|
|
386
|
-
|
|
392
|
+
|
|
393
|
+
// Only do the "center viewer2D if e/f are zero" logic.
|
|
394
|
+
// ✅ No need to build keys from unrelated parts of state.
|
|
395
|
+
if (v.e !== 0 || v.f !== 0) return extractedState;
|
|
396
|
+
|
|
397
|
+
// Build a cache key ONLY for this viewer2D-centering computation.
|
|
398
|
+
var cacheKey = "".concat(width, ":").concat(height, ":").concat(v.viewerWidth, ":").concat(v.viewerHeight, ":").concat(v.SVGWidth, ":").concat(v.SVGHeight);
|
|
387
399
|
if (this._cachedViewer2DKey === cacheKey && this._cachedExtractedState) {
|
|
388
400
|
return this._cachedExtractedState;
|
|
389
401
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
});
|
|
400
|
-
this._cachedViewer2DKey = cacheKey;
|
|
401
|
-
this._cachedExtractedState = merged;
|
|
402
|
-
return merged;
|
|
403
|
-
}
|
|
402
|
+
var centeredViewer2D = _viewer2D.merge({
|
|
403
|
+
e: v.viewerWidth / 2 - v.SVGWidth / 2,
|
|
404
|
+
f: v.viewerHeight / 2 - v.SVGHeight / 2,
|
|
405
|
+
a: 0.99,
|
|
406
|
+
d: 0.99
|
|
407
|
+
});
|
|
408
|
+
var merged = extractedState.merge({
|
|
409
|
+
viewer2D: centeredViewer2D
|
|
410
|
+
});
|
|
404
411
|
this._cachedViewer2DKey = cacheKey;
|
|
405
|
-
this._cachedExtractedState =
|
|
406
|
-
return
|
|
412
|
+
this._cachedExtractedState = merged;
|
|
413
|
+
return merged;
|
|
407
414
|
}
|
|
408
415
|
}, {
|
|
409
416
|
key: "render",
|
|
@@ -507,7 +514,8 @@ function mapStateToProps(reduxState, ownProps) {
|
|
|
507
514
|
};
|
|
508
515
|
var extractedState = stateExtractor(reduxState);
|
|
509
516
|
return {
|
|
510
|
-
extractedState: extractedState
|
|
517
|
+
extractedState: extractedState,
|
|
518
|
+
state: extractedState
|
|
511
519
|
};
|
|
512
520
|
}
|
|
513
521
|
function mapDispatchToProps(dispatch) {
|