Commit f5ca6011 authored by Marcus D. Hanwell's avatar Marcus D. Hanwell
Browse files

BUG: Fixed a bug in scrolling of top and right axes.

The axes in the top and right of the vtkChartXY charts were not behaving
correctly, the variables calculating the new transforms needed to be
initialized as in the bottom and left cases before transforming them.

Change-Id: I505f5fb198e494bf678ffc9031596b47c49d9421
parent 639e7585
......@@ -1160,8 +1160,8 @@ bool vtkChartXY::MouseMoveEvent(const vtkContextMouseEvent &mouse)
// Figure out how much the mouse has moved by in plot coordinates - pan
vtkVector2d screenPos(mouse.GetScreenPos().Cast<double>().GetData());
vtkVector2d lastScreenPos(mouse.GetLastScreenPos().Cast<double>().GetData());
vtkVector2d pos(0.0);
vtkVector2d last(0.0);
vtkVector2d pos(0.0, 0.0);
vtkVector2d last(0.0, 0.0);
// Go from screen to scene coordinates to work out the delta
vtkTransform2D *transform =
......@@ -1188,6 +1188,11 @@ bool vtkChartXY::MouseMoveEvent(const vtkContextMouseEvent &mouse)
if (this->ChartPrivate->PlotCorners.size() > 2)
// Go from screen to scene coordinates to work out the delta
screenPos = vtkVector2d(mouse.GetScreenPos().Cast<double>().GetData());
lastScreenPos =
pos = vtkVector2d(0.0, 0.0);
last = vtkVector2d(0.0, 0.0);
transform = this->ChartPrivate->PlotCorners[2]->GetTransform();
transform->InverseTransformPoints(screenPos.GetData(), pos.GetData(), 1);
transform->InverseTransformPoints(lastScreenPos.GetData(), last.GetData(), 1);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment