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

Update annotations position on resize #143

Merged
merged 1 commit into from
May 15, 2023

Conversation

martinRenou
Copy link
Member

This PR also improves the window resize performance by not updating the entire react component

Fix #134

This PR also improves the window resize performance by not updating the
entire react component
@martinRenou martinRenou added bug Something isn't working enhancement New feature or request labels May 15, 2023
@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch martinRenou/jupytercad/resize

Comment on lines -1068 to -1072
clearTimeout(this._resizeTimeout);
this._resizeTimeout = setTimeout(() => {
this.forceUpdate();
this._updateAnnotation({ updatePosition: true });
}, 500);
Copy link
Member

Choose a reason for hiding this comment

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

We don't need debouncing anymore?

Copy link
Member Author

@martinRenou martinRenou May 15, 2023

Choose a reason for hiding this comment

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

I suppose the debouncing was because forceUpdate was CPU/GPU intensive, but we don't need to call forceUpdate IMO.

The window resize is way smoother with these changes, and it's immediate.

@trungleduc trungleduc merged commit e8c008f into jupytercad:main May 15, 2023
@martinRenou martinRenou deleted the resize branch May 15, 2023 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Annotations are not positioned correctly after browser window resize
2 participants