-
-
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] Changing CRS Does Not Rebuild Other Children #1322
Comments
Hi there, and thanks for your report. This might be because the May I suggest using a variable for the Let me know what happens! |
@JaffaKetchup sorry for being late; |
You could probably just call mapController move with a 0.00001 different value instead of setState or something I would imagine (I feel like we should be able to force a mapController move, whatever, but it does for the moment have a check if it's not moved, not to do anything). |
@ibrierley's suggestion will probably work, but I'm not sure that's fixing the underlying issue? If that's good enough for you, then that's great, if not, can you post your code from my suggestion. |
@ibrierley yes, i has tried this way at the first time but no luck; |
Hmm that is strange. Can you post your code from your attempt at my suggestion please? |
@JaffaKetchup here is my code
|
Ok I see. Using the IDE tools, can you get your map to a situation where the polylines aren't showing, then manually use the hot reload button. What happens? Can you try this with none of our suggestions, my suggestion, and @ibrierley's suggestion. |
@JaffaKetchup |
Can you paste a minimal example others can run (i.e _baseBuildMap etc is all missing) |
using setState should now build all children correctly and may fix this issue as long as you setState the entire map when switching which looks like what you are doing |
Hi @moonag, i had tried 3.0.0-beta.1 and the polyline still not shown when i changing the crs untill i move the map. |
Out of interest, what happens if you call setState on the widget flutter_map is in ? |
hi @ibrierley here is the example https://github.com/yang6626/flutter_map_crs.git, could you help to look at it. thanks a lot. |
Interesting, and good spot. I'm a bit baffled on this one. I can see the polyline rebuild paint get called each time (and interestingly paint gets called several tiles, even without any tilelayers, but that may well be normal). But yes, indeed it doesn't display, even with a setState, but a move does make it appear, so can confirm the issue. Looking at the flutter inspector all looks ok, and interestingly if you remove the tileLayers it doesn't display either. Can't figure if I'm missing something obvious, but it's something we should certainly understand before 3.0 |
Looks a bit like map.getOffsetFromOrigin(point) gets strange y values before the move...so maybe its something like an old pixelOrigin being used in these circumstances... I note if I do |
Thinking out loud about this a bit more, I'm wondering if we should have a kind of "reset()" method... eg Eg a soft reset Full reset (basically call those things that are in initState()) ? |
I have a fix for this issue. I wasn't updating pixel origin in setState of the map. It did get updated with the layout builder through updateSizeAndRotation, which (only gets called when the layout changes? I tested and it does fix the layer when I rotate the device). I added the update to pixel origin to build of the map and the issue is now fixed. I think a recalculate method might make sense. |
Maybe a reset stream, like is available on the |
Um not so much a reset stream, just inside of flutter map have a function with all of the values that need to update when the state of the map changes (setState, move, rotate, etc) and call that function whenever the values need to be updated. This way if new values are added or changed it only needs to happen in one spot. |
Ah, sorry, I misunderstood the context. Yeah, this makes sense - reducing spaghetti and duplication is always a good idea! |
@ibrierley @moonag @JaffaKetchup guys, i have try it from @moonag 's version and it works great. thanks all of you. |
What is the bug?
hi there
flutter_map: 2.0.0
in my case, i have 2 diffenert crs epsg4490 and epsg3857 , let's say we set it as 4490 in the first time and has a polyline on map. when i press a button to switch crs to 3857, the polyline disappear untill i move the map.
What is the expected behaviour?
the polyline still there when change crs.
How can we reproduce this issue?
Do you have a potential solution?
No response
Can you provide any other information?
No response
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: