FIX: Viewer - zoom image

This commit is contained in:
Alexander Koblov 2024-04-18 17:56:07 +03:00
commit c4c8e69189

View file

@ -3,7 +3,7 @@
-------------------------------------------------------------------------
Build-in File Viewer.
Copyright (C) 2007-2023 Alexander Koblov (alexx2000@mail.ru)
Copyright (C) 2007-2024 Alexander Koblov (alexx2000@mail.ru)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -437,6 +437,7 @@ type
procedure ShowTextViewer(AMode: TViewerControlMode);
procedure CopyMoveFile(AViewerAction:TViewerCopyMoveAction);
procedure ZoomImage(ADelta: Double);
procedure RotateImage(AGradus:integer);
procedure MirrorImage(AVertically:boolean=False);
@ -1622,6 +1623,12 @@ begin
end;
end;
procedure TfrmViewer.ZoomImage(ADelta: Double);
begin
FZoomFactor := Round(FZoomFactor * ADelta);
AdjustImageSize;
end;
procedure TfrmViewer.RotateImage(AGradus: integer);
// AGradus now supported only 90,180,270 values
var
@ -3495,22 +3502,19 @@ begin
end;
procedure TfrmViewer.cm_Zoom(const Params: array of string);
var
K: Double;
begin
if miGraphics.Checked then
try
K:= StrToFloat(Params[0]);
ZoomImage(StrToFloat(Params[0]));
except
Exit;
// Exit
end;
FZoomFactor := Round(FZoomFactor * K);
AdjustImageSize;
end;
procedure TfrmViewer.cm_ZoomIn(const Params: array of string);
begin
if miGraphics.Checked then
cm_Zoom(['1.1'])
ZoomImage(1.1)
else
begin
gFonts[dcfViewer].Size:=gFonts[dcfViewer].Size+1;
@ -3522,7 +3526,7 @@ end;
procedure TfrmViewer.cm_ZoomOut(const Params: array of string);
begin
if miGraphics.Checked then
cm_Zoom(['0.9'])
ZoomImage(0.9)
else
begin
gFonts[dcfViewer].Size:=gFonts[dcfViewer].Size-1;