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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user