|
|
|
@ -27,22 +27,17 @@ const props = defineProps<RelationEdgeProps>()
|
|
|
|
|
|
|
|
|
|
const data = toRef(props, 'data') |
|
|
|
|
|
|
|
|
|
const baseStroke = 2 |
|
|
|
|
|
|
|
|
|
const edgePath = computed(() => { |
|
|
|
|
if (data.value.isSelfRelation) { |
|
|
|
|
const { sourceX, sourceY, targetX, targetY } = props |
|
|
|
|
const radiusX = (sourceX - targetX) * 0.6 |
|
|
|
|
const radiusY = 50 |
|
|
|
|
return `M ${sourceX} ${sourceY} A ${radiusX} ${radiusY} 0 1 0 ${targetX} ${targetY}` |
|
|
|
|
return [`M ${sourceX} ${sourceY} A ${radiusX} ${radiusY} 0 1 0 ${targetX} ${targetY}`] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return getBezierPath({ |
|
|
|
|
sourceX: props.sourceX, |
|
|
|
|
sourceY: props.sourceY, |
|
|
|
|
sourcePosition: props.sourcePosition, |
|
|
|
|
targetX: props.targetX, |
|
|
|
|
targetY: props.targetY, |
|
|
|
|
targetPosition: props.targetPosition, |
|
|
|
|
}) |
|
|
|
|
return getBezierPath({ ...props }) |
|
|
|
|
}) |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
@ -68,7 +63,7 @@ export default {
|
|
|
|
|
class="opacity-100 hover:(opacity-0)" |
|
|
|
|
:class="selected ? 'opacity-0' : ''" |
|
|
|
|
:style="style" |
|
|
|
|
:stroke-width="2" |
|
|
|
|
:stroke-width="showSkeleton ? baseStroke * 4 : baseStroke" |
|
|
|
|
fill="none" |
|
|
|
|
:d="edgePath[0]" |
|
|
|
|
:marker-end="showSkeleton ? markerEnd : ''" |
|
|
|
@ -77,7 +72,7 @@ export default {
|
|
|
|
|
class="opacity-0 hover:(opacity-100 transition-all duration-100 ease)" |
|
|
|
|
:class="selected ? 'opacity-100' : ''" |
|
|
|
|
style="stroke: url(#linear-gradient)" |
|
|
|
|
:stroke-width="7" |
|
|
|
|
:stroke-width="showSkeleton ? baseStroke * 8 : 7" |
|
|
|
|
fill="none" |
|
|
|
|
:d="edgePath[0]" |
|
|
|
|
:marker-end="showSkeleton ? markerEnd : ''" |
|
|
|
@ -96,15 +91,16 @@ export default {
|
|
|
|
|
:label-bg-border-radius="2" |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
<template v-if="!showSkeleton"> |
|
|
|
|
<rect |
|
|
|
|
class="nc-erd-edge-rect" |
|
|
|
|
:x="sourceX" |
|
|
|
|
:y="sourceY - 4" |
|
|
|
|
width="8" |
|
|
|
|
height="8" |
|
|
|
|
:width="8" |
|
|
|
|
:height="8" |
|
|
|
|
fill="#fff" |
|
|
|
|
stroke="#6F3381" |
|
|
|
|
:stroke-width="1.5" |
|
|
|
|
:stroke-width="2" |
|
|
|
|
:transform="`rotate(45,${sourceX + 2},${sourceY - 4})`" |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
@ -113,12 +109,13 @@ export default {
|
|
|
|
|
class="nc-erd-edge-rect" |
|
|
|
|
:x="targetX" |
|
|
|
|
:y="targetY - 4" |
|
|
|
|
width="8" |
|
|
|
|
height="8" |
|
|
|
|
:width="8" |
|
|
|
|
:height="8" |
|
|
|
|
fill="#fff" |
|
|
|
|
stroke="#6F3381" |
|
|
|
|
:stroke-width="1.5" |
|
|
|
|
:stroke-width="2" |
|
|
|
|
:transform="`rotate(45,${targetX + 2},${targetY - 4})`" |
|
|
|
|
/> |
|
|
|
|
<circle v-else class="nc-erd-edge-circle" :cx="targetX" :cy="targetY" fill="#fff" :r="5" stroke="#6F3381" :stroke-width="1.5" /> |
|
|
|
|
<circle v-else class="nc-erd-edge-circle" :cx="targetX" :cy="targetY" fill="#fff" :r="5" stroke="#6F3381" :stroke-width="2" /> |
|
|
|
|
</template> |
|
|
|
|
</template> |
|
|
|
|