Skip to content

feat: draw POIs outside the old map on the background map - #146

Merged
kochizufan merged 7 commits into
train/2026-12from
dec26/m13-t1-outside-pois
Oct 28, 2026
Merged

kochizufan merged 7 commits into
train/2026-12from
dec26/m13-t1-outside-pois

Conversation

@kochizufan

@kochizufan kochizufan commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

概要

古地図の紙の外にある POI を、これまでのように捨てずに背面の地理の地図へ立てるようにしました。

  • 描く層: 前面が古地図で背面の地図があるとき、範囲外の POI は背面の marker 層にメルカトルの座標で描きます。前面が TMS・envelope を持つ基本地図のときは前面の marker 層に描きます。x・y(画素)で与えた POI と、背面の無い古地図(overlay 偽)では今までどおり描きません。見た目は範囲内と同じです。
  • ちらつかない入れ替え: redrawMarkers は全件の判定を先に済ませ、前面と背面の層を 1 つの同期の区間で入れ替えます(地図の切り替えの途中で片方だけ空になる時間がありません)。
  • 押せる条件: 前面で当たらず、押した点が紙の外のときだけ背面のピンを見ます。紙が覆っている点では透過度によらず押せません(clickMap になります)。clickMarker・clickMarkers の形は前面と同じです。
  • 選んでいる間: 範囲外の POI を selectMarker すると中心がそのピンへ寄り、outOfMap は出ません。選んでいる間は紙の内側への引き戻しと GPS による視点の移動を止めます。unselectMarker で紙のいちばん近い縁へ戻ります(外→外・外→内の選び直しでは縁を挟みません)。
  • 属性 hide-outside-pois(プロパティ hideOutsidePois・旧 appOption.hideOutsidePois。起動後も変更可)で止められます。
  • MaplatApp.prototype にメソッドを足していません(処理は src/outside_pois.ts)。spec/legacy-api-surface.spec.ts は変更なしで緑です。

確かめたこと

  • pnpm exec vitest run: 44 files / 666 passed / 1 skipped
  • pnpm run typecheck: 緑
  • node_modules/.bin/eslint src spec: 0 errors(既存の警告 2 件)
  • pnpm exec playwright test --config=playwright-ci.config.ts: 72 passed(新しい e2e/outside-pois.spec.ts の 10 件を含む。背面が MapLibre のときもピンが描かれ押せることを含む)
  • e2e/wc-element.playwright.config.ts: 3 passed(適合検査が新しい属性も回す)
  • デモ(?region=tatebayashi の節「範囲外の POI」)を実際のブラウザで操作し、背面のピン・選択と引き戻し・紙に覆われたピンが押せないことを目で確かめました

既存のテストの変更

  • spec/nov26-m4-t9-marker-redraw.spec.ts: 描き直しの形が変わったため観測点を替えました(テストの名前と件数 8 は同じ。直列化・最新の 1 件の保留・選択中を最後に描くことを測る)
  • spec/element.spec.ts: observedAttributes に hide-outside-pois
  • spec/element-real-core.spec.ts: 2 件を足しただけ

dist/ は train/2026-12 の先端に載せ直した後に pnpm run build で作り直し、最後の build: rebuild dist の commit に入れました。

🤖 Generated with Claude Code

kochizufan and others added 7 commits October 28, 2026 21:55
POIs whose position falls outside the front old map are now drawn on
the marker layer of the background map (or on the front layer when the
front map is mercator-based), instead of being dropped.

- Classification is done once per POI (classifyMarker) and both marker
  layers are replaced in one synchronous step, so neither layer is
  briefly empty while switching maps.
- Clicks fall through to background pins only where the old map does
  not cover the point.
- While an outside POI is selected the view centres on it and the
  pull-back to the map edge is suspended; unselecting pulls back to the
  nearest edge. GPS updates do not move the view during that time.
- New boolean attribute hide-outside-pois (property hideOutsidePois,
  legacy appOption.hideOutsidePois) turns the behaviour off.
- No new MaplatApp.prototype methods; the logic lives in a separate
  module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the map is switched while an outside POI is selected and the
converted centre lands inside the new map, the pending flag was never
set, so the outside-selection state stayed and kept suspending the
pull-back and GPS moves. The redraw now settles the selection whenever
the drawn selected POI is the one held as the outside selection,
regardless of the pending flag, and leaves it alone when the ids differ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Redraws unrelated to the selection (changing hide-outside-pois, adding a
marker, toggling layers) re-settled the outside selection and moved the
view back to the POI even after the user had panned away. A redraw now
recentres only while the selection is still waiting for its first
classification; otherwise it just updates the stored position, or drops
the outside state when the POI has become inside. Selecting a POI still
always centres on it, and switching maps marks the selection as pending
so the view follows the POI on the new map as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kochizufan
kochizufan force-pushed the dec26/m13-t1-outside-pois branch from d15b97c to 50bcc99 Compare October 28, 2026 13:01
@kochizufan
kochizufan marked this pull request as ready for review October 28, 2026 13:08
@kochizufan
kochizufan merged commit 1e14b6b into train/2026-12 Oct 28, 2026
5 checks passed
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