From e23f2bdfce309676261f34c0028c55fc9b5e9f39 2012-05-29 07:10:45 From: Michal Klocek Date: 2012-05-29 07:10:45 Subject: [PATCH] Fix precision issue when scrolling domain --- diff --git a/src/chartdataset.cpp b/src/chartdataset.cpp index 69ad18e..24e25b4 100644 --- a/src/chartdataset.cpp +++ b/src/chartdataset.cpp @@ -268,7 +268,7 @@ Domain* ChartDataSet::domain(QAxis* axis) const } } -void ChartDataSet::scrollDomain(int dx,int dy,const QSizeF& size) +void ChartDataSet::scrollDomain(qreal dx,qreal dy,const QSizeF& size) { QMapIterator i( m_axisDomainMap); //main domain has to be the last one; diff --git a/src/chartdataset_p.h b/src/chartdataset_p.h index bf2210c..1f44738 100644 --- a/src/chartdataset_p.h +++ b/src/chartdataset_p.h @@ -53,7 +53,7 @@ public: void zoomInDomain(const QRectF& rect, const QSizeF& size); void zoomOutDomain(const QRectF& rect, const QSizeF& size); - void scrollDomain(int dx,int dy,const QSizeF& size); + void scrollDomain(qreal dx,qreal dy,const QSizeF& size); int seriesCount(QAbstractSeries::SeriesType type); int seriesIndex(QAbstractSeries *series); diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp index 1a76701..6d8b255 100644 --- a/src/chartpresenter.cpp +++ b/src/chartpresenter.cpp @@ -280,9 +280,8 @@ void ChartPresenter::zoomOut(qreal factor) m_state = ShowState; } -void ChartPresenter::scroll(int dx,int dy) +void ChartPresenter::scroll(qreal dx,qreal dy) { - if(dx<0) m_state=ScrollLeftState; if(dx>0) m_state=ScrollRightState; if(dy<0) m_state=ScrollUpState; diff --git a/src/chartpresenter_p.h b/src/chartpresenter_p.h index d99cd72..f2830e1 100644 --- a/src/chartpresenter_p.h +++ b/src/chartpresenter_p.h @@ -81,7 +81,7 @@ public: void zoomIn(qreal factor); void zoomIn(const QRectF& rect); void zoomOut(qreal factor); - void scroll(int dx,int dy); + void scroll(qreal dx,qreal dy); void setGeometry(const QRectF& rect); QRectF chartGeometry() const { return m_chartRect; } diff --git a/src/domain.cpp b/src/domain.cpp index fdb707a..551515a 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -197,7 +197,7 @@ void Domain::zoomOut(const QRectF& rect, const QSizeF& size) setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); } -void Domain::move(int dx,int dy,const QSizeF& size) +void Domain::move(qreal dx,qreal dy,const QSizeF& size) { qreal x = spanX() / size.width(); qreal y = spanY() / size.height(); diff --git a/src/domain_p.h b/src/domain_p.h index f408aff..1cc5ede 100644 --- a/src/domain_p.h +++ b/src/domain_p.h @@ -62,7 +62,7 @@ public: void zoomIn(const QRectF& rect, const QSizeF& size); void zoomOut(const QRectF& rect, const QSizeF& size); - void move(int dx,int dy,const QSizeF& size); + void move(qreal dx,qreal dy,const QSizeF& size); Q_SIGNALS: void domainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY);