feat(core): expose wheelDelta utility (#1918)

* feat(core): expose wheelDelta utility

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

* chore(changeset): add

* fix(minimap): apply wheel delta to zoom

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

* chore(changeset): add

---------

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2025-08-15 13:25:11 +02:00
parent 5dc276af52
commit 5fbbc826e5
7 changed files with 52 additions and 9 deletions
+7 -1
View File
@@ -21,7 +21,7 @@ import type {
XYPosition,
XYZPosition,
} from '../types'
import { isDef, snapPosition, warn } from '.'
import { isDef, isMacOs, snapPosition, warn } from '.'
export function nodeToRect(node: GraphNode): Rect {
return {
@@ -504,3 +504,9 @@ export function getMarkerId(marker: EdgeMarkerType | undefined, vueFlowId?: stri
.map((key) => `${key}=${marker[<keyof EdgeMarkerType>key]}`)
.join('&')}`
}
export function wheelDelta(event: any) {
const factor = event.ctrlKey && isMacOs() ? 10 : 1
return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) * factor
}