Skip to content

Commit

Permalink
Toggle arrow color on click (#1)
Browse files Browse the repository at this point in the history
* Toggle arrow color on click

When there are a lot of arrows and nodes, it's very hard to follow a single arrow. The stroke-size change on hover helps, but it has two weaknesses:
  1. the arrow still blends with others which are right next to it.
  2. when the diagram is big and the arrow is very large, scrolling will always turn off the hover state.

The color change makes the arrow stand out and it persists through scrolling.
  • Loading branch information
elpadi authored Aug 31, 2020
1 parent 3dc6bfd commit 8f8fb9e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Render.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ public static function html(Graph $graph, array $params = []): string
});
</script>"
: '',
'<script>
$(document).on("click", "path", e => {
e.currentTarget.style.stroke = e.currentTarget.style.stroke ? "" : "red";
});
</script>',
'</body>',
'</html>',
]);
Expand Down

0 comments on commit 8f8fb9e

Please sign in to comment.