feat(nodes): debounce scaling to avoid lag spikes
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
"lint": "eslint --ext \".ts,.tsx\" -c .eslintrc.js --fix ./dist",
|
||||
"theme": "postcss src/style.css -o dist/style.css && postcss src/theme-default.css -o dist/theme-default.css",
|
||||
"prepare": "ts-patch install -s",
|
||||
"prepublish": "shx cp ../README.md .",
|
||||
"prepublishOnly": "shx cp ../README.md .",
|
||||
"postpublish": "shx rm README.md"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { DraggableEventListener, DraggableCore } from '@braks/revue-draggable/src/index'
|
||||
import { DraggableEventListener, DraggableCore } from '@braks/revue-draggable'
|
||||
import { useVueFlow } from '../../composables'
|
||||
import { GraphNode, SnapGrid } from '../../types'
|
||||
import { NodeId } from '../../context'
|
||||
@@ -90,6 +90,7 @@ const scale = controlledComputed(
|
||||
() => store.transform[2],
|
||||
() => store.transform[2],
|
||||
)
|
||||
const scaleDebounced = debouncedRef(scale, 5)
|
||||
|
||||
watch(
|
||||
[() => node.value.position, () => store.getNode(node.value.parentNode!)],
|
||||
@@ -120,7 +121,7 @@ export default {
|
||||
:cancel="`.${store.noDragClassName}`"
|
||||
:handle="node.dragHandle"
|
||||
:disabled="!props.draggable"
|
||||
:scale="scale"
|
||||
:scale="scaleDebounced"
|
||||
:grid="props.snapGrid"
|
||||
:enable-user-select-hack="false"
|
||||
@start="onDragStart"
|
||||
|
||||
Reference in New Issue
Block a user