New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Shape tools finishing prematurely #56157
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -101,6 +101,12 @@ bool QgsMapToolShapeCircle2TangentsPoint::cadCanvasReleaseEvent( QgsMapMouseEven | |||
} | |||
else if ( e->button() == Qt::RightButton ) | |||
{ | |||
if ( mPoints.size() < 4 || mCircle.isEmpty() ) | |||
{ | |||
clean(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean if I right click after picking two points then those points are lost? I think ideally it'd just ignore the right click in that situation, not drop the existing points.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right clicking before we have enough points from the user means cancel in other digitizing tools too.
I'd consider this the same as create polygon with two vertices, or create line with a single vertex.
Why treat this differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a little unpredictable how these tools work -- as you've noted you have to left click a bunch of times, and then at some stage the left clicks start being ignored and you have to THEN do a right click. So if we abort when a right click happens before that magic threshold of left clicks is reached then it's really un user-friendly.
I think ideally the tools would give some indication of when the feature is valid and ready to be saved. Eg the rubber band becomes green or something at that stage...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd insist that in order to have predictable tools the right click should always result in either:
- Finish digitizing if enough points are collected
- Restart digitizing if not enough points are collected
This is how the main digitizing tools work, so those weird cousins should follow form.
Let's address the clunky ux in another pr. I'd suggest instead of coloring the rubberband, we add one more left click step that freezes the rubberband (ok, maybe change its color too) marking it as ready to finish. At this point the mouse does not update the rubberband any more and the user may either:
- right click to finish
- esc to reset
- backspace/del to unfreeze/pick another last point
Description
Shape map tools would generate a new feature with no geometry when right click was pressed and fewer than necessary points were digitized.
Ideally we should make those tools complete digitizing with left mouse button too when enough points are gathered.
Also fixes #56106 crash