layerchart 0.6.0 → 0.6.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.
- package/components/ChartClipPath.svelte +1 -0
- package/components/ChartClipPath.svelte.d.ts +2 -0
- package/components/CircleClipPath.svelte +1 -1
- package/components/CircleClipPath.svelte.d.ts +2 -0
- package/components/RectClipPath.svelte +1 -1
- package/components/RectClipPath.svelte.d.ts +2 -0
- package/components/Zoom.svelte +20 -9
- package/components/Zoom.svelte.d.ts +3 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/package.json +1 -1
package/components/Zoom.svelte
CHANGED
|
@@ -3,6 +3,7 @@ import { motionStore } from '../stores/motionStore';
|
|
|
3
3
|
const { width, height, padding } = getContext('LayerCake');
|
|
4
4
|
export let spring = undefined;
|
|
5
5
|
export let tweened = undefined;
|
|
6
|
+
export let disablePointer = false;
|
|
6
7
|
let dragging = false;
|
|
7
8
|
const translate = motionStore({ x: 0, y: 0 }, { spring, tweened });
|
|
8
9
|
const scale = motionStore({ x: 1, y: 1 }, { spring, tweened });
|
|
@@ -44,6 +45,8 @@ export function zoomTo(newTranslate, newScale) {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
function handleMouseDown(e) {
|
|
48
|
+
if (disablePointer)
|
|
49
|
+
return;
|
|
47
50
|
dragging = true;
|
|
48
51
|
svgEl = e.target.ownerSVGElement;
|
|
49
52
|
startPoint = localPoint(svgEl, e);
|
|
@@ -68,9 +71,13 @@ function handleMouseMove(e) {
|
|
|
68
71
|
}, spring ? { hard: true } : tweened ? { duration: 0 } : undefined);
|
|
69
72
|
}
|
|
70
73
|
function handleDoubleClick() {
|
|
74
|
+
if (disablePointer)
|
|
75
|
+
return;
|
|
71
76
|
increase();
|
|
72
77
|
}
|
|
73
78
|
function handleWheel(e) {
|
|
79
|
+
if (disablePointer)
|
|
80
|
+
return;
|
|
74
81
|
e.preventDefault();
|
|
75
82
|
const scaleBy = -e.deltaY > 0 ? 1.1 : 0.9;
|
|
76
83
|
// TODO: Update to match d3-zoom delta
|
|
@@ -107,16 +114,20 @@ $: newTranslate = {
|
|
|
107
114
|
};
|
|
108
115
|
</script>
|
|
109
116
|
|
|
110
|
-
<
|
|
111
|
-
x={-$padding.left}
|
|
112
|
-
y={-$padding.top}
|
|
113
|
-
width={$width + $padding.left + $padding.right}
|
|
114
|
-
height={$height + $padding.top + $padding.bottom}
|
|
117
|
+
<g
|
|
115
118
|
on:mousewheel={handleWheel}
|
|
116
119
|
on:mousedown={handleMouseDown}
|
|
117
120
|
on:dblclick={handleDoubleClick}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<
|
|
121
|
-
|
|
121
|
+
on:click
|
|
122
|
+
>
|
|
123
|
+
<rect
|
|
124
|
+
x={-$padding.left}
|
|
125
|
+
y={-$padding.top}
|
|
126
|
+
width={$width + $padding.left + $padding.right}
|
|
127
|
+
height={$height + $padding.top + $padding.bottom}
|
|
128
|
+
fill="transparent"
|
|
129
|
+
/>
|
|
130
|
+
<g transform="translate({newTranslate.x},{newTranslate.y}) scale({$scale.x},{$scale.y})">
|
|
131
|
+
<slot scale={$scale} />
|
|
132
|
+
</g>
|
|
122
133
|
</g>
|
|
@@ -4,6 +4,7 @@ declare const __propDef: {
|
|
|
4
4
|
props: {
|
|
5
5
|
spring?: boolean | Parameters<typeof motionStore>[1]['spring'];
|
|
6
6
|
tweened?: boolean | Parameters<typeof motionStore>[1]['tweened'];
|
|
7
|
+
disablePointer?: boolean;
|
|
7
8
|
reset?: () => void;
|
|
8
9
|
increase?: () => void;
|
|
9
10
|
decrease?: () => void;
|
|
@@ -17,6 +18,8 @@ declare const __propDef: {
|
|
|
17
18
|
}) => void;
|
|
18
19
|
};
|
|
19
20
|
events: {
|
|
21
|
+
click: MouseEvent;
|
|
22
|
+
} & {
|
|
20
23
|
[evt: string]: CustomEvent<any>;
|
|
21
24
|
};
|
|
22
25
|
slots: {
|
package/components/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { default as Labels } from './Labels.svelte';
|
|
|
19
19
|
export { default as Line } from './Line.svelte';
|
|
20
20
|
export { default as LinearGradient } from './LinearGradient.svelte';
|
|
21
21
|
export { default as Link } from './Link.svelte';
|
|
22
|
+
export { default as Pack } from './Pack.svelte';
|
|
22
23
|
export { default as Partition } from './Partition.svelte';
|
|
23
24
|
export { default as Path } from './Path.svelte';
|
|
24
25
|
export { default as Pattern } from './Pattern.svelte';
|
package/components/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { default as Labels } from './Labels.svelte';
|
|
|
19
19
|
export { default as Line } from './Line.svelte';
|
|
20
20
|
export { default as LinearGradient } from './LinearGradient.svelte';
|
|
21
21
|
export { default as Link } from './Link.svelte';
|
|
22
|
+
export { default as Pack } from './Pack.svelte';
|
|
22
23
|
export { default as Partition } from './Partition.svelte';
|
|
23
24
|
export { default as Path } from './Path.svelte';
|
|
24
25
|
export { default as Pattern } from './Pattern.svelte';
|
package/package.json
CHANGED