Skip to content

Commit 6aaf1fd

Browse files
committed
Viewer: clamp the drawer divider to the max width too (#85)
The live divider drag only bounded the image view's and drawer's minimum widths, so in a wide (maximized) window the bar could be dragged far past the drawer's maximum and then snapped back to it on release. Bound the image-view width from below by the max-drawer position as well, so the divider stops cleanly at both the minimum and maximum drawer widths.
1 parent 38dd1ce commit 6aaf1fd

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ All notable changes to Q1View are documented here. Releases follow [semantic ver
1111
- Viewer: when the thumbnail drawer has focus, `PgUp`/`PgDn` now step the selection to the previous/next file (matching the main view's file navigation) instead of scrolling by a page — in the gallery grid the page was the whole list, so they had simply duplicated `Home`/`End`. They move the selection only (arrow keys still browse folders; `Enter`/double-click still opens), while `Home`/`End` continue to jump to the first/last item. (issue #84)
1212

1313
### Fixed
14-
- Viewer: dragging the thumbnail drawer divider is now a smooth live resize that stops cleanly at the minimum width. It had used the splitter's default XOR "ghost" bar, which was drawn over the thumbnails and flickered, and could overshoot the minimum then snap back on release; the panes now resize in real time, clamped to the minimum, with the menu bar and grid re-fit held until the drag settles. (issue #85)
14+
- Viewer: dragging the thumbnail drawer divider is now a smooth live resize that stops cleanly at the minimum and maximum widths. It had used the splitter's default XOR "ghost" bar, which was drawn over the thumbnails and flickered, and could overshoot the limit then snap back on release (the overshoot was most obvious past the maximum in a wide/maximized window); the panes now resize in real time, clamped to both bounds, with the menu bar and grid re-fit held until the drag settles. (issue #85)
1515
- Viewer: resizing the gallery grid with Ctrl+wheel (e.g. from 3 to 2 columns) no longer jolts when the change makes the vertical scrollbar appear or disappear. The grid is now laid out as if the scrollbar is always present, so its width — and therefore the tile size and column count — no longer shifts by a scrollbar's width as the bar toggles.
1616
- Viewer: opening the thumbnail drawer now scrolls the current image into view, instead of leaving the list at the top.
1717
- Viewer: the menu bar no longer flickers while the thumbnail drawer slides open or closed. The image refits to the changing view width on every animation frame, and each refit refreshed the magnification readout in the menu with `DrawMenuBar`, repainting the whole (non-buffered) menu bar a dozen times in a fifth of a second. The readout text is still updated during the slide, but the menu is repainted only once, after the slide settles.

Viewer/MainFrm.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,14 @@ void CDrawerSplitter::OnMouseMove(UINT nFlags, CPoint point)
152152
CRect rc;
153153
GetClientRect(&rc);
154154
int bar = BarWidth();
155-
int lo = DRAWER_MIN_IMAGE; // image view (col 0) lower bound
156-
int hi = rc.Width() - bar - DRAWER_MIN_W; // so the drawer keeps its minimum
155+
// col0 is the image view's width; its bounds keep the drawer within
156+
// [DRAWER_MIN_W, DRAWER_MAX_W] and the image view at >= DRAWER_MIN_IMAGE.
157+
// Without the max-drawer bound a wide (maximized) window let the divider run
158+
// far left and then snap back to the max on release (issue #85).
159+
int lo = rc.Width() - bar - DRAWER_MAX_W; // drawer's maximum width
160+
if (lo < DRAWER_MIN_IMAGE)
161+
lo = DRAWER_MIN_IMAGE; // image view's minimum width
162+
int hi = rc.Width() - bar - DRAWER_MIN_W; // drawer's minimum width
157163
if (hi < lo)
158164
hi = lo;
159165
int col0 = point.x;

0 commit comments

Comments
 (0)