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 trigger annotation dialogs when a new highlight is pending #26

Closed
wants to merge 2 commits into from
Closed

Conversation

pramodsum
Copy link
Contributor

No description provided.

@@ -188,8 +188,11 @@ class DocHighlightThread extends AnnotationThread {
* @return {boolean} Whether we should delay drawing highlight
*/
onMousemove(event) {
if (docAnnotatorUtil.hasActivePendingDialog(this._annotatedElement)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is adding even more logic to the mousemove loop we were worried about causing performance problems

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: .bp-highlight-dialog:not(.bp-is-hidden) is not a particularly performant query, which may exacerbate the issue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to move this logic to a frame by frame check, with mousemove() only setting a flag checkAnnotationCollisions to true and updating cursor position. Each frame, via requestAnimationFrame can check to see if the flag has been set to true, and then we can do this logic here.

We can get some throttling of collision checks by running a the end of each frame, not as each onmousemove event is fired. Note: We can throttle this further by only checking at certain frame limits IE) Only check every X milliseconds. Whatever is perceived as acceptable by human eyes!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to do this refactor and then include this fix? It's kind of an annoying bug so I wasn't sure if we should fix it first and then refactor the logic in mousemove or do the refactor first.

apr-04-2017 13-19-23

*
* @param {HTMLElement} annotatedEl - Annotated document
* @return {boolean} Whether or not a pending highlight dialog is active
* @private
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tonyjin
Copy link
Contributor

tonyjin commented Apr 6, 2017

Will resubmit after the deletening

@tonyjin tonyjin closed this Apr 6, 2017
@tonyjin tonyjin deleted the bugs branch April 6, 2017 21:19
pramodsum added a commit to pramodsum/box-content-preview that referenced this pull request Nov 14, 2017
https://github.com/box/box-annotations/releases

# 0.3.0 (2017-11-14)
* Chore: Add conventional-changelog-releaser (box#34) ([624e0bd](box/box-annotations@624e0bd))
* Chore: Do not clear out node_modules on when publishing npm package (box#30) ([08c180d](box/box-annotations@08c180d))
* Fix: Do not select drawings when creating a point annotation on top (box#28) ([07fc4c1](box/box-annotations@07fc4c1))
* Fix: Drawing CSS (box#23) ([0493fcd](box/box-annotations@0493fcd))
* Fix: fix highlight selection and typos (box#21) ([ca54d5e](box/box-annotations@ca54d5e)), closes [box#21](box/box-annotations#21)
* Fix: Hide createHighlightDialog on page re-render (box#31) ([0b74717](box/box-annotations@0b74717))
* Fix: Match width of reply textarea with comments (box#33) ([5f0f29b](box/box-annotations@5f0f29b))
* Fix: Only registering thread with controller on save (box#22) ([ff75bf1](box/box-annotations@ff75bf1))
* Fix: Only show create dialog when creating new point annotations (box#29) ([4822ece](box/box-annotations@4822ece))
* Fix: only show newly created annotation dialog on hover (box#25) ([0ba1965](box/box-annotations@0ba1965))
* Fix: Position create dialog properly near page edges (box#32) ([968efb3](box/box-annotations@968efb3))
* Fix: release script should use correct remote branch (box#20) ([8bd12a5](box/box-annotations@8bd12a5))
* Fix: Scrolling on highlight dialogs in powerpoints (box#24) ([b21ed0e](box/box-annotations@b21ed0e))
* Fix: Validation message fails to get displayed when user clicks on 'Post' without entering any comme ([d90e72c](box/box-annotations@d90e72c))
*  Fix: Hide mobile dialog on first outside click (box#26) ([01ec48b](box/box-annotations@01ec48b))
pramodsum added a commit that referenced this pull request Nov 14, 2017
https://github.com/box/box-annotations/releases

# 0.3.0 (2017-11-14)
* Chore: Add conventional-changelog-releaser (#34) ([624e0bd](box/box-annotations@624e0bd))
* Chore: Do not clear out node_modules on when publishing npm package (#30) ([08c180d](box/box-annotations@08c180d))
* Fix: Do not select drawings when creating a point annotation on top (#28) ([07fc4c1](box/box-annotations@07fc4c1))
* Fix: Drawing CSS (#23) ([0493fcd](box/box-annotations@0493fcd))
* Fix: fix highlight selection and typos (#21) ([ca54d5e](box/box-annotations@ca54d5e)), closes [#21](box/box-annotations#21)
* Fix: Hide createHighlightDialog on page re-render (#31) ([0b74717](box/box-annotations@0b74717))
* Fix: Match width of reply textarea with comments (#33) ([5f0f29b](box/box-annotations@5f0f29b))
* Fix: Only registering thread with controller on save (#22) ([ff75bf1](box/box-annotations@ff75bf1))
* Fix: Only show create dialog when creating new point annotations (#29) ([4822ece](box/box-annotations@4822ece))
* Fix: only show newly created annotation dialog on hover (#25) ([0ba1965](box/box-annotations@0ba1965))
* Fix: Position create dialog properly near page edges (#32) ([968efb3](box/box-annotations@968efb3))
* Fix: release script should use correct remote branch (#20) ([8bd12a5](box/box-annotations@8bd12a5))
* Fix: Scrolling on highlight dialogs in powerpoints (#24) ([b21ed0e](box/box-annotations@b21ed0e))
* Fix: Validation message fails to get displayed when user clicks on 'Post' without entering any comme ([d90e72c](box/box-annotations@d90e72c))
*  Fix: Hide mobile dialog on first outside click (#26) ([01ec48b](box/box-annotations@01ec48b))
pramodsum added a commit to pramodsum/box-content-preview that referenced this pull request Nov 16, 2017
https://github.com/box/box-annotations/releases

# 0.3.0 (2017-11-14)
* Chore: Add conventional-changelog-releaser (box#34) ([624e0bd](box/box-annotations@624e0bd))
* Chore: Do not clear out node_modules on when publishing npm package (box#30) ([08c180d](box/box-annotations@08c180d))
* Fix: Do not select drawings when creating a point annotation on top (box#28) ([07fc4c1](box/box-annotations@07fc4c1))
* Fix: Drawing CSS (box#23) ([0493fcd](box/box-annotations@0493fcd))
* Fix: fix highlight selection and typos (box#21) ([ca54d5e](box/box-annotations@ca54d5e)), closes [box#21](box/box-annotations#21)
* Fix: Hide createHighlightDialog on page re-render (box#31) ([0b74717](box/box-annotations@0b74717))
* Fix: Match width of reply textarea with comments (box#33) ([5f0f29b](box/box-annotations@5f0f29b))
* Fix: Only registering thread with controller on save (box#22) ([ff75bf1](box/box-annotations@ff75bf1))
* Fix: Only show create dialog when creating new point annotations (box#29) ([4822ece](box/box-annotations@4822ece))
* Fix: only show newly created annotation dialog on hover (box#25) ([0ba1965](box/box-annotations@0ba1965))
* Fix: Position create dialog properly near page edges (box#32) ([968efb3](box/box-annotations@968efb3))
* Fix: release script should use correct remote branch (box#20) ([8bd12a5](box/box-annotations@8bd12a5))
* Fix: Scrolling on highlight dialogs in powerpoints (box#24) ([b21ed0e](box/box-annotations@b21ed0e))
* Fix: Validation message fails to get displayed when user clicks on 'Post' without entering any comme ([d90e72c](box/box-annotations@d90e72c))
*  Fix: Hide mobile dialog on first outside click (box#26) ([01ec48b](box/box-annotations@01ec48b))
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.

3 participants