Skip to content

Commit

Permalink
NewTabSet: Fix close button positioning.
Browse files Browse the repository at this point in the history
There was a 1-pixel difference between the hot and selected states.

Removed TabSpacing since it was only needed by the old style.
  • Loading branch information
jordanrussell authored Nov 20, 2024
1 parent 5d8f8db commit d9c6361
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions Components/NewTabSet.pas
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ function LightenColor(const Color: TColorRef; const Amount: Integer): TColorRef;
const
TabPaddingX = 5;
TabPaddingY = 3;
TabSpacing = 1;
CloseButtonSizeX = 12;

constructor TNewTabSet.Create(AOwner: TComponent);
Expand Down Expand Up @@ -262,7 +261,7 @@ function TNewTabSet.GetTabRect(Index: Integer): TRect;
Result.Right := 4 - FTabsOffset;
for I := 0 to FTabs.Count-1 do begin
Size := Canvas.TextExtent(FTabs[I]);
SizeX := Size.cx + (TabPaddingX * 2) + TabSpacing;
SizeX := Size.cx + (TabPaddingX * 2);
if (I < FCloseButtons.Count) and FCloseButtons[I] then
Inc(SizeX, MulDiv(CloseButtonSizeX, CurrentPPI, 96));
SizeY := Size.cy + (TabPaddingY * 2);
Expand All @@ -287,9 +286,6 @@ procedure TNewTabSet.InvalidateTab(Index: Integer);
begin
if HandleAllocated and (Index >= 0) and (Index < FTabs.Count) then begin
R := GetTabRect(Index);
{ Inc R.Right since the trailing separator of a tab overwrites the first
pixel of the next tab }
Inc(R.Right);
InvalidateRect(Handle, @R, False);
end;
end;
Expand Down Expand Up @@ -390,7 +386,6 @@ procedure TNewTabSet.Paint;
for I := 0 to FTabs.Count-1 do begin
R := GetTabRect(I);
if SelectedTab and (FTabIndex = I) then begin
Dec(R.Right, TabSpacing);
if FTheme <> nil then
Canvas.Brush.Color := FTheme.Colors[tcBack]
else
Expand Down

0 comments on commit d9c6361

Please sign in to comment.