Follow mousemove events outside browser?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lazarus
    New Member
    • Sep 2008
    • 5

    Follow mousemove events outside browser?

    Hi, I have a canvas that reacts to mousedown and mousemove. Once I click the canvas I want to track the cursor wherever it goes, including outside the browser.

    Setting window.onmousem ove only gives events inside the browser of course. I tried window.captureE vents which works on Safari but FireFox says it's deprecated. Mozilla's docs say to use window.addEvent Listener but the behavior is the same: in Safari I can drag outside the window and get mousemove events, FireFox only inside the window.

    Is there a way to do this? Is this behavior supported or is Safari an oddball?
    -lazarus
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    I don't believe there is a way.. you are speaking of outside the browsers window?

    Comment

    • Lazarus
      New Member
      • Sep 2008
      • 5

      #3
      Thanks for your reply but it turns out you can. Sorta.

      I'm making a template to code mouse events the way I'm used to: mouseDown(x,y), return true to go to mouseDrag(x,y,d x,dy) then a mouseUp(x,y). I use the mousemove event to fire the mouseDrag and yes, regular mousemove events only fire inside the browser. If the mouse is down though the mousemove events continue to fire wherever you drag.

      My problem was mouseDrag wasn't working in FireFox then I realized I had an old version. I upgraded and now mouseDragging works fullscreen on the 4 browsers I'm testing: Safari 3 mac, FireFox 3 mac/win, Chrome.

      I posted a test here...
      http://trochoid.google pages.com/rendered.html
      Click in the canvas and drag around. Coordinates relative to canvas are shown in status bar. Chrome has no status bar so I hacked in a line that follows mouseDrag outside the browser. -wim

      Comment

      Working...