docs: update connection-radius example

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-02-01 22:41:14 +01:00
committed by Braks
parent e0fbefef8f
commit 539b85dc59
8 changed files with 14 additions and 13 deletions

View File

@@ -23,7 +23,7 @@ const elements = ref([
</script>
<template>
<VueFlow v-model="elements" auto-connect fit-view-on-init>
<VueFlow v-model="elements" :connection-radius="30" auto-connect fit-view-on-init>
<template #connection-line="{ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition }">
<ConnectionLine
:source-x="sourceX"

View File

@@ -45,7 +45,7 @@ const SNAP_HIGHLIGHT_COLOR = '#10b981'
const MIN_DISTANCE = 75
const SNAP_DISTANCE = 50
const SNAP_DISTANCE = 30
watch([() => props.targetY, () => props.targetX], (_, __, onCleanup) => {
const closestNode = getNodes.value.reduce(

View File

@@ -17,7 +17,7 @@ import { HorizontalApp, HorizontalElements } from './horizontal'
import { TeleportApp, TeleportCSS, TeleportSidebar, TeleportableNode, TeleportableUseTransition } from './teleport'
import { TransitionApp, TransitionCSS, TransitionEdge } from './transition'
import { IntersectionApp, IntersectionCSS, IntersectionElements } from './intersection'
import { SnapToHandleApp, SnappableConnectionLine } from './snap-to-handle'
import { SnapToHandleApp, SnappableConnectionLine } from './connection-radius'
import { NodeResizerApp, ResizableNode } from './node-resizer'
import { ToolbarApp, ToolbarNode } from './node-toolbar'

View File

@@ -230,7 +230,7 @@ export default defineConfigWithTheme<DefaultTheme.Config>({
{ text: 'Updatable Edge', link: '/examples/edges/updatable-edge' },
{ text: 'Custom Connection Line', link: '/examples/edges/connection-line' },
{ text: 'Connection Validation', link: '/examples/edges/validation' },
{ text: 'Snap To Handle', link: '/examples/edges/snap-to-handle' },
{ text: 'Connection Radius', link: '/examples/edges/connection-radius' },
],
},
],

View File

@@ -36,7 +36,7 @@ declare module '@vue/runtime-core' {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Sidebar: typeof import('./../components/examples/dnd/Sidebar.vue')['default']
SnappableConnectionLine: typeof import('./../components/examples/snap-to-handle/SnappableConnectionLine.vue')['default']
SnappableConnectionLine: typeof import('../components/examples/connection-radius/SnappableConnectionLine.vue')['default']
Team: typeof import('./../components/home/Team.vue')['default']
TeleportableNode: typeof import('./../components/examples/teleport/TeleportableNode.vue')['default']
ToolbarNode: typeof import('./../components/examples/node-toolbar/ToolbarNode.vue')['default']

View File

@@ -0,0 +1,9 @@
# Connection Radius
This examples shows you how to use the `connectionRadius` prop.
This prop allows you to pass a number which will be used to determine the radius at which a connection line will snap to the nearest handle.
In addition, we create a custom connection line which will color the handles (you can omit this and just use `connectionRadius`).
<div class="mt-6">
<Repl example="snappable"></Repl>
</div>

View File

@@ -1,8 +0,0 @@
# Snap To Handle
In this example we will create a custom connection line
that snaps to the nearest handle when the connection is dropped within distance of a handle.
<div class="mt-6">
<Repl example="snappable"></Repl>
</div>