Skip to content

Map view save zoom, location and provider state - #2490

Merged
antares1470 merged 3 commits into
masterfrom
bugfix/mapview_save_state
May 18, 2026
Merged

Map view save zoom, location and provider state#2490
antares1470 merged 3 commits into
masterfrom
bugfix/mapview_save_state

Conversation

@Auriga2

@Auriga2 Auriga2 commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

Prerequisites

  • Reviewed the checklist

  • Reviewed feedback from the "Sonar Cloud" bot. Note that you have to wait
    for the "CI / Unit Tests") to complete first. Failed Unit tests can be
    debugged by adding the label "verbose logging" to the GitHub PR.

Description of the Change

Map view no longer resets to the default map, default location and default zoom level (4) when the window or pane is resized. This fix disposes the renderer and rebuilds it for each resize.

The Alternate Design eliminates that but it can have issues when moving constellation window between displays with different resolutions, and when reducing the size of the map on certain displays.

Alternate Designs

#2491

Why Should This Be In Core?

User doesn't have to reselect the map from the drop down again and manually zoom to the required location after resizing.

Benefits

Better UX

Possible Drawbacks

Performance limitations if resizing frequently.

Verification Process

  1. Open Map view and switch to another map from the map that opened by default (Not necessarily the default map). Zoom in or out to any level except 4, in a different location.
  2. Resize the Map view pane or the constellation window and notice that it no longer resets to the map that opened by default.
  3. Verify the same behavior after you zoom in/out to a different location in the map that opens by default as well.

Applicable Issues

#2376
#618

this.defaultProvider = defaultProvider;
}

public void update(MapProvider provider, Location center, int zoomLevel) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The function parameters can be final

private int zoomLevel = -1;
private boolean valid = false;

public MapViewState(MapProvider defaultProvider) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The function parameter can be final

@antares1470 antares1470 added bug Something isn't working and removed bug Something isn't working labels May 4, 2026
@OrionsGuardian

Copy link
Copy Markdown
Collaborator

Comparing the functionality between this PR and the other PR for the Map View reset issue, I prefer this version, even if it does rebuild the view more often. The end result is cleaner and consistent, and doesn't have the same side-effect issues that are occurring in the other PR.

@Auriga2

Auriga2 commented May 11, 2026

Copy link
Copy Markdown
Collaborator Author

I agree too. Probably we could implement the other option or similar, after #1746

@antares1470

Copy link
Copy Markdown
Collaborator

Comparing the functionality between this PR and the other PR for the Map View reset issue, I prefer this version, even if it does rebuild the view more often. The end result is cleaner and consistent, and doesn't have the same side-effect issues that are occurring in the other PR.

I agree. My only concern will be if the performance hit becomes significant enough to impact usability of the application. From testing I didn't experience that, but its probably something to note (e.g. does a significant number of markers on the map cause notable issues with redrawing every time)

@Auriga2

Auriga2 commented May 11, 2026

Copy link
Copy Markdown
Collaborator Author

I agree. My only concern will be if the performance hit becomes significant enough to impact usability of the application. From testing I didn't experience that, but its probably something to note (e.g. does a significant number of markers on the map cause notable issues with redrawing every time)

In terms of performance, this is same as v3.3 which disposes the renderer and rebuilds it with the default map for each resize. So hopefully there won't be issues.

@Auriga2
Auriga2 requested a review from Quasar985 May 11, 2026 08:23
@Auriga2
Auriga2 marked this pull request as ready for review May 13, 2026 00:43
}

public Location getCenterOrDefault() {
return center != null ? center : DEFAULT_LOCATION;

@antares1470 antares1470 May 14, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are there situations where we're ok with provider or center being null, or zoomLevel not being at least 0?

I note there are the regular getters above this but I'm thinking that if the answer to the above is no (i.e. there aren't any situations where we want that), then perhaps we should applying those logic checks at the point of setting the values (in the update function) rather than at the get stage. Means you could also set those fields to the defaults in the constructor (which in turn ensures you avoid any errors from calling getters before update is called, and potentially means you don't require the valid boolean).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense. Fixed now.

@Auriga2
Auriga2 requested a review from antares1470 May 15, 2026 07:03
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@antares1470
antares1470 merged commit 83a5273 into master May 18, 2026
2 of 3 checks passed
@antares1470
antares1470 deleted the bugfix/mapview_save_state branch May 18, 2026 00:40
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.

4 participants