zk/diary/2012-10-08-09:26:41.md

16 lines
893 B
Markdown
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

%title 2012-10-08 09:26:41
%date Some SVG/mouse event oddities
:blog:fossil:diary:
A task at work had me pulling my hair out, but I finally got it, thankfully!  I figured it might also be a good idea to do a little write-up about it, and potentially do more about future items, just because they can sometimes be kind of interesting.
(drawing an edge between two vertices on a graph)
(rubberbanding pending edge)
(mouse events fire on containing elements in html, but also on covering elements (which  may not be contained) in svg, so mouse events can fire on the pending edge, because mousemove isn't fired all the time, so your cursor can wind up over the pending edge)
(solution for first part is, in theory, to use mouseenter and mouseleave instead of over and out)
(solution to the second part (and covering the first part) is to check if the cursor is within  the vertex)