-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
[BUG] fitting bounds throws Infinity or NaN toInt or does not fit map correctly #1370
Comments
You could just add a check not to call fitBounds if you don't actually have any bounds....but ideally yes, there could be a protection /default behaviour in there (or simply do nothing). I also note you are using center, bounds and maxBounds all together, which are potentially contradictory. You'd probably have to show example markers to really see the other issue when there are more than one markers/points. |
I noticed the same issue after upgrading to 3.0 |
Can you provide some example settings (with latlngs etc) to reproduce the problem. |
i.e a minimal test example page that people can run that is. |
Getting the same problem, worked correctly before upgrading too 3.0.0. The provided example above should work too reproduce the issue if just passing the bounds and boundOptions. |
Seems like this should be fixed with #1369 |
I encountered the same issue. |
Does it work with the fix (i.e latest Github release)? |
It does seem to fix the issue, however, I now noticed that when using the bounds paramater with LatLngBounds.fromPoints, it does not allow the map to be zoomed in or out. Might be another issue causing this, but it does happen my side. |
Maybe put some code up, it may depends if you are using other bounds parameters like maxBounds etc as well. |
Hi @TitanKing, any news? |
The code that is currently on main has solved the problems for me.On 10 Oct 2022, at 22:27, Luka S ***@***.***> wrote:
Hi @TitanKing, any news?
Hi @typexy @Wackymax, has the issue you were experiencing been fixed?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Thanks, in that case I'm going to close this for now. Let me know if you need it reopened! |
I have the issue after updating to v3.0.0 |
Could you see if the problem is still there with this PR.. here |
I've tested that PR and the problem was resolved. |
What is the bug?
when fitbounds is called, we have to distinguish 2 cases:
/// Create new [CustomPoint] whose [x] and [y] values are rounded down
/// to int
CustomPoint floor() {
return CustomPoint(x.floor(), y.floor());
}
What is the expected behaviour?
Expected behavior is to show a map centered at the middle of the given LatLng points and to not throw an error.
How can we reproduce this issue?
Do you have a potential solution?
No response
Can you provide any other information?
Unsupported operation: Infinity or NaN toInt
#0 double.floor (dart:core-patch/double.dart)
#1 CustomPoint.floor (package:flutter_map/src/core/point.dart:22:29)
#2 FlutterMapState.getPixelBounds (package:flutter_map/src/map/flutter_map_state.dart:593:47)
#3 FlutterMapState.move (package:flutter_map/src/map/flutter_map_state.dart:457:20)
#4 FlutterMapState.fitBounds (package:flutter_map/src/map/flutter_map_state.dart:490:5)
#5 FlutterMapState.initState (package:flutter_map/src/map/flutter_map_state.dart:47:7)
#6 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5015:57)
Platforms Affected
Android, iOS
Severity
Erroneous: Prevents normal functioning and causes errors in the console
Frequency
Consistently: Always occurs at the same time and location
Requirements
flutter doctor
finds no relevant issuesThe text was updated successfully, but these errors were encountered: