layerchart 0.6.1 → 0.6.2
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/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
|
|
@@ -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;
|
package/package.json
CHANGED