-
Notifications
You must be signed in to change notification settings - Fork 46
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: Don't save empty drawing threads #138
Conversation
pramodsum
commented
Mar 14, 2018
•
edited
Loading
edited
- Fixes issue where users couldn't select drawings after pressing the "Done" button
- Drawing handlers require a blank temporary thread in order to actually start/stop drawing. This thread is not yet saved into the API and will not have valid location information until the user actually begins drawing. This prevents the controller from saving that empty thread until it contains valid location information.
- Validates min/max boundary coordinates for annotation threads
- Drawing handlers require a blank temporary thread in order to actually start/stop drawing. This thread is not yet saved into the API and will not have valid location information until the user actually begins drawing. This prevents the controller from saving that empty thread until it contains valid location information.
Verified that @pramodsum has signed the CLA. Thanks for the pull request! |
src/util.js
Outdated
export function hasValidBoundaryCoordinates(thread) { | ||
return !!( | ||
isHighlightAnnotation(thread.type) || | ||
(thread.minX && |
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.
AFAIK NaN
is neither true nor false (NaN == true
is false, and NaN == false
is false). you may not need to do your Math.isNaN()
checks here.
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.
👍
@@ -134,7 +143,10 @@ class DrawingModeController extends AnnotationModeController { | |||
}); | |||
|
|||
this.pushElementHandler(this.postButtonEl, 'click', () => { | |||
this.saveThread(this.currentThread); | |||
if (this.hasPendingDrawing) { |
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.
use thread status instead of this extra boolean