mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 22:19:18 +02:00
Treeview: Fix smooth scrolling. Items scrolling in could have 1 pixel line duplicated or missing. See detailed explanation at revision 59650 #235888a37d
git-svn-id: trunk@61097 -
This commit is contained in:
parent
9a58bacd0a
commit
03251f0bde
@ -3961,7 +3961,7 @@ begin
|
|||||||
if ANode<>nil then
|
if ANode<>nil then
|
||||||
begin
|
begin
|
||||||
NodeRect:=ANode.DisplayRect(false);
|
NodeRect:=ANode.DisplayRect(false);
|
||||||
NodeMidY:=(NodeRect.Top+NodeRect.Bottom) div 2;
|
NodeMidY:=NodeRect.Top + (NodeRect.Bottom-NodeRect.Top) div 2;
|
||||||
AnInsertMarkNode:=ANode;
|
AnInsertMarkNode:=ANode;
|
||||||
if (X>AnInsertMarkNode.DisplayExpandSignRight) then
|
if (X>AnInsertMarkNode.DisplayExpandSignRight) then
|
||||||
if Y>=NodeMidY then begin
|
if Y>=NodeMidY then begin
|
||||||
@ -5284,7 +5284,7 @@ begin
|
|||||||
if not CustomDrawItem(Node, DrawState, cdPrePaint, PaintImages) then Exit;
|
if not CustomDrawItem(Node, DrawState, cdPrePaint, PaintImages) then Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
VertMid := (NodeRect.Top + NodeRect.Bottom) div 2;
|
VertMid := NodeRect.Top + (NodeRect.Bottom - NodeRect.Top) div 2;
|
||||||
HasExpandSign := ShowButtons and Node.HasChildren and ((tvoShowRoot in Options) or (Node.Parent <> nil));
|
HasExpandSign := ShowButtons and Node.HasChildren and ((tvoShowRoot in Options) or (Node.Parent <> nil));
|
||||||
VertDelta := Ord(FDefItemHeight and 3 = 2);
|
VertDelta := Ord(FDefItemHeight and 3 = 2);
|
||||||
//DebugLn(['[TCustomTreeView.DoPaintNode] Node=',DbgS(Node),' Node.Text=',Node.Text,' NodeRect=',NodeRect.Left,',',NodeRect.Top,',',NodeRect.Right,',',NodeRect.Bottom,' VertMid=',VertMid]);
|
//DebugLn(['[TCustomTreeView.DoPaintNode] Node=',DbgS(Node),' Node.Text=',Node.Text,' NodeRect=',NodeRect.Left,',',NodeRect.Top,',',NodeRect.Right,',',NodeRect.Bottom,' VertMid=',VertMid]);
|
||||||
@ -5311,7 +5311,7 @@ begin
|
|||||||
if (Node.StateIndex >= 0) and (Node.StateIndex < StateImages.Count) then
|
if (Node.StateIndex >= 0) and (Node.StateIndex < StateImages.Count) then
|
||||||
begin
|
begin
|
||||||
if PaintImages then
|
if PaintImages then
|
||||||
StateImageRes.Draw(Canvas, x + 1, (NodeRect.Top + NodeRect.Bottom - StateImageRes.Height) div 2,
|
StateImageRes.Draw(Canvas, x + 1, NodeRect.Top +(NodeRect.Bottom - NodeRect.Top - StateImageRes.Height) div 2,
|
||||||
Node.StateIndex, True);
|
Node.StateIndex, True);
|
||||||
Inc(x, StateImageRes.Width + FDefItemSpace);
|
Inc(x, StateImageRes.Width + FDefItemSpace);
|
||||||
end;
|
end;
|
||||||
@ -5337,21 +5337,21 @@ begin
|
|||||||
if (Node.OverlayIndex >= 0) then begin
|
if (Node.OverlayIndex >= 0) then begin
|
||||||
OverlayIndex:=Node.OverlayIndex;
|
OverlayIndex:=Node.OverlayIndex;
|
||||||
if Images.HasOverlays then begin
|
if Images.HasOverlays then begin
|
||||||
ImageRes.DrawOverlay(Canvas, x + 1, (NodeRect.Top + NodeRect.Bottom - ImageRes.Height) div 2,
|
ImageRes.DrawOverlay(Canvas, x + 1, NodeRect.Top + (NodeRect.Bottom - NodeRect.Top - ImageRes.Height) div 2,
|
||||||
ImgIndex, OverlayIndex, Node.FNodeEffect);
|
ImgIndex, OverlayIndex, Node.FNodeEffect);
|
||||||
end else begin
|
end else begin
|
||||||
// draw the Overlay using the image from the list
|
// draw the Overlay using the image from the list
|
||||||
// set an Overlay
|
// set an Overlay
|
||||||
Images.OverLay(OverlayIndex,0);
|
Images.OverLay(OverlayIndex,0);
|
||||||
// draw overlay
|
// draw overlay
|
||||||
ImageRes.DrawOverlay(Canvas, x + 1, (NodeRect.Top + NodeRect.Bottom - ImageRes.Height) div 2,
|
ImageRes.DrawOverlay(Canvas, x + 1, NodeRect.Top + (NodeRect.Bottom - NodeRect.Top - ImageRes.Height) div 2,
|
||||||
ImgIndex, 0, Node.FNodeEffect);
|
ImgIndex, 0, Node.FNodeEffect);
|
||||||
// reset the Overlay
|
// reset the Overlay
|
||||||
Images.OverLay(-1,0);
|
Images.OverLay(-1,0);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
ImageRes.Draw(Canvas, x + 1, (NodeRect.Top + NodeRect.Bottom - ImageRes.Height) div 2,
|
ImageRes.Draw(Canvas, x + 1, NodeRect.Top + (NodeRect.Bottom - NodeRect.Top - ImageRes.Height) div 2,
|
||||||
ImgIndex, Node.FNodeEffect);
|
ImgIndex, Node.FNodeEffect);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user