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

Too large fitBounds padding throws Unsupported operation: Infinity or NaN toInt #435

Closed
kengu opened this issue Oct 2, 2019 · 1 comment

Comments

@kengu
Copy link
Contributor

kengu commented Oct 2, 2019

There is currently no upper bound on how large the padding can be compared to the MapState.size. This results in an negative number in the actual size used to calculate scaled zoom.

When calling MapController.fitBounds this ultimately throws an unexpected Unsupported operation: Infinity or NaN toInt in CustomPoint.floor.

Proposed resolution
Add lower bound on actual size in method MapState.getBoundsZoom, as proposed on line 219 below:

218: var size = this.size - padding;
219: size = CustomPoint(math.max(0, size.x), math.max(0, size.y));

This solution is tested already and resolves the issue. I'll post an PR soon.

@kengu kengu changed the title To large fitBounds padding throws Unsupported operation: Infinity or NaN toInt To0 large fitBounds padding throws Unsupported operation: Infinity or NaN toInt Oct 2, 2019
@kengu
Copy link
Contributor Author

kengu commented Oct 2, 2019

Probably related to #409.

@kengu kengu changed the title To0 large fitBounds padding throws Unsupported operation: Infinity or NaN toInt Too large fitBounds padding throws Unsupported operation: Infinity or NaN toInt Oct 2, 2019
kengu added a commit to DISCOOS/flutter_map that referenced this issue Oct 2, 2019
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

No branches or pull requests

1 participant