Skip to content

feat: navigation tools#8

Open
mortalreminderpt wants to merge 4 commits into
Maa-NTE:mainfrom
mortalreminderpt:pr/navigation-tools
Open

feat: navigation tools#8
mortalreminderpt wants to merge 4 commits into
Maa-NTE:mainfrom
mortalreminderpt:pr/navigation-tools

Conversation

@mortalreminderpt

@mortalreminderpt mortalreminderpt commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds two navigation-oriented features to the map:

  1. Auto mark visible locations as completed based on realtime position
  2. Auto route planning from the current player position

Changes

  • add realtime-position based completion flow
  • support configurable completion radius
  • update marker visibility behavior around the completion radius
  • add automatic route planning from current position
  • plan routes from currently visible and unfinished locations only
  • use nearest-neighbor plus local optimization for a fast approximate shortest path
  • save generated routes into the existing route panel and route data structure

Notes

  • route planning starts from the current realtime navigation position
  • no new dependency is introduced

Summary by Sourcery

Add realtime navigation-based auto completion of nearby locations and automatic route planning from the current position.

New Features:

  • Track realtime world position from navigation data to drive map interactions.
  • Automatically mark locations as completed when the player exits a configurable radius around them.
  • Visually indicate the auto-completion radius around the navigation marker.
  • Provide automatic route planning from the current position over currently visible, unfinished locations.
  • Expose UI controls to configure auto-completion radius and auto-planned route size in the app.

Enhancements:

  • Restrict route auto-planning to valid, unfinished locations and store generated routes in the existing route data model.
  • Persist new navigation auto-completion settings alongside existing marker filter preferences.

Build:

  • Add a lockfile for the Bun-based toolchain.

Documentation:

  • Document the realtime auto-completion workflow and configuration in the README.

@sourcery-ai

sourcery-ai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds navigation-based auto completion of locations and an automatic route planner starting from the current realtime position, wiring both into existing filters, navigation rendering, and route editor UI.

Sequence diagram for navigation-based auto completion flow

sequenceDiagram
  actor Player
  participant NavigationSocket
  participant useMapApp
  participant LeafletMap

  Player->>NavigationSocket: send realtime position
  NavigationSocket-->>useMapApp: navigationState.position
  useMapApp->>useMapApp: renderNavigationArrow
  useMapApp->>useMapApp: mapPixelToMapLatLng
  useMapApp->>useMapApp: mapLatLngToWorld
  useMapApp->>LeafletMap: renderAutoCompleteRadiusCircle
  useMapApp->>useMapApp: updateAutoCompleteNearbyLocations
  alt [nearby incomplete locations]
    useMapApp->>useMapApp: completedIds update
    useMapApp->>useMapApp: localStorage.setItem COMPLETED_STORAGE_KEY
    useMapApp->>useMapApp: renderMarkers
  end
  useMapApp-->>Player: showStatus 自动完成提示
Loading

Flow diagram for automatic route planning from current position

flowchart TD
  U[Player clicks 自动规划] --> A(createAutoRoute)
  A --> B{navigationWorldPosition exists?}
  B -- No --> S1[showStatus 请先开启实时定位]
  B -- Yes --> C[autoRouteLimit = normalizeAutoRouteLimit]
  C --> D[getAutoRouteCandidates]
  D --> E{candidates.length > 0?}
  E -- No --> S2[showStatus 无可规划点位]
  E -- Yes --> F[buildNearestNeighborRoute]
  F --> G[optimizeRouteWithTwoOpt]
  G --> H[create route object with segments]
  H --> I[cancelSegment]
  I --> J[mapData.routes.push]
  J --> K[activeRouteId = route.id]
  K --> L[routePanelOpen = true]
  L --> M[persistMapData]
  M --> N[renderRouteArrows]
  N --> S3[showStatus 已规划 N 个点位]
Loading

File-Level Changes

Change Details Files
Introduce configurable navigation auto-complete radius tied to realtime navigation position and marker filtering/visuals.
  • Add navigation auto-complete radius constants and normalization helper to clamp user input into valid range.
  • Track navigation world position and auto-complete enable/radius state in map composable, persisting them in marker filter storage.
  • Render/destroy a Leaflet circle around the navigation marker to visualize the auto-complete radius and update it on navigation changes.
  • Extend filteredLocations logic so completed points within the auto-complete radius can become visible (semi-transparent) while others remain hidden.
src/constants/mapApp.js
src/composables/useMapApp.js
src/App.vue
src/styles.css
README.md
Automatically mark locations as completed when leaving the configured auto-complete radius.
  • Maintain a set of location ids currently inside the auto-complete radius, synced with filteredLocations and completion state.
  • On navigation position updates, recompute nearby incomplete locations, track entries/exits, and mark locations as completed when the player leaves the radius.
  • Persist updated completion ids to localStorage and re-render markers, with status messages summarizing auto-completion results.
  • Reset auto-complete state when navigation stops, when the feature is toggled off, or on component unmount.
src/composables/useMapApp.js
src/constants/mapApp.js
src/App.vue
README.md
Add automatic route planning from the current realtime position into the existing routes/segments data model and UI.
  • Compute auto-route candidates from currently filtered, unfinished locations with valid coordinates, and expose canCreateAutoRoute and autoRouteLimit.
  • Implement nearest-neighbor route construction from current navigation world position with a configurable point limit, plus a 2-opt local optimizer.
  • Create a new route object with a single segment starting at the current position, including references back to location ids, and persist it alongside existing routes.
  • Add UI controls to set the auto-route limit, trigger auto route creation, and display the number of candidate points, with disabled state when prerequisites are not met.
src/composables/useMapApp.js
src/App.vue
src/styles.css
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Watanabehato Watanabehato changed the title Pr/navigation tools fear: navigation tools Jun 9, 2026
@mortalreminderpt mortalreminderpt changed the title fear: navigation tools feat: navigation tools Jun 10, 2026
# Conflicts:
#	src/App.vue
#	src/composables/useMapApp.js
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