-
-
Notifications
You must be signed in to change notification settings - Fork 871
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] CustomPoint has potential cast exception at runtime #1522
Comments
The flutter_map implementation had this issue at some point too and used a workaround: final tileZoomDouble = tileZoom.toDouble();
final scale = mapState.getZoomScale(viewingZoom, tileZoomDouble);
final pixelCenter =
mapState.project(center, tileZoomDouble).floor().toDoublePoint(); I don't think that this is the right solution. I can't see why |
Looks like that was introduced as part of a larger rewrite on #572 and it's not clear (is it ever :D) Just be aware, sometimes the floors and things like that are semi fudges where oddities get introduced like hairline white gaps between tiles and things like that, so double check all that kind of stuff if playing with it. |
Thanks for the explaination of the floor() usage. (: |
What is the bug?
While working on greensopinion/flutter-vector-map-tiles#149 i discovered that the current CustomPoint implementation lead to a cast exception at runtime.
This behaviour is documented in the parent class math.Point but isn't mentioned in CustomPoint:
How can we reproduce it?
Potentially this would throw an exception too:
Do you have a potential solution?
The issue is that
other
may be a num or double and turns the result into a double while the function casts it to an int.For example here:
Possible solutions:
other
to be the same type as the CustomPoint instance. This requires transforming every working double/int compination to be converted to a double/double.Platforms
tested on android but should
Severity
Erroneous: Prevents normal functioning and causes errors in the console
The text was updated successfully, but these errors were encountered: