labellife-design-tool 2.0.9 → 2.1.0
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/dist/cjs/canvas/workspace.js +11 -5
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/index.js +51 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/store.js +40 -10
- package/dist/cjs/model/store.js.map +1 -1
- package/dist/esm/canvas/workspace.js +11 -5
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/index.js +51 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/store.js +40 -10
- package/dist/esm/model/store.js.map +1 -1
- package/package.json +1 -1
|
@@ -1993,15 +1993,21 @@ var Workspace = mobxReactLite.observer(function (_ref6) {
|
|
|
1993
1993
|
height: height
|
|
1994
1994
|
});
|
|
1995
1995
|
|
|
1996
|
-
// Auto-fit the canvas
|
|
1997
|
-
if
|
|
1996
|
+
// Auto-fit the canvas.
|
|
1997
|
+
// Guard: if the container hasn't been laid out yet (width/height === 0)
|
|
1998
|
+
// the arithmetic produces a negative scale which mirrors the entire canvas.
|
|
1999
|
+
// Skip the update in that case — the ResizeObserver will fire again once
|
|
2000
|
+
// the container has real dimensions.
|
|
2001
|
+
if (store.width > 0 && store.height > 0 && width > 0 && height > 0) {
|
|
1998
2002
|
var padding = 40;
|
|
1999
2003
|
var scaleX = (width - padding * 2) / store.width;
|
|
2000
2004
|
var scaleY = (height - padding * 2) / store.height;
|
|
2001
2005
|
var _scale = Math.min(scaleX, scaleY, 1);
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
store.
|
|
2006
|
+
if (_scale > 0) {
|
|
2007
|
+
store._setScaleToFit(_scale);
|
|
2008
|
+
if (store.scale === 1) {
|
|
2009
|
+
store.setScale(_scale);
|
|
2010
|
+
}
|
|
2005
2011
|
}
|
|
2006
2012
|
}
|
|
2007
2013
|
};
|