Changeset - fbe70e32bc1a
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 8 years ago 2017-08-16 08:26:42
hy@ozderya.net
fix wrong view size, y axis scroll is broken
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/scrollzoomer.cpp
Show inline comments
 
@@ -61,55 +61,56 @@ ScrollZoomer::~ScrollZoomer()
 
{
 
    delete d_cornerWidget;
 
    delete d_vScrollData;
 
    delete d_hScrollData;
 
}
 

	
 
void ScrollZoomer::setXLimits(double min, double max)
 
{
 
    xMin = min;
 
    xMax = max;
 
    setZoomBase();
 
    // TODO: should we update zoom base here?
 
}
 

	
 
void ScrollZoomer::setHViewSize(double size)
 
{
 
    hViewSize = size;
 
}
 

	
 
void ScrollZoomer::setZoomBase(bool doReplot)
 
{
 
    QwtPlotZoomer::setZoomBase(doReplot);
 
    auto zb = zoomBase();
 
    auto zs = zoomStack();
 
    zb.setRight(xMax);
 
    if ((xMax - xMin) < hViewSize)
 
    {
 
        zb.setWidth(xMax - xMin);
 
        zb.setLeft(xMin);
 
    }
 
    else
 
    {
 
        zb.setWidth(hViewSize);
 
        zb.setLeft(xMax-hViewSize);
 
    }
 
    zs[0] = zb;
 
    setZoomStack(zs);
 
}
 

	
 
void ScrollZoomer::rescale()
 
{
 
    QwtScaleWidget *xScale = plot()->axisWidget( xAxis() );
 
    QwtScaleWidget *yScale = plot()->axisWidget( yAxis() );
 

	
 
    if ( zoomRectIndex() <= 0 )
 
    {
 
        if ( d_inZoom )
 
        {
 
            xScale->setMinBorderDist( 0, 0 );
 
            yScale->setMinBorderDist( 0, 0 );
 

	
 
            QwtPlotLayout *layout = plot()->plotLayout();
 

	
 
            for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
 
                layout->setAlignCanvasToScale( axis, d_alignCanvasToScales[ axis ] );
 

	
 
            d_inZoom = false;
 
        }
0 comments (0 inline, 0 general)