View Issue Details

IDProjectCategoryView StatusLast Update
0034614LazarusPackagespublic2018-12-14 10:05
ReporterAndrey ZubarevAssigned ToMichl 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionProduct Build 
Target VersionFixed in Version2.1 (SVN) 
Summary0034614: AnchorDocking: Sites can be overlapped after minimize\unminimize
DescriptionSites can be overlapped after minimize\unminimize. See attached animated gif
Steps To Reproduce1. Run components\anchordocking\minide\ example
2. Load attached layout.xml in minide
3. Dock sites and minimize\unminimize it as in attached animated gif
TagsNo tags attached.
Fixed in Revision59809
LazTarget-
Widgetset
Attached Files
  • layout.xml (1,132 bytes)
  • overlappedsites.gif (566,121 bytes)
  • anchordocking_minimize_docksite13.patch (2,610 bytes)
    Index: components/anchordocking/anchordocking.pas
    ===================================================================
    --- components/anchordocking/anchordocking.pas	(revision 59686)
    +++ components/anchordocking/anchordocking.pas	(working copy)
    @@ -1078,6 +1078,28 @@
         result:=Nil;
     end;
     
    +function ReturnAnchoredControlsSize(Control: TControl; Side: TAnchorKind): integer;
    +var
    +  i: Integer;
    +  Neighbour: TControl;
    +begin
    +  result:=high(integer);
    +  for i:=0 to Control.AnchoredControlCount-1 do begin
    +    Neighbour:=Control.AnchoredControls[i];
    +    if Neighbour.Visible then
    +    if Neighbour is TAnchorDockHostSite then
    +    if (OppositeAnchor[Side] in Neighbour.Anchors)
    +    and (Neighbour.AnchorSide[OppositeAnchor[Side]].Control=Control) then begin
    +      case Side of
    +   akTop,akBottom: if Neighbour.ClientHeight<result then
    +                     result:=Neighbour.ClientHeight;
    +   akLeft,akRight: if Neighbour.ClientWidth<result then
    +                     result:=Neighbour.ClientWidth;
    +      end;
    +    end;
    +  end;
    +end;
    +
     function NeighbourCanBeShrinked(EnlargeControl, Neighbour: TControl;
       Side: TAnchorKind): boolean;
     { returns true if Neighbour can be shrinked on the opposite side of Side
    @@ -5492,10 +5514,9 @@
     procedure TAnchorDockHostSite.AsyncMinimizeSite(Data: PtrInt);
     var
       AControl: TControl;
    -  //OpositeDockHostSite:TAnchorDockHostSite;
       Splitter: TAnchorDockSplitter;
       SplitterAnchorKind:TAnchorKind;
    -  //SpliterPercentPosition:Single;
    +  MaxSize:integer;
     begin
       fMinimization:=true;
       debugln(['TAnchorDockHostSite.MinimizeSite ',DbgSName(Self),' SiteType=',dbgs(SiteType)]);
    @@ -5509,8 +5530,18 @@
           FMinimizedControl:=AControl;
           AControl.Visible:=False;
           AControl.Parent:=nil;
    -      //self.DoDockOver(); OnDockOver;
         end else begin
    +      MaxSize:=ReturnAnchoredControlsSize(Splitter,SplitterAnchorKind);
    +      case SplitterAnchorKind of
    +     akTop: if AControl.Height>=MaxSize+Height then
    +              Splitter.FPercentPosition:=1-(MaxSize+Height)/(Splitter.Parent.ClientHeight*2);
    +  akBottom: if AControl.Height>=MaxSize+Height then
    +              Splitter.FPercentPosition:=(MaxSize+Height)/(Splitter.Parent.ClientHeight*2);
    +    akLeft: if AControl.Width>=MaxSize+Width then
    +              Splitter.FPercentPosition:=1-(MaxSize+Width)/(Splitter.Parent.ClientWidth*2);
    +   akRight: if AControl.Width>=MaxSize+Width then
    +              Splitter.FPercentPosition:=(MaxSize+Width)/(Splitter.Parent.ClientWidth*2);
    +      end;
           AControl.Parent:=self;
           AControl.Visible:=True;
           FMinimizedControl:=nil;
    

Relationships

related to 0034347 closedMichl AnchorDocking feature (new button: size reduction of the panel) 

Activities

Andrey Zubarev

2018-11-28 11:43

reporter  

layout.xml (1,132 bytes)

Andrey Zubarev

2018-11-28 11:43

reporter  

overlappedsites.gif (566,121 bytes)

Andrey Zubarev

2018-11-29 21:38

reporter  

anchordocking_minimize_docksite13.patch (2,610 bytes)
Index: components/anchordocking/anchordocking.pas
===================================================================
--- components/anchordocking/anchordocking.pas	(revision 59686)
+++ components/anchordocking/anchordocking.pas	(working copy)
@@ -1078,6 +1078,28 @@
     result:=Nil;
 end;
 
+function ReturnAnchoredControlsSize(Control: TControl; Side: TAnchorKind): integer;
+var
+  i: Integer;
+  Neighbour: TControl;
+begin
+  result:=high(integer);
+  for i:=0 to Control.AnchoredControlCount-1 do begin
+    Neighbour:=Control.AnchoredControls[i];
+    if Neighbour.Visible then
+    if Neighbour is TAnchorDockHostSite then
+    if (OppositeAnchor[Side] in Neighbour.Anchors)
+    and (Neighbour.AnchorSide[OppositeAnchor[Side]].Control=Control) then begin
+      case Side of
+   akTop,akBottom: if Neighbour.ClientHeight<result then
+                     result:=Neighbour.ClientHeight;
+   akLeft,akRight: if Neighbour.ClientWidth<result then
+                     result:=Neighbour.ClientWidth;
+      end;
+    end;
+  end;
+end;
+
 function NeighbourCanBeShrinked(EnlargeControl, Neighbour: TControl;
   Side: TAnchorKind): boolean;
 { returns true if Neighbour can be shrinked on the opposite side of Side
@@ -5492,10 +5514,9 @@
 procedure TAnchorDockHostSite.AsyncMinimizeSite(Data: PtrInt);
 var
   AControl: TControl;
-  //OpositeDockHostSite:TAnchorDockHostSite;
   Splitter: TAnchorDockSplitter;
   SplitterAnchorKind:TAnchorKind;
-  //SpliterPercentPosition:Single;
+  MaxSize:integer;
 begin
   fMinimization:=true;
   debugln(['TAnchorDockHostSite.MinimizeSite ',DbgSName(Self),' SiteType=',dbgs(SiteType)]);
@@ -5509,8 +5530,18 @@
       FMinimizedControl:=AControl;
       AControl.Visible:=False;
       AControl.Parent:=nil;
-      //self.DoDockOver(); OnDockOver;
     end else begin
+      MaxSize:=ReturnAnchoredControlsSize(Splitter,SplitterAnchorKind);
+      case SplitterAnchorKind of
+     akTop: if AControl.Height>=MaxSize+Height then
+              Splitter.FPercentPosition:=1-(MaxSize+Height)/(Splitter.Parent.ClientHeight*2);
+  akBottom: if AControl.Height>=MaxSize+Height then
+              Splitter.FPercentPosition:=(MaxSize+Height)/(Splitter.Parent.ClientHeight*2);
+    akLeft: if AControl.Width>=MaxSize+Width then
+              Splitter.FPercentPosition:=1-(MaxSize+Width)/(Splitter.Parent.ClientWidth*2);
+   akRight: if AControl.Width>=MaxSize+Width then
+              Splitter.FPercentPosition:=(MaxSize+Width)/(Splitter.Parent.ClientWidth*2);
+      end;
       AControl.Parent:=self;
       AControl.Visible:=True;
       FMinimizedControl:=nil;

Andrey Zubarev

2018-11-29 21:39

reporter   ~0112267

Please review anchordocking_minimize_docksite13.patch it fix this issue

Michl

2018-12-12 22:26

developer   ~0112525

Applied. Thank you!

Issue History

Date Modified Username Field Change
2018-11-28 11:42 Andrey Zubarev New Issue
2018-11-28 11:43 Andrey Zubarev File Added: layout.xml
2018-11-28 11:43 Andrey Zubarev File Added: overlappedsites.gif
2018-11-29 21:38 Andrey Zubarev File Added: anchordocking_minimize_docksite13.patch
2018-11-29 21:39 Andrey Zubarev Note Added: 0112267
2018-12-12 22:06 Michl Assigned To => Michl
2018-12-12 22:06 Michl Status new => assigned
2018-12-12 22:09 Michl Relationship added related to 0034347
2018-12-12 22:26 Michl Fixed in Revision => 59809
2018-12-12 22:26 Michl LazTarget => -
2018-12-12 22:26 Michl Note Added: 0112525
2018-12-12 22:26 Michl Status assigned => resolved
2018-12-12 22:26 Michl Fixed in Version => 2.1 (SVN)
2018-12-12 22:26 Michl Resolution open => fixed
2018-12-14 10:05 Andrey Zubarev Status resolved => closed