Files
vue-flow/src/components/UserSelection/utils.ts
T
Braks 10215b4631 update: create vue.d.ts files
* add vue-tsc to emit d.ts files from vue components
* use absolute paths in components
* avoids conflicts with ts custom paths in vue-tsc generated vue.d.ts files

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
2021-11-17 01:39:50 +01:00

14 lines
372 B
TypeScript

import { XYPosition } from '../../types'
export function getMousePosition(event: MouseEvent): XYPosition | void {
const flowNode = (event.target as Element).closest('.vue-flow')
if (!flowNode) return
const containerBounds = flowNode.getBoundingClientRect()
return {
x: event.clientX - containerBounds.left,
y: event.clientY - containerBounds.top,
}
}