Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚸 Add animated particles to highlighted relationship edges #367

Merged
merged 3 commits into from
Dec 24, 2024

Conversation

junkisai
Copy link
Member

@junkisai junkisai commented Dec 24, 2024

Summary

Drawing multiple strokes with stroke-dasharray specified causes performance degradation, especially in Safari browser.

Therefore, I stopped using stroke-dasharray.
Additionally, since stroke-dasharray is also used when 'animated' is set to true in Edge, I made sure that 'animated' is always set to false.

Furthermore, since setting 'animated' to false made it difficult to visually distinguish the flow of Edges, I used animateMotion instead to express Edge animations.

Before After
2024-12-24.17.42.36.mov
2024-12-24.17.41.49.mov

@junkisai junkisai force-pushed the feat/path-animation-ellipse branch from ab4d426 to b4de34c Compare December 24, 2024 08:23
@junkisai junkisai marked this pull request as ready for review December 24, 2024 08:59
@junkisai junkisai requested a review from a team as a code owner December 24, 2024 08:59
@junkisai junkisai requested review from hoshinotsuyoshi, FunamaYukina, MH4GF and sasamuku and removed request for a team December 24, 2024 08:59
Copy link
Member

@sasamuku sasamuku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!
looks more like a universe image 🪐
(I also love stroke-dasharray, so look forward to View control )

@junkisai junkisai added this pull request to the merge queue Dec 24, 2024
Merged via the queue into main with commit 5b88dfa Dec 24, 2024
12 checks passed
@junkisai junkisai deleted the feat/path-animation-ellipse branch December 24, 2024 09:37
animated: true,
animated: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late comment! This diff will pass the test suite. We might be able to remove this code. I'd like to tackle this the next time we edit!

diff
diff --git a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/highlightNodesAndEdges.test.ts b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/highlightNodesAndEdges.test.ts
index 17673cd2..132c2062 100644
--- a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/highlightNodesAndEdges.test.ts
+++ b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/highlightNodesAndEdges.test.ts
@@ -36,7 +36,6 @@ const anEdge = (
   sourceHandle,
   target,
   targetHandle,
-  animated: false,
   zIndex: zIndex.edgeDefault,
   data: { isHighlighted: false, ...override?.data },
   ...override,
@@ -181,12 +180,10 @@ describe(highlightNodesAndEdges, () => {
 
       expect(updatedEdges).toEqual([
         anEdge('users', 'posts', 'users-id', 'posts-user_id', {
-          animated: false,
           zIndex: zIndex.edgeHighlighted,
           data: { isHighlighted: true },
         }),
         anEdge('users', 'comment_users', 'users-id', 'comment_users-user_id', {
-          animated: false,
           zIndex: zIndex.edgeHighlighted,
           data: { isHighlighted: true },
         }),
@@ -228,12 +225,10 @@ describe(highlightNodesAndEdges, () => {
 
       expect(updatedEdges).toEqual([
         anEdge('users', 'posts', 'users-id', 'posts-user_id', {
-          animated: false,
           zIndex: zIndex.edgeHighlighted,
           data: { isHighlighted: true },
         }),
         anEdge('users', 'comment_users', 'users-id', 'comment_users-user_id', {
-          animated: false,
           zIndex: zIndex.edgeHighlighted,
           data: { isHighlighted: true },
         }),
@@ -253,12 +248,10 @@ describe(highlightNodesAndEdges, () => {
 
       expect(updatedEdges).toEqual([
         anEdge('users', 'posts', 'users-id', 'posts-user_id', {
-          animated: false,
           zIndex: zIndex.edgeHighlighted,
           data: { isHighlighted: true },
         }),
         anEdge('users', 'comment_users', 'users-id', 'comment_users-user_id', {
-          animated: false,
           zIndex: zIndex.edgeHighlighted,
           data: { isHighlighted: true },
         }),
@@ -268,7 +261,6 @@ describe(highlightNodesAndEdges, () => {
           'comments-id',
           'comment_users-comment_id',
           {
-            animated: false,
             zIndex: zIndex.edgeHighlighted,
             data: { isHighlighted: true },
           },
diff --git a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/highlightNodesAndEdges.ts b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/highlightNodesAndEdges.ts
index 30fa9a88..33e1ecd4 100644
--- a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/highlightNodesAndEdges.ts
+++ b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/highlightNodesAndEdges.ts
@@ -66,14 +66,12 @@ const unhighlightNode = (node: TableNodeType): TableNodeType => ({
 
 const highlightEdge = (edge: Edge): Edge => ({
   ...edge,
-  animated: false,
   zIndex: zIndex.edgeHighlighted,
   data: { ...edge.data, isHighlighted: true },
 })
 
 const unhighlightEdge = (edge: Edge): Edge => ({
   ...edge,
-  animated: false,
   zIndex: zIndex.edgeDefault,
   data: { ...edge.data, isHighlighted: false },
 })

Copy link
Member

@hoshinotsuyoshi hoshinotsuyoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome work!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants