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

Annotator hover: update content/position when moving over a new highlight #329

Merged
merged 3 commits into from
Mar 20, 2014
Merged

Annotator hover: update content/position when moving over a new highlight #329

merged 3 commits into from
Mar 20, 2014

Conversation

csillag
Copy link
Contributor

@csillag csillag commented Mar 20, 2014

Changed annotator hover behavior so that when the mouse moves over a new highlight,
the annotations displayed in the hover are updated accordingly, and the viewer is moved into the new position.

(Earlier, if we moved the mouse pointer between highlights quickly enough, the viewer was never updated.)

Fixes #222.

csillag added 3 commits March 19, 2014 17:58
Changed hover behavior so that when the mouse moves over a new highlight,
the annotations displayed in the hover are updated accordingly.

Fixes #222.
else
# Viewer contains a different set of annotations.
# We should hide it first.
@viewer.hide()
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to hide it for any reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. The viewer has two states; let's call them visible and hidden. Until now, the show() method was always called in the hidden state. Not hiding the viewer here would mean calling show() in the visible state (to pass in the new annotation and position parameters). This might work with the current viewer implementation, but since this usage of the show() method is not part of the (unwritten, but assumed) contract defining the interface of the Viewer, I did not want to introduce a new requirement for alternate/future viewer implementations to support this.

Anyway, there is no visible flickering, because the hide/show is happening before the browser does any rendering, so I don't see any harm 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.

There is one more argument for keeping the hide(). We have the show and hide events of the viewer, and some external components might want to display and hide information belonging to individual annotations, triggered by these events. If we don't call hide(), the hide event won't fire, so these components won't know that they should hide the information belonging to the old set of annotations.

@tilgovi
Copy link
Member

tilgovi commented Mar 20, 2014

Looks good to me.

tilgovi added a commit that referenced this pull request Mar 20, 2014
Annotator hover: update content/position when moving over a new highlight
@tilgovi tilgovi merged commit a968009 into openannotation:master Mar 20, 2014
@tilgovi tilgovi deleted the 222-update-hover branch March 20, 2014 04:17
@tilgovi tilgovi restored the 222-update-hover branch March 20, 2014 04:17
@tilgovi
Copy link
Member

tilgovi commented Mar 20, 2014

good candidate for backport to v1.2.x. Want to open that PR, too?

@csillag
Copy link
Contributor Author

csillag commented Mar 20, 2014

good candidate for backport to v1.2.x. Want to open that PR, too?

Sure.

@csillag
Copy link
Contributor Author

csillag commented Mar 20, 2014

good candidate for backport to v1.2.x. Want to open that PR, too?

The PR for v1.2.x is #330

@tilgovi
Copy link
Member

tilgovi commented Mar 20, 2014

You can actually commit that directly. Same code. You got the push access.

@tilgovi
Copy link
Member

tilgovi commented Mar 20, 2014

Thanks!

@csillag
Copy link
Contributor Author

csillag commented Mar 20, 2014

You can actually commit that directly. Same code. You got the push access.

OK, I've just accepted my own PR.

@tilgovi tilgovi deleted the 222-update-hover branch March 20, 2014 06:11
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.

Annotator hover behaviour is too sticky
2 participants