Skip to content

Conversation

@na9da
Copy link
Collaborator

@na9da na9da commented Oct 29, 2025

Split from #7626
Required for #6845
Merge after #7710

What this PR does

  • Adds trait preferredViewer to mappable mixin
  • Automatically switch to preferred viewer when changing base maps
  • Automatically switch base map to a compatible one when changing the viewer mode

Example base map config (full example):

"baseMaps": {
    "items": [
      {
        "item": {
          "id": "basemap-bing-aerial-with-labels",
          "preferredViewerMode": "2d"
        },
        "image": "build/TerriaJS/images/bing-aerial-labels.png"
      },
      {
        "item": {
          "id": "basemap-bing-aerial",
          "preferredViewerMode": "2d"
        },
        "image": "build/TerriaJS/images/bing-aerial.png"
      }
    ]
  }

Test me

  • Open this CI link with both aerial Bing maps configured to prefer 2d mode
  • Switch from OSM to any bing map
  • Observe that the viewer mode is switched to 2d and a toast notification is shown
  • Switch viewer mode to 3d, observe that the base map switches to OSM and a toast notification is shown

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

@na9da na9da changed the base branch from main to toast-notification October 29, 2025 04:38
Copy link
Collaborator Author

@na9da na9da Oct 29, 2025

Choose a reason for hiding this comment

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

Tracks the currently loading base map and sets it so that the last selected base map gets applied. Previously if the user selected multiple base maps then it would be applied in the order they were loaded instead of the order they were selected. This can be surprising to the user when some base maps are slow to load.

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