brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

[CLOSED] Panel resize events are odd & give misleading sizes #2010

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by peterflynn Thursday Nov 08, 2012 at 07:20 GMT Originally opened as https://github.com/adobe/brackets/issues/2079


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...

core-ai-bot commented 3 years ago

Comment by peterflynn Thursday Nov 08, 2012 at 07:50 GMT


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

core-ai-bot commented 3 years ago

Comment by jbalsas Thursday Nov 08, 2012 at 15:55 GMT


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...

core-ai-bot commented 3 years ago

Comment by pthiess Thursday Nov 15, 2012 at 17:23 GMT


Reviewed, assigned to@jasonsanjose to assist Chema.

core-ai-bot commented 3 years ago

Comment by peterflynn Wednesday Nov 21, 2012 at 18:41 GMT


Closing now that Chema's fix has been merged