anchor.diff:    end;
   
     //Restore saved center position
  -  if AKeepPosition then
  -  begin
  -    if ANewLeft = 0 then
  -    begin
  -      AScrollMaxX:= Max(ANewWidth - AWidth, 0);
  +  if bKeepPosition then
  +  begin
  +    if NewLeft = 0 then
  +    begin
  +      ScrollMaxX:= Max(NewWidth - CliWidth, 0);
         HorzScrollBar.Position:=
  -        Min(AScrollMaxX, Trunc(ACenterRatioX * ANewWidth) - AWidth div 2);
  +        Min(ScrollMaxX, Trunc(CenterRatioX * NewWidth) - CliWidth div 2);
       end
       else
         HorzScrollBar.Position:= 0;
   
  -    if ANewTop = 0 then
  -    begin
  -      AScrollMaxY:= Max(ANewHeight - AHeight, 0);
  +    if NewTop = 0 then
  +    begin
  +      ScrollMaxY:= Max(NewHeight - CliHeight, 0);
         VertScrollBar.Position:=
  -        Min(AScrollMaxY, Trunc(ACenterRatioY * ANewHeight) - AHeight div 2);
  +        Min(ScrollMaxY, Trunc(CenterRatioY * NewHeight) - CliHeight div 2);
       end
       else
         VertScrollBar.Position:= 0;
  
positive.code: 
  procedure TATImageBox.UpdateImagePosition(AResetPosition: Boolean = False);
  var
    AKeepPosition: Boolean;
    AWidth, AHeight,
    ANewWidth, ANewHeight,
    ANewLeft, ANewTop,
    AScrollMaxX, AScrollMaxY: Integer;
    ARatio, AImageRatio,
    ACenterRatioX, ACenterRatioY: Double;
    NScrollbarSize: integer;
  begin
    AKeepPosition:= FImageKeepPosition and (not AResetPosition);
  
    if FImageFit then
      NScrollbarSize:= 0
  
negative.code: 
    VertScrollBar.Visible:= not FImageFit;
    HorzScrollBar.Visible:= not FImageFit;
    CliWidth:= Width-NScrollbarSize;
    CliHeight:= Height-NScrollbarSize;
  
    //Save center position, need to restore it later
    CenterRatioX:= 0;
    CenterRatioY:= 0;
  
    if FImage.Width > 0 then
    begin
      if FImage.Left >= 0 then
        CenterRatioX:= (CliWidth div 2 - FImage.Left) / FImage.Width
      else
        CenterRatioX:= (CliWidth div 2 + HorzScrollBar.Position) / FImage.Width;
    end;
  
    if FImage.Height > 0 then
    begin
      if FImage.Top >= 0 then
        CenterRatioY:= (CliHeight div 2 - FImage.Top) / FImage.Height
      else
        CenterRatioY:= (CliHeight div 2 + VertScrollBar.Position) / FImage.Height;
    end;
  
    //Set controls params
    if not bKeepPosition then
    begin
      HorzScrollBar.Position:= 0;
      VertScrollBar.Position:= 0;
  