refactor(vue-flow,components): camelCase custom events in Controls.vue

This commit is contained in:
Braks
2022-05-22 22:46:47 +02:00
parent 045a768ab1
commit 263b6dff9f
@@ -11,10 +11,10 @@ import Unlock from '~/assets/icons/unlock.svg'
const { showZoom = true, showFitView = true, showInteractive = true, fitViewParams } = defineProps<ControlProps>() const { showZoom = true, showFitView = true, showInteractive = true, fitViewParams } = defineProps<ControlProps>()
const emit = defineEmits<{ const emit = defineEmits<{
(event: 'zoom-in'): void (event: 'zoomIn'): void
(event: 'zoom-out'): void (event: 'zoomOut'): void
(event: 'fit-view'): void (event: 'fitView'): void
(event: 'interaction-change', active: boolean): void (event: 'interactionChange', active: boolean): void
}>() }>()
const { instance, nodesDraggable, nodesConnectable, elementsSelectable, setInteractive } = $(useVueFlow()) const { instance, nodesDraggable, nodesConnectable, elementsSelectable, setInteractive } = $(useVueFlow())
@@ -23,22 +23,22 @@ const isInteractive = computed(() => nodesDraggable && nodesConnectable && eleme
const onZoomInHandler = () => { const onZoomInHandler = () => {
instance?.zoomIn() instance?.zoomIn()
emit('zoom-in') emit('zoomIn')
} }
const onZoomOutHandler = () => { const onZoomOutHandler = () => {
instance?.zoomOut() instance?.zoomOut()
emit('zoom-out') emit('zoomOut')
} }
const onFitViewHandler = () => { const onFitViewHandler = () => {
instance?.fitView(fitViewParams) instance?.fitView(fitViewParams)
emit('fit-view') emit('fitView')
} }
const onInteractiveChangeHandler = () => { const onInteractiveChangeHandler = () => {
setInteractive(!isInteractive.value) setInteractive(!isInteractive.value)
emit('interaction-change', !isInteractive.value) emit('interactionChange', !isInteractive.value)
} }
</script> </script>