Repository navigation
Clear overlays in the order remove, empty the manager, then post-process - #27
Merged
Merged
Conversation
GL-style renderers ignore onRemove and redraw everything the manager holds in onPostProcess. Polyline, GroundImage and RasterLayer called onPostProcess before emptying the manager, so clear() redrew every overlay it was meant to remove; Polygon and Circle did not call it at all. All five now run onRemove, manager.clear(), onPostProcess, matching android-sdk-core. OverlayClearOrderTests pins this with a GL-style fake renderer for each kind.
AbstractMarkerController.clear() emptied the manager without calling onPostProcess. The MapLibre-family marker renderers only drop their per-marker bookkeeping in onRemove and redraw the source from the manager in onPostProcess, so the markers stayed on the map. Clear now ends the same way as the other five overlay kinds, matching android-sdk-core and js-sdk-core. OverlayClearOrderTests gains the marker case.
This was referenced Nov 8, 2026
Clear overlays in the order remove, empty the manager, then post-process
MapConductor/js-sdk-core#26
Merged
This was referenced Nov 8, 2026
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.
なぜ
clearOverlays()を呼んでも、MapLibre 系(MapLibre / Mapbox / Mappls / MapTiler / TomTom / Longdo / OpenMobileMaps)の地図ではオーバーレイが消えずに残っていました。これらのプロバイダの描画担当は、
onRemoveでは地図に触らず、onPostProcessで manager が持っている全部を描き直します。ところが core の各コントローラのclear()は、onPostProcessを呼ぶ(=消す前の全部を描き直す)onPostProcessを呼ばない(=前に描いたものが残る)onPostProcessを呼ばないとなっていて、どちらでも地図に残ります。Google Maps のように
onRemoveでネイティブのオブジェクトを消すプロバイダでは起きません。何を変えたか
clear()を、すべて「renderer.onRemove(全部)→manager.clear()→renderer.onPostProcess()」の順にそろえました(Android の Circle は元からこの順でした)。既存の前後処理(tiler、iOS の isDestroyed ガード、Android raster の withContext など)はそのままです。onPostProcessで manager の全部を描く)で、clear の後に描かれているものが空になることを 6 種類それぞれで固定しています。修正前のコードでは失敗することを確かめてあります。関連 PR(同じ修正の一式)
fix/overlay-clear-orderは次の 21 リポジトリにまたがります。1. core(3 本は互いに独立。先にマージ・公開してください)
2. Android プロバイダ(core が無くても単独で効く修正。ただしポリライン・ポリゴン・GroundImage・ラスターの消え残りは core 側で直るので、core と合わせて初めて clearOverlays() が全部消えます)
3. iOS プロバイダ(ios-sdk-core のマージ・公開の後。
clearOverlays()からコントローラのclear()を呼ぶ変更は、core の呼び順の修正が無いと GL 系で描き直しが起きて消えません)4. web プロバイダ(js-sdk-core の新しい版を npm に公開し、依存(今は
^0.3.1)を引き上げてから。理由は各 PR の本文に)マージの順番: core 3 本 → core の公開 → Android / iOS プロバイダ → js-sdk-core の npm 公開と依存の引き上げ → web プロバイダ。
検証
xcodebuild test -scheme mapconductor-core(346 本すべて通過)、scripts/api-surface.sh check(差分なし)実機・ブラウザでの確認(共通の手順)
同じ手順で、ポリゴン・ポリライン・サークル・GroundImage・ラスター・マーカーを出し、追加 → 更新(色・半径・不透明度)→ 一部削除(ポリゴン・サークル・ラスター)→ 戻す →
clearOverlays()→ clear 後に同じ state を in-place で書き換え → 同じ id・同じ内容の state を作り直して送り直す、の 7 段階をスクリーンショットで比べました。検証用のページはコミットしていません。追加・更新・削除・戻すの 4 段階の見た目は修正前と同じでした。clear 後の振る舞い(in-place の更新では戻らず、顔ぶれが変わるか作り直された state が来たら全部描き直す)は、3 プラットフォームの core の collector と同じです。
確認できていないもの
StrategyMarkerController(iOS も同名)のclear()は manager を空にするだけで、onRemoveもonPostProcessも呼びません。今回の 6 種類とは別の経路なので触っていません。