mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
7df0adef64
commit
210660d057
6 changed files with 23 additions and 14 deletions
|
@ -313,14 +313,9 @@ void ProfileScene::updateAxes(bool diveHasHeartBeat, bool simplified)
|
|||
temperatureAxis->setTransform(slope(mkelvin_to_F), intercept(mkelvin_to_F));
|
||||
}
|
||||
|
||||
bool ProfileScene::isPointOutOfBoundaries(const QPointF &point) const
|
||||
bool ProfileScene::pointOnProfile(const QPointF &point) const
|
||||
{
|
||||
double xpos = timeAxis->valueAt(point);
|
||||
double ypos = profileYAxis->valueAt(point);
|
||||
return xpos > timeAxis->maximum() ||
|
||||
xpos < timeAxis->minimum() ||
|
||||
ypos > profileYAxis->maximum() ||
|
||||
ypos < profileYAxis->minimum();
|
||||
return timeAxis->pointInRange(point.x()) && profileYAxis->pointInRange(point.y());
|
||||
}
|
||||
|
||||
void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsModel *plannerModel,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue