Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Conversation

@Areson
Copy link
Contributor

@Areson Areson commented Sep 30, 2017

Bugfix for #3504.

@yotamberk Sorry for the quick second pull request on this. I realized once I put everything back together that I made an error with where the setTimeout was located for ensuring the final scroll position. It works fine in the example, but a more complex timeline with a heavier redraw (like the one I have in my own project) needs to have this in the proper location.

setFinalVerticalPosition();

// Let the redraw settle and finalize the position.
setTimeout(setFinalVerticalPosition, 100);
Copy link
Member

Choose a reason for hiding this comment

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

Try requestFrameAnimation instead of setTimeout

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think that will accomplish what I'm trying to do here. The core issue that I noticed is the timeline resizes groups as you scroll horizontally, and if that resize happens just after the vertical scroll finishes then the "final" position the user sees is not the item that they asked to have focused. I don't have an event I can hook into for that at the moment, so the best I've got is a small delay after the vertical scroll has finished to essentially do a "double check". requestAnimationFrame would likely call this too soon, which is why I chose setTimeout. If you have a suggestion for an event or something else I could check that would be more reliable I'll gladly use that.

Copy link
Member

Choose a reason for hiding this comment

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

mmm Not really. I'll approve it for now. I'l think about it more though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm wanting to try and do some tracing of the various events that are being emitted so I can understand where and when the recalculations come from post-focus. If I find something l'll let you know.

@yotamberk yotamberk merged commit 006b162 into visjs:develop Oct 1, 2017
primozs pushed a commit to primozs/vis that referenced this pull request Jan 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants