bug: fix the tooltip not disappearing issue #3347
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3282.
Repro case: when tooltip is shown, slowly move the mouse to an edge of a
chart. We expect the tooltip the disappear when the cursor is on the
edge of the chart.
Cause:
For Polymer 2 and its Shadow DOM compatibility, TensorBoard opted out of the
event delegation of Plottable. Plottable, by default, attaches a set of event
listeners on document.body and appropriate callbacks depending on the
circumstances. In Shadow DOM, the event re-targetting broke (harder to identify
event.target
) so TensorBoard, instead, attaches event listeners on everyPlottable container, SVGs.
When mouse leaves (mouseout) the container, Plottable remaps the event as
mouse move and calculate whether the cursor is inside a component
(Interaction.prototype._isInsideComponent, specifically) to trigger appropriate
callback. The method, however is flawed since it returns, for a component that
is at for instance (0, 0) with size of (100, 100), true when pointer is at
(100, 100). It should only return true for [0, 100), instead. As a result, the
mouseout event occurred at (100, 100) was treated as an event inside the
component but all the subsequent mouse movements are not captured since they
are events that occurred outside of the event target. In vanilla Plottable,
this bug do not manifest since event delegation on the entire document will
eventually trigger mouse out when cursor is at, for instance, (101, 100).
Fix:
Overwrote the method, _isInsideComponent, with the correct implementation.