mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Moves the remaining ticks of the Axis to their correct position on update.
If the size of the Axis changed, this should move them smootly to their place. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ca979044d0
commit
36475c1ee5
1 changed files with 20 additions and 0 deletions
|
@ -58,6 +58,26 @@ void DiveCartesianAxis::updateTicks()
|
|||
removedText->animatedHide();
|
||||
}
|
||||
}
|
||||
|
||||
// Move the remaining Ticks / Text to it's corerct position
|
||||
// Regartind the possibly new values for the Axis
|
||||
qreal begin = orientation == Qt::Horizontal ? m.x1() : m.y1();
|
||||
qreal end = orientation == Qt::Horizontal ? m.x2() : m.y2();
|
||||
double stepSize = orientation == Qt::Horizontal ? (m.x2() - m.x1()) : (m.y2() - m.y1());
|
||||
stepSize = stepSize / steps;
|
||||
for(int i = 0, count = ticks.size(); i < count; i++, currValue += interval){
|
||||
qreal childPos = begin + i * stepSize;
|
||||
labels[i]->setText(textForValue(currValue));
|
||||
if ( orientation == Qt::Horizontal ){
|
||||
ticks[i]->animateMoveTo(childPos, m.y1() + tickSize);
|
||||
labels[i]->animateMoveTo(childPos, m.y1() + tickSize);
|
||||
}
|
||||
else{
|
||||
ticks[i]->animateMoveTo(m.x1() - tickSize, childPos);
|
||||
labels[i]->animateMoveTo(m.x1() - tickSize, childPos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QString DiveCartesianAxis::textForValue(double value)
|
||||
|
|
Loading…
Reference in a new issue