Skip to content
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

Merged
merged 7 commits into from
Mar 15, 2018
Merged

Conversation

pramodsum
Copy link
Contributor

@pramodsum pramodsum commented Mar 14, 2018

  • 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.
@boxcla
Copy link

boxcla commented Mar 14, 2018

Verified that @pramodsum has signed the CLA. Thanks for the pull request!

@pramodsum pramodsum changed the title Fix: Do not attempt to save empty drawing threads Fix: Don't save empty drawing threads + fixing drawing selection Mar 15, 2018
@pramodsum pramodsum changed the title Fix: Don't save empty drawing threads + fixing drawing selection Fix: Don't save empty drawing threads Mar 15, 2018
src/util.js Outdated
export function hasValidBoundaryCoordinates(thread) {
return !!(
isHighlightAnnotation(thread.type) ||
(thread.minX &&
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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

@pramodsum pramodsum merged commit a15a7ec into box:master Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants