labellife-design-tool 2.0.9 → 2.1.1

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.
@@ -168,11 +168,20 @@ function _unsupportedIterableToArray(r, a) {
168
168
  }
169
169
  }
170
170
 
171
- var translations = {};
171
+ // Use a window-level singleton so that all Rollup bundles (config, toolbar,
172
+ // side-panel, canvas) share the same translations object. Without this each
173
+ // bundle gets its own copy of this module with a separate local variable.
174
+ var GLOBAL_KEY = '__labellife_translations__';
175
+ if (typeof window !== 'undefined' && !window[GLOBAL_KEY]) {
176
+ window[GLOBAL_KEY] = {};
177
+ }
178
+ function _get() {
179
+ return typeof window !== 'undefined' && window[GLOBAL_KEY] || {};
180
+ }
172
181
  function t(key, defaultValue) {
173
182
  // Support dot-notation paths like 'toolbar.duration'
174
183
  var parts = key.split('.');
175
- var current = translations;
184
+ var current = _get();
176
185
  var _iterator = _createForOfIteratorHelper(parts),
177
186
  _step;
178
187
  try {
@@ -1993,15 +2002,21 @@ var Workspace = mobxReactLite.observer(function (_ref6) {
1993
2002
  height: height
1994
2003
  });
1995
2004
 
1996
- // Auto-fit the canvas
1997
- if (store.width > 0 && store.height > 0) {
2005
+ // Auto-fit the canvas.
2006
+ // Guard: if the container hasn't been laid out yet (width/height === 0)
2007
+ // the arithmetic produces a negative scale which mirrors the entire canvas.
2008
+ // Skip the update in that case — the ResizeObserver will fire again once
2009
+ // the container has real dimensions.
2010
+ if (store.width > 0 && store.height > 0 && width > 0 && height > 0) {
1998
2011
  var padding = 40;
1999
2012
  var scaleX = (width - padding * 2) / store.width;
2000
2013
  var scaleY = (height - padding * 2) / store.height;
2001
2014
  var _scale = Math.min(scaleX, scaleY, 1);
2002
- store._setScaleToFit(_scale);
2003
- if (store.scale === 1) {
2004
- store.setScale(_scale);
2015
+ if (_scale > 0) {
2016
+ store._setScaleToFit(_scale);
2017
+ if (store.scale === 1) {
2018
+ store.setScale(_scale);
2019
+ }
2005
2020
  }
2006
2021
  }
2007
2022
  };