chore(core): cleanup

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2022-12-13 15:49:20 +01:00
committed by Braks
parent 5c726ece40
commit 029a0d9a21
3 changed files with 11 additions and 4 deletions
@@ -4,11 +4,13 @@ import type { SnapGrid } from '~/types'
export function useGetPointerPosition() {
const { viewport, snapGrid: globalSnapGrid, snapToGrid } = useVueFlow()
const hasSnapGrid = (sg?: SnapGrid) => (sg ?? snapToGrid ? globalSnapGrid : undefined)
const hasSnapGrid = (sg?: SnapGrid) => (sg ?? snapToGrid.value ? globalSnapGrid.value : undefined)
// returns the pointer position projected to the RF coordinate system
return ({ sourceEvent }: UseDragEvent, snapGrid?: SnapGrid) => {
const currentSnapGrid = unref(hasSnapGrid(snapGrid || globalSnapGrid.value))
const currentSnapGrid = unref(hasSnapGrid(snapGrid))
console.log(currentSnapGrid)
const x = sourceEvent.touches ? sourceEvent.touches[0].clientX : sourceEvent.clientX
const y = sourceEvent.touches ? sourceEvent.touches[0].clientY : sourceEvent.clientY