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 tooltip animation when target changes while animating #5005
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
33a51ed
Fix issue #4989
jcopperfield ce679dc
Change: different approach for smooth tooltip animation in 'index'
jcopperfield 982f0b4
Fix: jslint error
jcopperfield 482e59f
Fix: remove spyOn pivot from test
jcopperfield 38574c3
Add: setAnimating-flag in transition used to set on tooltip.transition
jcopperfield f7d4d54
Decrease code complexity
jcopperfield badc4d9
Revert transition and complexity changes
jcopperfield File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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 don't think
me.pivot()
should be called if the_active
target(s) didn't change, since it resets the animation start/end values. I think that's what caused the weird animation accelerations in the following gif.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.
@simonbrunel not calling
me.pivot()
codepen causes a much weirder experience by resetting all settings to their initial values. (sorry don't have any software to make a fancy gif).Any suggestions?
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 can't debug right now :\ Maybe
_active
is different depending on the hovered bar, so the firstchanged
value istrue
because of the array order?! Though, I'm not sure why checking the latest value ofchanged
doesn't work:BTW, the following looks weird (line 869):
because if
changed
istrue
thenchanged |= true or false
is necessarytrue
, right?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.
@simonbrunel I agree that line 869 is obsolete, however it was there already obsolete from a previous pull.
The problem doesn't lay in this handleEvent, but in its caller, which
|=
itschanged
with the result of thetooltip.handleEvent
(changed |= tooltip && tooltip.handleEvent(e);
). When the caller has changed, but the tooltip hasn't, the bug presents itself, because the animation will run. I don't understand the animation system well enough to prevent the tooltip animation restarting.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'm wondering if it should not be
changed &= (model.x !== me._model.x) || (model.y !== me._model.y);
instead?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.
The issue seems to be that we detect a change for the highlighted item resetting the current animation. Calling
pivot()
as you do makes things better in this case but breaks animations when hover interaction mode/intersect are the same as tooltip (master - PR).