feat(nodes): add effect scope to useDrag utility
This commit is contained in:
@@ -22,6 +22,8 @@ interface UseDragParams {
|
||||
}
|
||||
|
||||
function useDrag(params: UseDragParams) {
|
||||
const scope = effectScope()
|
||||
const dragging = scope.run(() => {
|
||||
const {
|
||||
viewport,
|
||||
snapToGrid,
|
||||
@@ -36,6 +38,7 @@ function useDrag(params: UseDragParams) {
|
||||
setState,
|
||||
updateNodePositions,
|
||||
} = $(useVueFlow())
|
||||
|
||||
const { onStart, onDrag, onStop, el, disabled = false, noDragClassName, id, handleSelector } = $(params)
|
||||
|
||||
const dragging = ref(false)
|
||||
@@ -147,6 +150,11 @@ function useDrag(params: UseDragParams) {
|
||||
{ flush: 'post' },
|
||||
)
|
||||
|
||||
return dragging
|
||||
})
|
||||
|
||||
tryOnScopeDispose(() => scope.stop())
|
||||
|
||||
return dragging
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user