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

Fix skipped map pan/zoom animation when switching location #2185

Merged
merged 2 commits into from
Oct 19, 2020

Conversation

raksooo
Copy link
Member

@raksooo raksooo commented Oct 16, 2020

This PR adds a custom ZoomableGroup component which doesn't contain the issue where the map zooms and pans to the initial location. As a result the other workaround can be removed and therefore both the initial transition issue and the missing transition issue caused by the first workaround is fixed.

The ZoomableGroup implementation can be removed when this issue has been solved:
zcreativelabs/react-simple-maps#228

Git checklist:


This change is Reviewable

Copy link
Contributor

@pronebird pronebird left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


gui/src/renderer/components/SvgMap.tsx, line 289 at r1 (raw file):

  const transform = useMemo(() => {
    const [x, y] = projection(center) ?? [0, 0];
    return `translate(${width / 2 - x * zoom} ${height / 2 - y * zoom}) scale(${zoom})`;

FYI I am no big fan of math within string interpolation. I think it makes code harder to follow. I think it would be better to move those computations to variables.

Copy link
Contributor

@pronebird pronebird left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Contributor

@pronebird pronebird left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@raksooo raksooo force-pushed the react-simple-maps-workaround branch from e1a42cd to b1f9984 Compare October 16, 2020 12:42
Copy link
Member Author

@raksooo raksooo left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 2 files reviewed, all discussions resolved (waiting on @pronebird)


gui/src/renderer/components/SvgMap.tsx, line 289 at r1 (raw file):

Previously, pronebird (Andrej Mihajlov) wrote…

FYI I am no big fan of math within string interpolation. I think it makes code harder to follow. I think it would be better to move those computations to variables.

Yeah, I agree. Done.

Copy link
Contributor

@pronebird pronebird left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@raksooo raksooo force-pushed the react-simple-maps-workaround branch from b1f9984 to 6538458 Compare October 19, 2020 08:19
@raksooo raksooo merged commit 8ad9aa6 into master Oct 19, 2020
@raksooo raksooo deleted the react-simple-maps-workaround branch October 19, 2020 08:22
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.

None yet

2 participants