chore(examples): lint

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-04-11 20:30:23 +02:00
parent 4454867c36
commit 544fd05d3e
3 changed files with 21 additions and 7 deletions

View File

@@ -31,7 +31,9 @@ onPaneReady((instance) => instance.fitView())
function changeType() {
elements.value.forEach((el) => {
if (isEdge(el) || el.type === 'input') return
if (isEdge(el) || el.type === 'input') {
return
}
el.type = el.type === 'default' ? 'output' : 'default'
})
}

View File

@@ -120,16 +120,26 @@ const initialElements: Elements = [
const snapGrid: SnapGrid = [16, 16]
function nodeStrokeColor(n: Node): string {
if ((n.style as Styles)?.background) return (n.style as Styles).background as string
if (n.type === 'input') return '#0041d0'
if (n.type === 'output') return '#ff0072'
if (n.type === 'default') return '#1a192b'
if ((n.style as Styles)?.background) {
return (n.style as Styles).background as string
}
if (n.type === 'input') {
return '#0041d0'
}
if (n.type === 'output') {
return '#ff0072'
}
if (n.type === 'default') {
return '#1a192b'
}
return '#eee'
}
function nodeColor(n: Node): string {
if ((n.style as Styles)?.background) return (n.style as Styles).background as string
if ((n.style as Styles)?.background) {
return (n.style as Styles).background as string
}
return '#fff'
}

View File

@@ -59,7 +59,9 @@ watch([() => props.targetY, () => props.targetX], (_, __, onCleanup) => {
},
)
if (!closestNode.node) return
if (!closestNode.node) {
return
}
canSnap.value = closestNode.distance < SNAP_DISTANCE