Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Prevent windows from being dragged off-screen

    When an isc.Window is created the titlebar can be dragged to move it around the screen, however it is possible to drag it up past the top of the page, making some of the window content inaccessible. Since the titlebar is then also hidden past the top of the page it's not possible to pull the window back down again either. The page scrollbars are unaffected, so it is not possible to scroll up to get access to the title bar again (if you were already at the top of the page when dragging the window.)

    I've tested this under both IE8 and Firefox 3.6, and it affects both browsers, but it is difficult to replicate in IE. Because Firefox grabs the mouse and thus sends mouse-movement messages even when the cursor is outside the browser, it is very easy to drag a window off the top of the page. IE however only sends mouse movement messages when the cursor is over the page itself, so to replicate this issue you must start dragging on the lowest pixel of the title bar, and very slowly drag it up, let go of the mouse, then slowly move the cursor back down again. The window will then jump to a position where the title bar is *just* off the top of the page.

    My suggested solution would be to check when a window has finished dragging and clamp both the X and Y coordinates so they are >= 0.

    #2
    Set keepInParentRect:true.

    Comment


      #3
      Oh, my mistake, thanks! That solves the problem.

      Comment

      Working...
      X