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

Animate camera to LatLngBounds #258

Merged
merged 9 commits into from
Jan 27, 2025

Conversation

michalgwo
Copy link
Contributor

@michalgwo michalgwo commented Jan 21, 2025

  • Android target - works fine
  • iOS target - unfortunately I don't have a Mac right now, so I can't implement it. It looks like camera:fittingCoordinateBounds:edgePadding: or setVisibleCoordinateBounds is the way to go
  • JS target - works fine, but FitBoundsOptions doesn't have a duration parameter, so currently it has no effect on JS. It was my first time working with JS target, so I'm unsure if I've done everything right.
  • Desktop target - the other animateCameraPosition() is not implemented on the desktop, so I left it unimplemented as well

Example of usage:

cameraState.animateTo(
  BoundingBox(
    northeast = Position(20.009155194730226, 50.06807238031317),
    southwest = Position(19.91854897235649,50.04007893350368)
  ),
  padding = PaddingValues(50.dp),
  tilt = 0.0,
  bearing = 0.0
)

@sargunv sargunv added this to the v0.7.0 milestone Jan 22, 2025
@michalgwo
Copy link
Contributor Author

I just realized there is a BoundingBox class, so it makes more sense to use this, instead of creating a new LatLngBounds.

@sargunv
Copy link
Owner

sargunv commented Jan 27, 2025

Thanks for this!

@sargunv sargunv enabled auto-merge (squash) January 27, 2025 05:57
@sargunv sargunv merged commit d795983 into sargunv:main Jan 27, 2025
9 checks passed
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.

2 participants