Skip to content

Clear StrategyMarkerController in the same order as the other controllers - #28

Merged
wf9a5m75 merged 1 commit into
developfrom
fix/clear-followups
Nov 8, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
fix/clear-followups

Conversation

@wf9a5m75

@wf9a5m75 wf9a5m75 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

なぜ

StrategyMarkerController.clear()(クラスタリングなどの Strategy でマーカーを描くコントローラ)は、Strategy の中身を空にするだけで、描画担当の onRemove も onPostProcess も呼んでいませんでした。そのため clear しても、描画済みのマーカーが地図に残っていました。web の Strategy 用レンダラ(CollectorMarkerOverlayRenderer)は onPostProcess で初めて確定するので、web では GL 系に限らず全プロバイダで残っていました。

他のコントローラは MapConductor/android-sdk-core#27、#27、MapConductor/js-sdk-core#26 で「onRemove(全部) → manager を空にする → onPostProcess」の順にそろえています。

何を変えたか

  • StrategyMarkerController.clear() を、add / update と同じ permit(web は lock)の中で「onRemove(全部) → strategy.clear() → onPostProcess」の順にしました。strategy.clear() は残しているので、クラスタ状態のリセットなど Strategy 固有の後片付けはそのままです。
  • 最初のカメラを待って保留していたマーカーも捨てます。捨てないと、clear 後の最初のカメラで描かれてしまいます。
  • iOS は StrategyMarkerController が actor でないため、pendingStates は permit の中でだけ触っています。

公開 API の変更はありません。

検証

  • 単体テスト StrategyMarkerClearOrder(Android / iOS / web)を足しました。直す前に落ち、直した後に通ることを確かめています。core の全テストも通過しました(Android 310、iOS 349(シミュレータ)、web 235)。
  • 実機・ブラウザ(SDK 内に呼び出し元が無いので、検証用ページから直接呼びました):
    • web(maplibre / mapbox / mappls / tomtom / longdo): 直す前は clear 後もマーカーが残り、直した後は消えて、送り直すと戻ります。
    • Android 実機(TomTom / MapTiler)と iPad 実機(MapLibre、MarkerClusterGroup 経由): 直す前は残り、直した後は消えます。

確認できていないもの: Android MapLibre と web MapTiler の Strategy マーカーは、検証用ページの問題で直す前・後とも描かれず、確かめられていません。

なお、clearOverlays() が Strategy コントローラを clear するようにする変更は、別の PR(fix/clear-strategy)で出す予定です。

関連 PR(fix/clear-followups の一式)

それぞれ独立していて、マージの順番の制約はありません(web の変更は js-sdk-core の新しい版を必要としません)。

…lers

clear() only called strategy.clear(), which empties the manager. It
never called onRemove or onPostProcess, unlike AbstractMarkerController
and the five shape controllers. The GL renderers (MapLibre, Mapbox,
Mappls, MapTiler) leave the map alone in onRemove and redraw the
manager in onPostProcess, so markers drawn through a strategy stayed on
the map after clear().

clear() now runs onRemove(everything), strategy.clear() (so the
strategy's own reset, such as the cluster state, is kept), then
onPostProcess, inside the permit. The permit matters here: this class
is not an actor, and pendingStates (a class-holding field) may only be
touched while holding it. Markers queued before the first camera are
dropped as well; they would otherwise be drawn on the first camera
event after clear().

Nothing in the SDK calls this clear() today (clearOverlays() clears the
providers' own controllers; HERE's and ArcGIS's strategy controllers
are not included).

StrategyMarkerClearOrderTests fails on the old clear() and passes now.
Same test in android-sdk-core and js-sdk-core.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant