Skip to content

Commit

Permalink
fix: comments not align to the end of candidate rect when min_heigh/m…
Browse files Browse the repository at this point in the history
…in_width is larger than actual calc size
  • Loading branch information
fxliang committed May 28, 2024
1 parent 5d1bf58 commit 5ff8dda
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions WeaselUI/VHorizontalLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,12 @@ void VHorizontalLayout::DoLayout(CDCHandle dc, PDWR pDWR) {
UpdateStatusIconLayout(&width, &height);
// candidate rectangle always align to bottom side, margin_y to the bottom
// edge
for (auto i = 0; i < candidates_count && i < MAX_CANDIDATES_COUNT; ++i)
_candidateRects[i].bottom =
max(_candidateRects[i].bottom, height - real_margin_y);
for (auto i = 0; i < candidates_count && i < MAX_CANDIDATES_COUNT; ++i) {
int bottom = max(_candidateRects[i].bottom, height - real_margin_y);
_candidateCommentRects[i].OffsetRect(
0, bottom - _candidateCommentRects[i].bottom);
_candidateRects[i].bottom = bottom;
}

_highlightRect = _candidateRects[id];
_contentSize.SetSize(width + offsetX, height + offsetY);
Expand Down
7 changes: 5 additions & 2 deletions WeaselUI/VerticalLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,13 @@ void weasel::VerticalLayout::DoLayout(CDCHandle dc, PDWR pDWR) {
}
UpdateStatusIconLayout(&width, &height);
// candidate rectangle always align to right side, margin_x to the right edge
for (auto i = 0; i < candidates_count && i < MAX_CANDIDATES_COUNT; ++i)
_candidateRects[i].right =
for (auto i = 0; i < candidates_count && i < MAX_CANDIDATES_COUNT; ++i) {
int right =
max(_candidateRects[i].right,
_candidateRects[i].left - real_margin_x + width - real_margin_x);
_candidateCommentRects[i].OffsetRect(right - _candidateRects[i].right, 0);
_candidateRects[i].right = right;
}

_contentSize.SetSize(width + offsetX * 2, height + offsetY * 2);

Expand Down

0 comments on commit 5ff8dda

Please sign in to comment.