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

Zoom-in feature: d3 approach #7

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

Conversation

Konstiman
Copy link

@Konstiman Konstiman commented Jun 17, 2020

I used the d3 library to animate the zoom-in and zoom-out functionality.

I tried it on Chrome and Firefox. The performance is better than the previous version and it also behaves more like the current Headstart.

I had to rewrite the Paper and Bubble components to class components.

For the components that are mounted during the animation run, it was necessary to store the previous zoom values.

It was also needed to somehow track whether the animation is running or not. That's why I added the animationLock property and a timer into the UIStore. Next time I'd do it differently though - probably similarly to the current Headstart, where the transitions increment and decrement some counter.

I already know about some bugs:

  • There is a warning saying an unmounted component is updated. This can be probably solved by stopping the transition on componentWillUnmount() => solved
  • When resizing the window, the papers jump out of the bubbles. I'll try to debug this. => solved
  • Not exactly a bug, it's more like a difference to the current Headstart: when the zoom in is running, it's not possible to zoom out.

Some things could have been done better (e.g. the function updateZoomStateAnimated could be refactored into much smaller piece of code), but I think that can be done during the final implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant