mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: implement panning of profile
When zoomed in, the profile position was moved by hovering with the mouse. What a horrible user experience. This is especially useless if we want to implement an interactive profile on mobile. Instead, let the user start the panning with a mouse click. The code is somewhat nasty, because the position is given as a real in the [0,1] range, which represents all possible positions from completely to the left to completely to the right. This commit also removes the restriction that the planner handles can only be moved when fully zoomed out. It is not completely clear what the implications are. Let's see. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
0d92ef2835
commit
edf2a2f4f4
7 changed files with 63 additions and 29 deletions
|
|
@ -436,6 +436,16 @@ double DiveCartesianAxis::valueAt(const QPointF &p) const
|
|||
return fraction * (max - min) + min;
|
||||
}
|
||||
|
||||
double DiveCartesianAxis::deltaToValue(double delta) const
|
||||
{
|
||||
QLineF m = line();
|
||||
double screenSize = position == Position::Bottom ? m.x2() - m.x1()
|
||||
: m.y2() - m.y1();
|
||||
double axisSize = max - min;
|
||||
double res = delta * axisSize / screenSize;
|
||||
return ((position == Position::Bottom) == inverted) ? -res : res;
|
||||
}
|
||||
|
||||
double DiveCartesianAxis::posAtValue(double value, double max, double min) const
|
||||
{
|
||||
QLineF m = line();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue