|
propagating mousemove events
For the site I'm currently working on, I'm trying to fix some JavaScript code that lets the user draw a box (a <div> with a border and transparent background) over an image. The box is resized via the onmousemove handler. It works by having the user click once, then move the mouse to another point (the opposite corner) and click again to pin the box down, if you will. The current code has equivalent onmousemove events defined for both the <img> and the <div> on top of it; the problem is that if the mouse moves slow enough (keeping the mouse coordinates inside the border), the user can make the <div> extend beyond the regions of the <img>.
What I would like to do is simply have the mousemove propagated to the <img> and then remove the handler from the <div>. This would restrict the box to being over the image no matter what, but if I just remove the handler, the mousemove event is stopped at by the <div> when the mouse backtracks, so the user can't shrink the box. The problem is that I don't know how to make the event propagate. I've spent a long time with google and nothing really says how to do what I want. Is there a way to do this?
|