@opendata-ai/openchart-vanilla 8.0.0-rc.4 → 8.0.0-rc.6

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.
@@ -1497,6 +1497,12 @@ function scheduleFontReload(fontFamily, isAlive, onReady) {
1497
1497
  }
1498
1498
 
1499
1499
  // src/map-mount.ts
1500
+ function focusSignature(focus) {
1501
+ if (!focus) return null;
1502
+ const t = focus.target;
1503
+ const ids = focus.ids.map(String).sort().join(",");
1504
+ return `${ids}|${Math.round(t.x)},${Math.round(t.y)},${Math.round(t.width)},${Math.round(t.height)},${t.padding}`;
1505
+ }
1500
1506
  function prefersReducedMotion() {
1501
1507
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return false;
1502
1508
  try {
@@ -1823,7 +1829,7 @@ function createMap(container, spec, options) {
1823
1829
  const canAnimate = !animationCleanup && !prefersReducedMotion();
1824
1830
  const prevFills = canAnimate ? captureFeatureFills(svgElement) : null;
1825
1831
  const prevFocusIds = currentFocusIds ? currentFocusIds.map(String).sort().join(",") : null;
1826
- const prevFocusPadding = currentLayout.focus?.target.padding ?? null;
1832
+ const prevFocusSig = focusSignature(currentLayout.focus);
1827
1833
  currentLayout = compile();
1828
1834
  render();
1829
1835
  if (canAnimate && prevFills && prevFills.size > 0 && svgElement && currentLayout.animation?.update) {
@@ -1832,9 +1838,8 @@ function createMap(container, spec, options) {
1832
1838
  });
1833
1839
  }
1834
1840
  const nextFocus = currentLayout.focus;
1835
- const nextFocusIds = nextFocus ? nextFocus.ids.map(String).sort().join(",") : null;
1836
- const nextFocusPadding = nextFocus?.target.padding ?? null;
1837
- if (nextFocusIds !== prevFocusIds || nextFocusPadding !== prevFocusPadding) {
1841
+ const nextFocusSig = focusSignature(nextFocus);
1842
+ if (nextFocusSig !== prevFocusSig) {
1838
1843
  if (nextFocus) {
1839
1844
  currentFocusIds = [...nextFocus.ids];
1840
1845
  const cam = cameraForTarget(currentLayout, nextFocus.target);
@@ -6671,4 +6676,4 @@ export {
6671
6676
  createYouDrawIt,
6672
6677
  createChart
6673
6678
  };
6674
- //# sourceMappingURL=chunk-43Y7EBT7.js.map
6679
+ //# sourceMappingURL=chunk-XZZGLZDA.js.map