1) sdthomasGroup: Members Posts: 6Joined: 17 Jan 2008Location: UKIP: 81.151.--.--
Posted:
Hi,
Just been playing with the Dragresize script, got to be one of the best i've seen. Had a look into the code to see if this could be brought into line with the Prototype library we use, as it already has the Event management.
The bit i couldn't figure out was how you've managed to capture events that happen off screen ie if i scroll to the left off screen and release the mouse button it still captures the event correctly and 'Drops' the element as if it had happened on screen. Normally the browser doesn't recognise the event if your mouse cursor leaves the window. so was intrigued as to how you overcame this issue.
2) Angus TurnbullGroup: Moderators Posts: 4235Joined: 7 Dec 2003Location: New ZealandIP: 202.137.--.--
Posted:
The script works on movement deltas not absolute mouse positions, which is a little bit harder to code and used less often, but works a lot more reliably in edge cases like that! In other words the script doesn't actually care where the mouse or element are, it just tracks the difference between movements.
- Angus.
3) sdthomasGroup: Members Posts: 6Joined: 17 Jan 2008Location: UKIP: 81.151.--.--
Posted:
Thx Angus for the quick reply, I think i get you although i don't know what deltas are (google failed to turn up any results) I can see where you're doing the difference calculations etc.
I'm just not getting how it captures the mouseup event if you move off the document as the mouseup Event is attached to the document.
This is something i'd like to figure out as normally moving off the screen and releasing the mouse button fails to trigger the mouse up event which normally breaks the script.
4) Angus TurnbullGroup: Moderators Posts: 4235Joined: 7 Dec 2003Location: New ZealandIP: 203.173.--.--
Posted:
By "delta" I just mean "difference between values".
This is probably browser-dependent, some browsers really don't react well to the mouse position exiting the window!
Try just setting up a simple page to track mouse events, append content to a text area or div every time a given event fires and just log the values then view them later in order. Play around a little and it should be educational!
Cheers - Angus.
5) sdthomasGroup: Members Posts: 6Joined: 17 Jan 2008Location: UKIP: 81.151.--.--
Posted:
Hi Angus,
Yes it turns out to be a browser dependant thing,
Firefox 2 tracks the mouse events off the screen during drag and even updates the vertical position if you move offscreen to the left with negative X values.Also fires the mouse up event when off screen.
Opera does the same except it doesn't update the rendering when off screen.
IE needless to say doesn't recognise anything off screen.
So it seems the more inteligent browsers continue to update the event whilst it is still active even if the cursor is off screen. I'm guessing this is something to do with the difference between 'event' and IE's 'window.event' handling.