profile: rewrite ProfileScene::pointOnProfile()

This function was used to check wether a screen-point
is located on the profile. Bizzarely, this was done by
transforming into local coordinates and checking
min/max value. Simply check the screen coordinates
directly. Moreover, make the function return whether
the point is inside the region, not outside the region,
to make logic more straight forward.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-10-26 16:37:38 +02:00 committed by Dirk Hohndel
parent 7df0adef64
commit 210660d057
6 changed files with 23 additions and 14 deletions

View file

@ -332,7 +332,7 @@ void ProfileWidget2::mouseDoubleClickEvent(QMouseEvent *event)
{
if ((currentState == PLAN || currentState == EDIT) && plannerModel) {
QPointF mappedPos = mapToScene(event->pos());
if (profileScene->isPointOutOfBoundaries(mappedPos))
if (!profileScene->pointOnProfile(mappedPos))
return;
int minutes = lrint(profileScene->timeAxis->valueAt(mappedPos) / 60);