* 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>
14 lines
372 B
TypeScript
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,
|
|
}
|
|
}
|