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
@@ -244,13 +244,14 @@ export default {
:data="node.data"
:events="{ ...node.events, ...on }"
:selected="!!node.selected"
:resizing="!!node.resizing"
:dragging="dragging"
:connectable="connectable"
:position="node.position"
:dimensions="node.dimensions"
:is-valid-target-pos="node.isValidTargetPos"
:is-valid-source-pos="node.isValidSourcePos"
:parent-node="node.parentNode"
:dragging="dragging"
:z-index="node.computedPosition.z"
:target-position="node.targetPosition"
:source-position="node.sourcePosition"
@@ -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
+5 -1
View File
@@ -113,7 +113,11 @@ export const applyChanges = <
if (typeof currentChange.dimensions !== 'undefined') element.dimensions = currentChange.dimensions
if (typeof currentChange.updateStyle !== 'undefined') {
element.style = { ...(element.style || {}), ...currentChange.dimensions }
element.style = {
...(element.style || {}),
width: `${currentChange.dimensions?.width}px`,
height: `${currentChange.dimensions?.height}px`,
}
}
if (typeof currentChange.resizing === 'boolean') element.resizing = currentChange.resizing