TAChart: More user-friendly zooming behavior when extent limits are active. Issue #35344, patch by Marcin Wiazowski

git-svn-id: trunk@61171 -
This commit is contained in:
wp 2019-05-07 14:00:33 +00:00
parent 489364c2aa
commit 854d6a57f8

View File

@ -1184,21 +1184,25 @@ procedure TBasicZoomTool.DoZoom(ANewExtent: TDoubleRect; AFull: Boolean);
Scale := 1; Scale := 1;
AllowProportionalAdjustment := true; AllowProportionalAdjustment := true;
// if there is no both-sides extent limitation - allow change
if not (LimitLo in LimitToExtent) or not (LimitHi in LimitToExtent) then exit;
// if new size is within the limit - allow change // if new size is within the limit - allow change
if NewSize <= MaxSize then exit; if NewSize <= MaxSize then exit;
// if size is not growing - allow change // if size is not growing - allow change
if NewSize <= PrevSize then exit; if NewSize <= PrevSize then exit;
// if there is no both-sides extent limitation - allow change if PrevSize >= MaxSize then begin
if not (LimitLo in LimitToExtent) or not (LimitHi in LimitToExtent) then exit; // if previous size already reaches or exceeds the limit - set Scale to 0,
// disable proportional adjustments and exit; in this case, change in size
if PrevSize >= MaxSize then // will be reverted for the current dimension, and adjusting the other
// if previous size already reaches or exceeds the limit - do NOT allow change // dimension will be performed independently
Scale := 0 Scale := 0;
else AllowProportionalAdjustment := false;
// if previous size is within the limit - allow change, but make the new size end else
// smaller than requested // if previous size is within the limit - allow change, but make the new
// size smaller than requested
Scale := (MaxSize - PrevSize) / (NewSize - PrevSize); Scale := (MaxSize - PrevSize) / (NewSize - PrevSize);
end; end;