layerchart 1.0.2 → 1.0.3

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.
@@ -95,7 +95,7 @@
95
95
  return path(data ?? $contextData);
96
96
  }
97
97
 
98
- $: tweenedOptions = tweened
98
+ const tweenedOptions = tweened
99
99
  ? { interpolate: interpolatePath, ...(typeof tweened === 'object' ? tweened : null) }
100
100
  : false;
101
101
  $: tweened_d = motionStore(defaultPathData(), { tweened: tweenedOptions });
@@ -65,8 +65,9 @@
65
65
  $: markerEndId = markerEnd || $$slots['markerEnd'] ? uniqueId('marker-') : '';
66
66
 
67
67
  export let tweened: boolean | Parameters<typeof tweenedStore>[1] = undefined;
68
- // @ts-expect-error
69
- $: tweenedOptions = tweened ? { interpolate: interpolatePath, ...tweened } : false;
68
+ const tweenedOptions = tweened
69
+ ? { interpolate: interpolatePath, ...(typeof tweened === 'object' ? tweened : null) }
70
+ : false;
70
71
  $: tweened_d = motionStore('', { tweened: tweenedOptions });
71
72
 
72
73
  $: {
@@ -149,8 +149,9 @@
149
149
  }
150
150
 
151
151
  let d: string | null = '';
152
- // @ts-expect-error
153
- $: tweenedOptions = tweened ? { interpolate: interpolatePath, ...tweened } : false;
152
+ const tweenedOptions = tweened
153
+ ? { interpolate: interpolatePath, ...(typeof tweened === 'object' ? tweened : null) }
154
+ : false;
154
155
  $: tweened_d = motionStore(defaultPathData(), { tweened: tweenedOptions });
155
156
  $: {
156
157
  const path = $radial
@@ -130,15 +130,15 @@
130
130
  center: { x: number; y: number },
131
131
  rect?: { width: number; height: number }
132
132
  ) {
133
- // TODO: Improve with geo/projection
133
+ const newScale = rect ? ($width < $height ? $width / rect.width : $height / rect.height) : 1;
134
134
 
135
135
  $translate = {
136
- x: $width / 2 - center.x,
137
- y: $height / 2 - center.y,
136
+ x: $width / 2 - center.x * newScale,
137
+ y: $height / 2 - center.y * newScale,
138
138
  };
139
139
 
140
140
  if (rect) {
141
- $scale = $width < $height ? $width / rect.width : $height / rect.height;
141
+ $scale = newScale;
142
142
  }
143
143
  }
144
144
 
@@ -192,7 +192,7 @@
192
192
  const point = localPoint(e, containerNode);
193
193
 
194
194
  if (
195
- tooltipData === null && // mode !== 'manual' but support annotations
195
+ tooltipData == null && // mode !== 'manual' but support annotations
196
196
  (point.x < tooltipContextNode.offsetLeft ||
197
197
  point.x > tooltipContextNode.offsetLeft + tooltipContextNode.offsetWidth ||
198
198
  point.y < tooltipContextNode.offsetTop ||
@@ -0,0 +1,2 @@
1
+ import { memoize } from 'lodash-es';
2
+ export const memoizeObject = memoize((obj) => obj, (obj) => JSON.stringify(obj));
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Sean Lynch <techniq35@gmail.com>",
5
5
  "license": "MIT",
6
6
  "repository": "techniq/layerchart",
7
- "version": "1.0.2",
7
+ "version": "1.0.3",
8
8
  "devDependencies": {
9
9
  "@changesets/cli": "^2.28.1",
10
10
  "@mdi/js": "^7.4.47",