Page 1 of 1

Error in MouseMove

Posted: Mon Dec 03, 2007 3:32 pm
by 13046026
Hi,

There is an error in Chart.DoMouseMove

Code: Select all


public virtual void DoMouseMove(int x, int y, ref Cursor c)
{
    if (!this.CancelMouse)
    {
        if ((this.zoom != null) && this.zoom.Active)
        {
            if (this.zoom.Direction == ZoomDirections.Vertical)
            {
                x = this.ChartRect.Right;
            }
            if (this.zoom.Direction == ZoomDirections.Horizontal)
            {
                y = this.ChartRect.Bottom;
            }
            if ((x != this.zoom.x1) || (y != this.zoom.y1))
            {
                this.zoom.Draw();
                this.zoom.x1 = x;
                this.zoom.y1 = y;
                this.zoom.Draw();
            }
        }
        else if ((this.panning != null) && this.panning.Active)
        {
            if (!this.ChartRect.Contains(x, y))
            {
                this.panning.Active = false;
            }
            else if ((x != this.panning.x1) || (y != this.panning.y1))
            {
                bool panned = false;
/*=>*/      this.panning.Check(); /* REMOVE THIS LINE!*/
                if (this.restoredAxisScales)
                {
                    this.savedScales = this.SaveScales();
                    this.restoredAxisScales = false;
                }
                this.PanAxis(true, x, this.panning.x1, ref panned);
                this.PanAxis(false, y, this.panning.y1, ref panned);
                this.panning.x1 = x;
                this.panning.y1 = y;
                if (panned)
                {
                    if (this.parent != null)
                    {
                        this.parent.DoScroll(this, EventArgs.Empty);
                    }
                    this.Invalidate();
                }
            }
        }
        else
        {
            this.CheckMouseSeries(ref c, x, y);
        }
    }
}


The line

Code: Select all

this.panning.Check()
sould be removed. this causes a very sluggish panning behaviour if you move the mouse to x/y coordinate lower than the x/y coordinate the mouse was on mouse down.

you can try it in the following example:
Welcome !\New in Zoom and Scroll\Modifier Keys

stefan

Posted: Tue Dec 04, 2007 12:53 pm
by narcis
Hi stefan,

Which exact TeeChart version are you using? Current DoMouseMove code is pretty different. Could you please try with the latest maintenance release available at the client area?

Thanks in advance.

Posted: Tue Dec 04, 2007 1:00 pm
by 13046026
It's version 3.2.2868.26903

this should be the latest available release.

i have located this bug via reflector therefore the source
can be different in the original version.

you can look at the panning.Check method:

Code: Select all

 int num;
    if (this.x0 > this.x1)
    {
        num = this.x0;
        this.x0 = this.x1;
        this.x1 = num;
    }
    if (this.y0 > this.y1)
    {
        num = this.y0;
        this.y0 = this.y1;
        this.y1 = num;
    }
in the mentioned case it switches the start and current positions. this is
wrong for panning!

Posted: Wed Dec 05, 2007 1:14 pm
by narcis
Hi stefans,

Thanks for the information. I haven't been able to reproduce this problem here. Would you be so kind to let us know the exact steps we should follow to reproduce the issue here?

Thanks in advance.

Posted: Wed Dec 05, 2007 1:28 pm
by 13046026
Hi,

you can start the TeeChart Features application (shipped with teechart)

then go to
Welcome !\Chart styles\Standard\Line(Strip)\Clickable lines

steps to reproduce bug:
Make right-mouse-down (and hold pressed) on a Point in the middle of X and middle of Y axis (tell the Mouse Position MA by now)

Move the Mouse (pressed) more to bottom and more to right.
The Point is moved too (panning) and is exaclty below Mouse Position as before (correct behaviour).

Move the Mouse (pressed) more to top and more to left.
If the current X or Y coordinate is < than MA there
is a wrong panning done ( the Point is NOT below Mouse Position as before)

Posted: Wed Dec 05, 2007 2:53 pm
by narcis
Hi stefans,

Thanks for the information.

I've been able to reproduce the issue now and checked that the fix you suggested works fine as well.

Unfortunately this change won't make in the next maintenance release as it has already been closed and its publication is imminent. We will include the fix to the next maintenance release after this week's.