mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: don't use scene for zooming
We were using the QGraphicsScene machinery to zoom into the plot. This not only zoomed into the dive, but into the whole thing. In general, one couldn't see the axes anymore. Instead, adjust the range of the time-axis according to the zoom-level and position. Of course, the code isn't adapted to that and the result is comical. The chart features will have to be fixed one-by-one. Oh joy. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
7d3e246680
commit
c09382036f
4 changed files with 36 additions and 64 deletions
|
|
@ -299,7 +299,8 @@ bool ProfileScene::isPointOutOfBoundaries(const QPointF &point) const
|
|||
ypos < profileYAxis->minimum();
|
||||
}
|
||||
|
||||
void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsModel *plannerModel, bool inPlanner, bool instant, bool calcMax)
|
||||
void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsModel *plannerModel,
|
||||
bool inPlanner, bool instant, bool calcMax, double zoom, double zoomedPosition)
|
||||
{
|
||||
d = dIn;
|
||||
dc = dcIn;
|
||||
|
|
@ -388,8 +389,11 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
|||
percentageAxis->setVisible(false);
|
||||
percentageAxis->updateTicks(animSpeed);
|
||||
|
||||
if (calcMax)
|
||||
timeAxis->setBounds(0.0, maxtime);
|
||||
if (calcMax) {
|
||||
double relStart = (1.0 - 1.0/zoom) * zoomedPosition;
|
||||
double relEnd = relStart + 1.0/zoom;
|
||||
timeAxis->setBounds(round(relStart * maxtime), round(relEnd * maxtime));
|
||||
}
|
||||
|
||||
timeAxis->updateTicks(animSpeed);
|
||||
cylinderPressureAxis->setBounds(plotInfo.minpressure, plotInfo.maxpressure);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue