Skip to content

Conversation

@Michelleeby
Copy link

Hello! I really love this map, thanks so much for sharing!

This PR adds the coordinate search feature, described in #4. The search event follows this flow: CoordinateDropdown → MenuButtons → Sidebar → App → MainMap

New Files

src/stores/useCoordinateStore.ts - Pinia store for coordinate state management.
src/components/dropdown/CoordinateDropdown.vue - UI component for coordinate input. It extends the base Dropdown component.

Modified Files

src/components/MenuButtons.vue - Added coordinate search button.
src/components/Sidebar.vue - Added event passing for navigation.
src/App.vue - Connected navigation events to map component.
src/components/MainMap.vue - Added navigation and current location methods.
locales/en.json - Added translations for the feature.

Usage

The coordinate search button opens the dropdown to input X and Z coordinates:

mc-datapack-map-coordinate-search.mp4

The "Use Current View" will add the maps center point as the X and Z coordinates:

mc-datapack-map-coordinate-search-go-to-current.mp4

The "Go To Coordinate" will center the map around the given X and Z coordinates:

mc-datapack-map-coordinate-search-go-to-coordinates.mp4

Thanks 🙏🏻

This commit adds the coordinate search feature, described in this issue jacobsjo#4. The search event follows this flow: `CoordinateDropdown → MenuButtons → Sidebar → App → MainMap`

New Files:
`src/stores/useCoordinateStore.ts` - Pinia store for coordinate state management
`src/components/dropdown/CoordinateDropdown.vue` - UI component for coordinate input

Modified Files:
`src/components/MenuButtons.vue` - Added coordinate search button
`src/components/Sidebar.vue` - Added event passing for navigation
`src/App.vue` - Connected navigation events to map component
`src/components/MainMap.vue` - Added navigation and current location methods
`locales/en.json` - Added translations for the feature
@jacobsjo
Copy link
Owner

Thank you for your contribution, but this needs more work. Both from a design perspective as well as internally.

Design:

  • With developer mode enabled and biome search, there are now too many menu buttons, so they get cut off
image
  • x and z should be next to each other
  • Whats the point of the "Use current view" button? When would you need to use it?

Internal:

  • Emitting the navigation all the way out to the App is very ugly and hard to maintain.
  • Using the getCurrentMapCenter event to instruct the map to store its center in the store is even uglier.

I'm unsure what the best architecture is here, but maybe a good approach would be to use a store for both ways of communication: Have the map always store the center in the store, and have the menu change the store.

@Michelleeby
Copy link
Author

I agree that the internal architecture could use work. I'm not a designer. This is something I threw together in a few minutes to get the feature working for myself.

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.

2 participants