From 6c6bdbe86a940d93793f81e011052c781a413e46 Mon Sep 17 00:00:00 2001 From: blikblum Date: Sun, 6 Apr 2008 16:06:13 +0000 Subject: [PATCH] * Fix drawing trees with more nodes than 2000 nodes (CacheThreshold) by moving the header offset adjust from GetNodeAt to GetHitTestInfo git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@406 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../virtualtreeview-unstable/VirtualTrees.pas | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/components/virtualtreeview-unstable/VirtualTrees.pas b/components/virtualtreeview-unstable/VirtualTrees.pas index 1c0e210d8..93b36dca1 100644 --- a/components/virtualtreeview-unstable/VirtualTrees.pas +++ b/components/virtualtreeview-unstable/VirtualTrees.pas @@ -24371,6 +24371,14 @@ begin if X > Header.Columns.GetVisibleFixedWidth then Inc(X, FEffectiveOffsetX); Inc(Y, -FOffsetY); + //lclheder + if hoVisible in FHeader.Options then + begin + Dec(Y, FHeader.Height); + //the coordinate is in header + if Y < 0 then + Exit; + end; end; // If the point is in the tree area then check the nodes. @@ -25146,7 +25154,7 @@ end; function TBaseVirtualTree.GetNodeAt(X, Y: Integer; Relative: Boolean; var NodeTop: Integer): PVirtualNode; // This method returns the node that occupies the specified point, or nil if there's none. -// If Releative is True then X and Y are given in client coordinates otherwise they are considered as being +// If Relative is True then X and Y are given in client coordinates otherwise they are considered as being // absolute values into the virtual tree image (regardless of the current offsets in the tree window). // NodeTop gets the absolute or relative top position of the node returned or is untouched if no node // could be found. @@ -25161,22 +25169,13 @@ begin AbsolutePos := Y; if Relative then - begin Inc(AbsolutePos, -FOffsetY); - if hoVisible in FHeader.FOptions then - Inc(AbsolutePos, FHeader.Height); - end; // CurrentPos tracks a running term of the current position to test for. // It corresponds always to the top position of the currently considered node. - //lclheader: adjust position if Header is visible - if hoVisible in FHeader.FOptions then - CurrentPos := FHeader.Height - else - CurrentPos := 0; + CurrentPos := 0; - // If the cache is available then use it. if tsUseCache in FStates then Result := FindInPositionCache(AbsolutePos, CurrentPos) @@ -25237,10 +25236,7 @@ begin // of the found node this top position is returned. if Assigned(Result) then begin - //lclheader NodeTop := CurrentPos; - if hoVisible in FHeader.FOptions then - Dec(NodeTop,FHeader.Height); if Relative then Inc(NodeTop, FOffsetY); //Logger.Send([lcPaintHeader],'GetNodeAt Result: ',Result^.Index);