Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Panel resize events are odd & give misleading sizes #2079

Closed
peterflynn opened this issue Nov 8, 2012 · 4 comments
Closed

Panel resize events are odd & give misleading sizes #2079

peterflynn opened this issue Nov 8, 2012 · 4 comments

Comments

@peterflynn
Copy link
Member

Add the following code somewhere:

$("#sidebar").on("panelResizeStart panelResizeUpdate panelResizeEnd panelCollapsed panelExpanded", function (evt, arg) {
    console.log(evt.type, arg);
});
  1. Drag the sidebar resizer a bit
  2. Drag the sidebar resizer until it snaps shit
  3. Drag the sidebar resizer until it snaps open again
  4. Double-click the sidebar resizer while it's open
  5. Drag the sidebar closed again...
  6. ...then double-click the resizer while it's closed

Result:

  1. panelResizeStart, a string of Updates, then End, and finally one more Update (with the same size as the End).
  2. You get a panelCollapsed when the size falls below 10, but you continue to get more panelResizeUpdates after that if the mouse moves any further to the left. The updates report smaller sizes even though the panel is actually now 0 width. When you mouse up, you get a panelResizeEnd reporting the size at time of collapse (usually 9 or 8) followed by a panelResizeUpdate reporting the last size from the mouse move, which might be much smaller (but is > 0, which is the panel's actual size now that it's hidden).
  3. You get a panelResizeStart with whatever size the panel was when it was hidden (could be much > 10 if it was hidden via the menu item). Then you get panelResizeUpdates for sizes < 10, as the mouse moves to the right. The panel is still hidden (size 0) at this point. You eventually get a panelExpanded event once the mouse crosses the 10px mark, then the Update events continue, with accurate sizes.
  4. Each click triggers panelResizeEnd, Start, and Update (in that order). The panel does not collapse or change size (is that a separate bug?).
  5. --
  6. You get a panelResizeEnd, Start, then Update, and finally Expanded. The End and Start give you the size the panel will be restored to, but the Update gives you a size of 0. The final Expanded event gives you the right size again. The sidebar is expanded back to the minimum size of 10, not the size it was at before you collapsed it (that might be a separate issue).

Expected:

  1. No Update event after the End
  2. No Update events after Collapsed. Mouseup should give an End event reporting the collapsed size (0). And similar to 1, no Update event after the End.
  3. Size is reported as 0 until the Expanded event occurs (or better yet, no Update events until after Expanded).
  4. No events. (Unless double-click is supposed to collapse the panel, in which case I'd expect to get only a Collapsed event and nothing else -- same as collapsing via the menu).
  5. --
  6. Only the Expanded event, same as expanding via the menu. Panel expands back to the size it was before you dragged it closed (again, might be a separate bug).

Workaround:
Ignore panelResize* events while a panel is collapsed (display:none). I think this avoids most of the confusion...

@peterflynn
Copy link
Member Author

@jbalsas, fyi. Doesn't seem urgent to work on, but if you're interested...

@jbalsas
Copy link
Contributor

jbalsas commented Nov 8, 2012

Sure! ;)

I think I have most of the issues pinned down so they shouldn't be that hard to fix...

About (4), yes, it is supposed to collapse on double-click. I can see it working right now on Windows7... We are currently detecting the double click as an additional click before 100ms have passed since the mouseup. Can you check if double-clicking faster works? If it does, maybe we could consider incrementing this value (I've read that there's no standard, but something around 500ms seems to be more common)... We'll need to check for other issues if that is not the case.

About (6), I think this has always been the case (toggling back to 10px after dragging the sidebar shut). This should have an easy fix as well but if you prefer to better track this, then we could open a different issue...

@pthiess
Copy link
Contributor

pthiess commented Nov 15, 2012

Reviewed, assigned to @jasonsanjose to assist Chema.

@ghost ghost assigned jasonsanjose Nov 15, 2012
peterflynn added a commit that referenced this issue Nov 21, 2012
Clean up panel resize events; fix bugs with double-clicking to expand/collapse (#2079); fix bug with dragging mouse outside window bounds (##2117)
@peterflynn
Copy link
Member Author

Closing now that Chema's fix has been merged

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants