kitchen-simulator 7.0.5-react-18 → 7.0.6-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.
@@ -146,13 +146,7 @@ var Project = /*#__PURE__*/function () {
146
146
  if (w != 0 && Math.abs(w) != Infinity && h != 0 && Math.abs(h) != Infinity) {
147
147
  a = viewer.viewerHeight < h ? viewer.viewerHeight / h : (viewer.viewerHeight / h * 3 / 5 - 0.5) / constants.ZOOM_VARIABLE > 400 ? viewer.viewerHeight / h * 400 / ((viewer.viewerHeight / h - 0.5) / constants.ZOOM_VARIABLE) : viewer.viewerHeight / h * 3 / 5;
148
148
  e = (viewer.viewerWidth - (bb.maxX + bb.minX) * a) / 2;
149
- f = (viewer.viewerHeight - (viewer.SVGHeight * 2 - bb.maxY - bb.minY) * a) / 2;
150
- var maxE = 10;
151
- var minE = viewer.viewerWidth - (a * viewer.SVGWidth + 10);
152
- e = Math.min(maxE, Math.max(minE, e));
153
- var maxF = 80;
154
- var minF = viewer.viewerHeight - (a * viewer.SVGHeight + 10);
155
- f = Math.min(maxF, Math.max(minF, f));
149
+ f = (viewer.viewerHeight - (bb.maxY + bb.minY) * a) / 2;
156
150
  _viewer2D = _viewer2D.merge({
157
151
  a: a,
158
152
  d: a,
@@ -174,7 +168,6 @@ var Project = /*#__PURE__*/function () {
174
168
  state = Item.setCounterTop(state, counterTop).updatedState;
175
169
  state = Area.setFloorStyles(state, floorStyle).updatedState;
176
170
  this.updateZoomScale(state, a);
177
- viewer2DActions.updateCameraView(_viewer2D);
178
171
  return {
179
172
  updatedState: state
180
173
  };
@@ -341,12 +341,29 @@ export var updateViwer2D = function updateViwer2D(value) {
341
341
  var _zoomValue = parseInt((value.a - 0.5) / ZOOM_VARIABLE);
342
342
  if (_zoomValue > MAX_ZOOM_IN_SCALE) return;
343
343
  if (_zoomValue < 0 || Number.isNaN(_zoomValue)) return;
344
- var maxE = 10;
345
- var minE = value.viewerWidth - (value.a * value.SVGWidth + 10);
346
- value.e = Math.min(maxE, Math.max(minE, value.e));
347
- var maxF = 80;
348
- var minF = value.viewerHeight - (value.a * value.SVGHeight + 10);
349
- value.f = Math.min(maxF, Math.max(minF, value.f));
344
+ var scaledWidth = value.a * value.SVGWidth;
345
+ var scaledHeight = value.a * value.SVGHeight;
346
+
347
+ /* ---------- Horizontal ---------- */
348
+ if (scaledWidth <= value.viewerWidth) {
349
+ // scene smaller than viewport → force center
350
+ value.e = (value.viewerWidth - scaledWidth) / 2;
351
+ } else {
352
+ // scene larger → clamp normally
353
+ var maxE = 10;
354
+ var minE = value.viewerWidth - (scaledWidth + 10);
355
+ value.e = Math.min(maxE, Math.max(minE, value.e));
356
+ }
357
+
358
+ /* ---------- Vertical ---------- */
359
+ if (scaledHeight <= value.viewerHeight) {
360
+ // scene smaller than viewport → force center
361
+ value.f = (value.viewerHeight - scaledHeight) / 2;
362
+ } else {
363
+ var maxF = 80;
364
+ var minF = value.viewerHeight - (scaledHeight + 10);
365
+ value.f = Math.min(maxF, Math.max(minF, value.f));
366
+ }
350
367
  if (viewer2DActions && compareSVGRect(value)) viewer2DActions.updateCameraView(value);
351
368
  };
352
369
  export function centering2D(state) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "7.0.5-react-18",
3
+ "version": "7.0.6-react-18",
4
4
  "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "module": "es/index.js",