Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ Examples/SlidingButtonsFMX/Android/
Examples/SlidingButtonsFMX/OSX32/
Examples/AnimatedAlignFMX/Android/
Examples/AnimatedAlignFMX/OSX32/
*.res
DevResources
61 changes: 52 additions & 9 deletions AQPControlAnimations.pas
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,41 @@ function TAQPControlAnimations.BoundsAnimation(
EachF: TEachFunction;
PrevLeft, PrevTop, PrevWidth, PrevHeight: Integer;
OC: TControl absolute O;
OFM: TForm absolute O;
begin
Result := True;

PrevLeft := {$IFDEF FMX}Round(OC.Position.X){$ELSE}OC.Left{$ENDIF};
PrevTop := {$IFDEF FMX}Round(OC.Position.Y){$ELSE}OC.Top{$ENDIF};
PrevWidth := {$IFDEF FMX}Round(OC.Width){$ELSE}OC.Width{$ENDIF};
PrevHeight := {$IFDEF FMX}Round(OC.Height){$ELSE}OC.Height{$ENDIF};
{$IFDEF FMX}
if O is TControl then
begin
PrevLeft:=Round(OC.Position.X);
PrevTop:=Round(OC.Position.Y);
PrevWidth:=Round(OC.Width);
PrevHeight:=Round(OC.Height);
end;
if O is TForm then
begin
PrevLeft:=Round(OFM.Left);
PrevTop:=Round(OFM.Top);
PrevWidth:=Round(OFM.Width);
PrevHeight:=Round(OFM.Height);
end;
{$ELSE}
PrevLeft:=OC.Left;
PrevTop:=OC.Top;
PrevWidth:=OC.Width;
PrevHeight:=OC.Height;
{$ENDIF}

// Check, whether the bounds would be changed and quickly exit, if they don't
if
not
(
(O is TControl) and
{$IFDEF FMX}
((O is TControl) or (O is TForm))
{$ELSE}
(O is TControl)
{$ENDIF} and
(
(NewLeft <> PrevLeft) or
(NewTop <> PrevTop) or
Expand All @@ -222,6 +244,7 @@ function TAQPControlAnimations.BoundsAnimation(
Progress: Real;
AniLeft, AniTop, AniWidth, AniHeight: Integer;
OOC: TControl absolute O;
OOF: TForm absolute O;
begin
Result := True;
Progress := AQ.CurrentInterval.Progress;
Expand All @@ -231,13 +254,33 @@ function TAQPControlAnimations.BoundsAnimation(
if NewWidth >= 0 then
AniWidth := TAQ.EaseInteger(PrevWidth, NewWidth, Progress, EaseFunction)
else
AniWidth := {$IFDEF FMX}Round({$ENDIF}OOC.Width{$IFDEF FMX}){$ENDIF};
begin
{$IFDEF FMX}
if (O is TControl) then
AniWidth:=Round(OOC.Width);
if (O is TForm) then
AniWidth:=Round(OOF.Width);
{$ELSE}
AniWidth:=OOC.Width;
{$ENDIF}
end;
if NewHeight >= 0 then
AniHeight := TAQ.EaseInteger(PrevHeight, NewHeight, Progress, EaseFunction)
else
AniHeight := {$IFDEF FMX}Round({$ENDIF}OOC.Height{$IFDEF FMX}){$ENDIF};

OOC.SetBounds(AniLeft, AniTop, AniWidth, AniHeight);
begin
{$IFDEF FMX}
if (O is TControl) then
AniHeight:=Round(OOC.Height);
if (O is TForm) then
AniHeight:=Round(OOF.Height);
{$ELSE}
AniHeight:=OOC.Height;
{$ENDIF}
end;
if (O is TControl) then
OOC.SetBounds(AniLeft, AniTop, AniWidth, AniHeight);
if (O is TForm) then
OOF.SetBounds(AniLeft, AniTop, AniWidth, AniHeight);

if Progress = 1 then
begin
Expand Down
8 changes: 5 additions & 3 deletions AnyiQuack.pas
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ TAQ = class sealed (TAQBase)

function SliceChain(StartIndex: Integer; Count: Integer = 0): TAQ;

function DebugMessage(HeadMessage: String = ''; Caption: String = ''): TAQ;
function DebugMessage(const HeadMessage: String = ''; Caption: String = ''):
TAQ;

function Plugin<T: TAQPlugin,CONSTRUCTOR>: T;

Expand Down Expand Up @@ -1086,7 +1087,8 @@ function TAQ.CustomFiller(const Filler: TEachFunction; Append, Recurse: Boolean)
Result := TargetAQ;
end;

function TAQ.DebugMessage(HeadMessage: String = ''; Caption: String = ''): TAQ;
function TAQ.DebugMessage(const HeadMessage: String = ''; Caption: String
= ''): TAQ;
{$IFDEF DEBUG}
var
ChainPath: TStringList;
Expand Down Expand Up @@ -2470,7 +2472,7 @@ class function TAQ.Take(Objects: TObjectList): TAQ;

class function TAQ.Take<T>(Objects: TObjectList<T>): TAQ;
var
cc: Integer;
cc: integer;
{$IFDEF RetakeFromGC}
AQMatch: TAQ;
ObjectsCount: Integer;
Expand Down
Loading