-
Notifications
You must be signed in to change notification settings - Fork 116
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
Feature: drawingSelectionUI #362
Conversation
Minh-Ng
commented
Sep 2, 2017
- Select saved drawings
- Pop up dialog and position dialog in drawing mode
- Dialog implementation is in a separate PR
@@ -454,6 +454,10 @@ class DocAnnotator extends Annotator { | |||
bindDOMListeners() { | |||
super.bindDOMListeners(); | |||
|
|||
if (!this.permissions.canAnnotate) { |
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.
double check that this doesn't block triggering highlight annotations
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.
Removing these. For some reason I had thought that the upstream codebase had if (!this.canAnnotate)
@@ -485,6 +489,12 @@ class DocAnnotator extends Annotator { | |||
this.highlightThrottleHandle = null; | |||
} | |||
|
|||
if (!this.permissions.canAnnotate) { |
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.
same as above
@@ -135,6 +135,12 @@ annotation_highlight_toggle=Highlight text | |||
annotation_highlight_comment=Add comment to highlighted text | |||
# Text for which user made the highlight annotation | |||
annotation_who_highlighted={1} highlighted | |||
# Text for which user made the drawn annotation | |||
annotation_who_drew={1} drew |
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.
Maybe drawn by {1}
? We can double check wording with Varun
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.
Personally I prefer keeping this consistent w/ highlights so {1} highlighted
or {1} drew
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 used '{1} drew' for consistency. This can easily be changed in the future.
src/lib/annotations/annotatorUtil.js
Outdated
@@ -448,7 +448,8 @@ export function validateThreadParams(thread) { | |||
export function eventToLocationHandler(locationFunction, callback) { | |||
return (event) => { | |||
const evt = event || window.event; | |||
if (!evt) { | |||
// Do nothing when the target isn't the text layer in case the text layer receives event precedence over buttons | |||
if (!evt || (event.target && event.target.className !== 'textLayer')) { |
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 remember this from our conversation but is the textlayer guaranteed to be on top? Does this method only apply for documents?
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.
This is indeed only for documents. I have only tested this on documents with textlayers. Clearly this would cause drawing to not work on images.
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.
Adding a note about this for future development
@@ -1,6 +1,8 @@ | |||
import AnnotationDialog from '../AnnotationDialog'; | |||
|
|||
class DocDrawingDialog extends AnnotationDialog { | |||
visible = false; |
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.
JSDoc in 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.
JSDoc is in #364, I separated them to make it easier to read. DocDrawingDialog is simply a stub in this PR.
this.reset(); | ||
|
||
// Only make save request to server if there exist paths to save | ||
const { undoCount } = this.pathContainer.getNumberOfItems(); | ||
if (undoCount === 0) { | ||
if (this.pathContainer.isUndoEmpty()) { |
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.
If you're reusing undo logic to determine if we should save I might rename to just isEmpty since you're already accessing the path container.
* | ||
* @return {void} | ||
*/ | ||
cleanSelector() { |
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.
"clean" doesn't really mean much to me, maybe destroy or remove?
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.
changed to removeSelection