-
Notifications
You must be signed in to change notification settings - Fork 536
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
Conversation
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() |
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.
Do we need to hide it for any reason?
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.
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.
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.
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.
Looks good to me. |
Annotator hover: update content/position when moving over a new highlight
good candidate for backport to v1.2.x. Want to open that PR, too? |
Sure. |
The PR for v1.2.x is #330 |
You can actually commit that directly. Same code. You got the push access. |
Thanks! |
OK, I've just accepted my own PR. |
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.