Skip to content

Free, simple, and intuitive online database diagram editor and SQL generator.

Add dash animation on relationship hover (#592)

1ilita2e453f39838
diff --git a/src/components/EditorCanvas/Relationship.jsx b/src/components/EditorCanvas/Relationship.jsx
index cffb67ab..72457de9 100644
--- a/src/components/EditorCanvas/Relationship.jsx
+++ b/src/components/EditorCanvas/Relationship.jsx
@@ -113,13 +113,19 @@ export default function Relationship({ data }) {
return (
<>
<g className="select-none group" onDoubleClick={edit}>
+ {/* invisible wider path for better hover ux */}
+ <path
+ d={calcPath(pathValues, settings.tableWidth)}
+ fill="none"
+ stroke="transparent"
+ strokeWidth={12}
+ cursor="pointer"
+ />
<path
ref={pathRef}
d={calcPath(pathValues, settings.tableWidth)}
- stroke="gray"
- className="group-hover:stroke-sky-700"
+ className="relationship-path"
fill="none"
- strokeWidth={2}
cursor="pointer"
/>
{settings.showRelationshipLabels && (
@@ -130,7 +136,7 @@ export default function Relationship({ data }) {
fontSize={labelFontSize}
fontWeight={500}
ref={labelRef}
- className="group-hover:fill-sky-700"
+ className="group-hover:fill-sky-600"
>
{data.name}
</text>
@@ -196,7 +202,7 @@ function CardinalityLabel({ x, y, text, r = 12, padding = 14 }) {
width={textWidth + padding}
height={r * 2}
fill="grey"
- className="group-hover:fill-sky-700"
+ className="group-hover:fill-sky-600"
/>
<text
ref={textRef}
diff --git a/src/index.css b/src/index.css
index 697313f6..44dabcd0 100644
--- a/src/index.css
+++ b/src/index.css
@@ -72,7 +72,7 @@
width: 100% !important;
}
-.semi-spin-wrapper {
+.semi-spin-wrapper {
color: inherit;
}
@@ -209,3 +209,25 @@
opacity: 0;
}
}
+
+@keyframes dash-right {
+ 100% {
+ stroke-dashoffset: -20;
+ }
+}
+
+.relationship-path {
+ stroke: grey;
+ stroke-width: 2.5;
+ fill: none;
+ stroke-linecap: butt;
+ transition: stroke 0.2s ease, stroke-width 0.2s ease;
+ pointer-events: stroke;
+}
+
+.group:hover .relationship-path {
+ stroke: #0084d1;
+ stroke-width: 2;
+ stroke-dasharray: 12 8;
+ animation: dash-right 1s linear infinite;
+}