mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Continous update of planner
Make the planner update its display continuously upon moving points including deco. This appears fast enough on typical PCs. If this ends up being to slow on some systems we may have to make it configurable. [Dirk Hohndel: cleaned up the two patches and turned into one commit] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
40462d5008
commit
fc3b68bc19
2 changed files with 21 additions and 7 deletions
|
@ -427,7 +427,7 @@ void DivePlannerGraphics::createDecoStops()
|
|||
dp = dp->next;
|
||||
}
|
||||
|
||||
if (timeLine->maximum() < dp->time / 60.0 + 5 || dp->time / 60.0 + 15 < timeLine->maximum()) {
|
||||
if (!activeDraggedHandler && (timeLine->maximum() < dp->time / 60.0 + 5 || dp->time / 60.0 + 15 < timeLine->maximum())) {
|
||||
double newMax = fmax(dp->time / 60.0 + 5, minMinutes);
|
||||
timeLine->setMaximum(newMax);
|
||||
timeLine->updateTicks();
|
||||
|
@ -521,7 +521,7 @@ void DivePlannerGraphics::mouseMoveEvent(QMouseEvent* event)
|
|||
depthString->setBrush( QColor(redDelta, greenDelta, blueDelta));
|
||||
|
||||
if (activeDraggedHandler)
|
||||
moveActiveHandler(mappedPos);
|
||||
moveActiveHandler(mappedPos, handles.indexOf(activeDraggedHandler));
|
||||
if (!handles.count())
|
||||
return;
|
||||
|
||||
|
@ -534,13 +534,27 @@ void DivePlannerGraphics::mouseMoveEvent(QMouseEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
void DivePlannerGraphics::moveActiveHandler(const QPointF& pos)
|
||||
void DivePlannerGraphics::moveActiveHandler(const QPointF& mappedPos, const int pos)
|
||||
{
|
||||
double xpos = timeLine->posAtValue(rint(timeLine->valueAt(pos)));
|
||||
double ypos = depthLine->posAtValue(rint(depthLine->valueAt(pos)));
|
||||
|
||||
divedatapoint data = plannerModel->at(pos);
|
||||
int minutes = rint(timeLine->valueAt(mappedPos));
|
||||
int meters = rint(depthLine->valueAt(mappedPos));
|
||||
double xpos = timeLine->posAtValue(minutes);
|
||||
double ypos = depthLine->posAtValue(meters);
|
||||
|
||||
data.depth = rint(depthLine->valueAt(mappedPos)) * 1000;
|
||||
data.time = rint(timeLine->valueAt(mappedPos)) * 60;
|
||||
|
||||
plannerModel->editStop(pos, data);
|
||||
|
||||
activeDraggedHandler->setPos(QPointF(xpos, ypos));
|
||||
qDeleteAll(lines);
|
||||
lines.clear();
|
||||
|
||||
createDecoStops();
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool DivePlannerGraphics::isPointOutOfBoundaries(const QPointF& point)
|
||||
|
@ -605,8 +619,8 @@ void DivePlannerGraphics::mouseReleaseEvent(QMouseEvent* event)
|
|||
activeDraggedHandler->setBrush(QBrush(Qt::white));
|
||||
activeDraggedHandler->setPos(QPointF(xpos, ypos));
|
||||
|
||||
createDecoStops();
|
||||
activeDraggedHandler = 0;
|
||||
createDecoStops();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue