mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 11:36:05 +00:00
fix(map): keep places and routes on one world, and start new installs with Journey and Collections
A right-click, click or drag on a repeated world copy reported the longitude it has on that copy (274.9 for -85.1). The place was saved there, the geocoder found nothing, and a route to a place on the real world ran across the whole map (#2976). Longitudes are now brought back onto [-180, 180] where the map hands them out (Leaflet and GL), where they are stored (places, booking endpoints, collection places, so REST, MCP, plugin RPC and importers alike) and before reverse geocoding. A migration moves the ones already stored. Leaflet draws a layer at its literal longitude only, so a trip from Los Angeles to Auckland had its pins at opposite ends of the world while the flight ran off the edge to the next copy (#2975). A trip that crosses the antimeridian is now drawn in one longitude frame, seamed in the widest stretch it leaves empty, so pins, routes, flights and every overlay lie on one copy and the map opens across the Pacific. Every other trip has no frame and draws exactly as before. The GL day fit also takes the short way. A new install now starts with Journey and Collections switched on, next to the trip addons (all but Road trip), Atlas, Vacay and the Naver import that already were. Existing installs keep their addons as they are. Closes #2975 Closes #2976
This commit is contained in:
@@ -1185,9 +1185,14 @@ describe('MapView map event wiring', () => {
|
||||
it('FE-COMP-MAPVIEW-046: a map-click handler is attached and detached again', () => {
|
||||
const onMapClick = vi.fn()
|
||||
const { unmount } = render(<MapView onMapClick={onMapClick} />)
|
||||
expect(mapMock.on).toHaveBeenCalledWith('click', onMapClick)
|
||||
const bound = mapMock.on.mock.calls.find(c => c[0] === 'click')?.[1]
|
||||
expect(bound).toEqual(expect.any(Function))
|
||||
// A click on the real world reaches the caller as the very event the map fired.
|
||||
const event = { latlng: { lat: 48, lng: 2 } }
|
||||
bound(event)
|
||||
expect(onMapClick).toHaveBeenCalledWith(event)
|
||||
unmount()
|
||||
expect(mapMock.off).toHaveBeenCalledWith('click', onMapClick)
|
||||
expect(mapMock.off).toHaveBeenCalledWith('click', bound)
|
||||
})
|
||||
|
||||
it('FE-COMP-MAPVIEW-047: without a click handler nothing is bound', () => {
|
||||
@@ -1198,9 +1203,13 @@ describe('MapView map event wiring', () => {
|
||||
it('FE-COMP-MAPVIEW-048: a context-menu handler is attached and detached again', () => {
|
||||
const onMapContextMenu = vi.fn()
|
||||
const { unmount } = render(<MapView onMapContextMenu={onMapContextMenu} />)
|
||||
expect(mapMock.on).toHaveBeenCalledWith('contextmenu', onMapContextMenu)
|
||||
const bound = mapMock.on.mock.calls.find(c => c[0] === 'contextmenu')?.[1]
|
||||
expect(bound).toEqual(expect.any(Function))
|
||||
const event = { latlng: { lat: 48, lng: 2 } }
|
||||
bound(event)
|
||||
expect(onMapContextMenu).toHaveBeenCalledWith(event)
|
||||
unmount()
|
||||
expect(mapMock.off).toHaveBeenCalledWith('contextmenu', onMapContextMenu)
|
||||
expect(mapMock.off).toHaveBeenCalledWith('contextmenu', bound)
|
||||
})
|
||||
|
||||
it('FE-COMP-MAPVIEW-049: changing the center prop moves the camera there', () => {
|
||||
|
||||
Reference in New Issue
Block a user