From 2ee5aeec56876793334d3bb2f89276c76a70adae Mon Sep 17 00:00:00 2001 From: wp Date: Wed, 10 Feb 2016 21:45:34 +0000 Subject: [PATCH] TAChart: Fix mouse-wheel-zooming with fixed chart center. git-svn-id: trunk@51585 - --- components/tachart/tatools.pas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/tachart/tatools.pas b/components/tachart/tatools.pas index 2ebbfb6ea6..0b5715e6a3 100644 --- a/components/tachart/tatools.pas +++ b/components/tachart/tatools.pas @@ -1337,12 +1337,14 @@ var ext: TDoubleRect; begin ext := FChart.LogicalExtent; - center := FChart.ImageToGraph(APoint); sz := ext.b - ext.a; - if FixedPoint and (sz.X <> 0) and (sz.Y <> 0) then - ratio := (center - ext.a) / sz - else + if FixedPoint and (sz.X <> 0) and (sz.Y <> 0) then begin + center := FChart.ImageToGraph(APoint); + ratio := (center - ext.a) / sz; + end else begin + center := DoublePoint((ext.a.x + ext.b.X) / 2, (ext.a.y + ext.b.y) / 2); ratio := DoublePoint(0.5, 0.5); + end; ext.a := center - sz * ratio / AFactor; ext.b := center + sz * (DoublePoint(1, 1) - ratio) / AFactor; DoZoom(ext, false);