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:
Berthold Stoeger 2022-08-28 22:42:54 +02:00 committed by Dirk Hohndel
parent 0d92ef2835
commit edf2a2f4f4
7 changed files with 63 additions and 29 deletions

View file

@ -142,6 +142,9 @@ private:
const struct dive *d;
int dc;
bool empty; // No dive shown.
bool panning; // Currently panning.
double panningOriginalMousePosition;
double panningOriginalProfilePosition;
#ifndef SUBSURFACE_MOBILE
DiveLineItem *mouseFollowerVertical;
DiveLineItem *mouseFollowerHorizontal;