Repository navigation
Add onAddStart/onAddProgress/onAddEnd to Markers, Circles, Polylines, Polygons - #42
Merged
Merged
Conversation
… Polygons A list of thousands shows nothing until it is drawn; these say the work is going on. They count the states a list brings by the same moment as each state's onAdded, report progress at most every 100 ms, and start over when a new list adds states, the same as js-sdk-react and android-sdk-compose. The collections are values rebuilt on every content pass, so the counts live in MapViewBase (a StateObject per map view), keyed by where each collection is written; an unchanged list is recognised by its storage and costs nothing. OverlayAddedListeners lets them hear the states OverlayAddedTracker reports. StrategyMarkerController now calls onAdded too, as on the web and Android.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These callbacks show that a long list is being put on the map. They mean the same as in js-sdk-react (MapConductor/js-sdk-react#17) and android-sdk-compose (MapConductor/android-sdk-compose#16):
onAddStart(total)comes when the list brings states that are not on the map yet.onAddProgress(added, total)comes at most every 100 ms, and once more atadded == total.onAddEnd(total)comes when all of them are on the map. That is the moment each state'sonAddedfires; for tiled states, it is when their tiles are handed to the map.onAddEnd. A list that only updates or removes states calls nothing.How it works on iOS. The collections are values rebuilt on every content pass, so they keep no count themselves. Instead:
Circles(...)and the others put anAddProgressRequestintoMapViewContent, but only when a callback is set.MapViewBase, which every provider except the template wraps its map in, keeps the counts in a@StateObjectfor the life of the map view. No provider needs changing.#fileID,#lineand#columndefaults, plus its order when the same line repeats in a loop. It starts from nothing when it leaves the content and comes back, and when the map is recreated.OverlayAddedListeners(@_spi(MapConductorDriver)) passes each batch thatOverlayAddedTracker.notifyreports to the counts.Also:
StrategyMarkerControllernow callsonAdded, including for markers held until the first camera, as the web and Android versions already did.Tests:
AddProgressTests(11 cases) andStrategyMarkerClearOrderTests.testOnAddedForDirectAndHeldMarkers. The whole suite passes (557) on the iPhone 17 Pro simulator.Checked in the sample: antenna-horizons (723,800 circles, MapLibre, simulator, Release) logged
start 723800, thenprogress 723800/723800andend5.7 s later.