From e91f820322e92bf76682d893deed21d35a025ccc Mon Sep 17 00:00:00 2001 From: James Lyne Date: Fri, 4 Feb 2022 21:58:07 +0000 Subject: [PATCH] Improve handing of append_to_world - Always use the store map list for checking for/retrieving maps, to avoid the non-unique map name problem append_to_world otherwise causes - Change LiveAtlasWorldDefinition maps property to Set as map keys were not unique if appended maps with the same names existed - Add appended map to both original and appended world's map set. The appended world needs this to display the map in the UI, the original world needs this to avoid situations where LiveAtlas needs the "first" map of a world, and that world has 0 non-appended maps (i.e switching worlds when following, URL without a map name) - Add an appendedWorld property to maps to indicate when a map has been appended. This is used by MapContextMenu to show the appended world's map list instead, and in WorldListItem to filter out maps appended to other worlds - Use the map's world property instead of the world prop in the template for WorldListItem. This fixes tooltips and prevents duplicate IDs. Fixes #345 --- src/components/Map.vue | 5 ++-- src/components/list/WorldListItem.vue | 33 ++++++++++++++++++++------- src/components/map/MapContextMenu.vue | 15 ++++++++---- src/index.d.ts | 2 +- src/model/LiveAtlasMapDefinition.ts | 5 +++- src/providers/Pl3xmapMapProvider.ts | 4 ++-- src/store/actions.ts | 9 ++++---- src/store/mutations.ts | 2 +- src/util/dynmap.ts | 17 ++++++++++---- 9 files changed, 63 insertions(+), 29 deletions(-) diff --git a/src/components/Map.vue b/src/components/Map.vue index 40ea22e..41488be 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -296,9 +296,8 @@ export default defineComponent({ } if(targetWorld && (targetWorld !== currentWorld) || (target.map && currentMap !== target.map)) { - const mapName = target.map && targetWorld!.maps.has(target.map) ? - targetWorld!.maps.get(target.map)!.name : - targetWorld!.maps.entries().next().value[1].name; + const map = store.state.maps.get(`${targetWorld.name}_${target.map}`), + mapName = map ? map.name : targetWorld.maps.values().next().value.name; this.scheduledView = target; diff --git a/src/components/list/WorldListItem.vue b/src/components/list/WorldListItem.vue index 8d5dcc4..3c9dc0d 100644 --- a/src/components/list/WorldListItem.vue +++ b/src/components/list/WorldListItem.vue @@ -15,14 +15,16 @@ -->