Zk | 2012-10-08 09:26:41

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)