Skip to content

Mapview resize without reinitializing a new renderer each time - #2491

Draft
Auriga2 wants to merge 1 commit into
masterfrom
mapview_resize
Draft

Mapview resize without reinitializing a new renderer each time#2491
Auriga2 wants to merge 1 commit into
masterfrom
mapview_resize

Conversation

@Auriga2

@Auriga2 Auriga2 commented Apr 24, 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

This works perfectly only on certain displays. It works on my monitor but not the laptop screen:

On the smaller screen it doesn't identify the entire space as available for the map, causing a bigger background. When resizing to a smaller size it doesn't clear, leaving parts of the previous map in the background. This could still happen in the Alternate Design but less likely.

Sometimes this can cause issues when moving constellation window between displays with different resolutions. This can move the map to appear displaced and floating when the constellation window is floating. It fixes when the constellation window is docked.

This appears to be a limitations with AWT/Swing using floating top‑level native windows that can move between monitors with different DPI/scale, and JOGL/NEWT embedding a native OpenGL child window (GLWindow) via native reparenting (NewtCanvasAWT).

Probably we could implement this or similar after #1746

Alternate Designs

#2490

Why Should This Be In Core?

Benefits

Better performance when resizing.

Possible Drawbacks

Verification Process

Same as in #2490

Applicable Issues

#2376
#618

@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

@OrionsGuardian OrionsGuardian left a comment

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.

Image

@Auriga2

Auriga2 commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @OrionsGuardian, setting the laptop display Scale to 100% fixed most of the issues I listed, (except the occasional scenario you noted above.) Is it still acceptable given the recommended scale for this display is 125%?

The above issue can easily be fixed with a zoom in/out or a window maximizing/minimizing. It happens if you move the vertical divider very fast.

@OrionsGuardian OrionsGuardian left a comment

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.

Please also address the sonar code smells.

@Override
public void draw() {
assert !SwingUtilities.isEventDispatchThread();
float currentZoom = map.getZoomLevel();

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.

final

}
return null;
}, 500, TimeUnit.MILLISECONDS);
public void componentResized(ComponentEvent e) {

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.

final

private final List<? extends MapExporter> exporters;
private final MarkerState markerState;
private int cachedWidth;
private int cachedHeight;

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.

cachedWidth and cachedHeight don't appear to be used anywhere.
They have values assigned to them, but never used.

@Delphinus8821

Copy link
Copy Markdown
Collaborator
MapViewResizing

Giving this a test, found that when you zoom out on the default map it expands the map over the menu bar

@antares1470 antares1470 left a comment

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.

Can confirm on a laptop screen that the map doesn't scale. Also came across a bug where if I open the map view, switch to another view in the same place, and then go back to the map view, it still renders a portion of the previous view in the gaps where the map isn't rendering.

Image

Edit: I'm actually getting the same issue on master so it might not be specific to this change

@Auriga2

Auriga2 commented May 6, 2026

Copy link
Copy Markdown
Collaborator Author

It's the same root cause on the smaller screen (screen with a different scale) where it doesn't identify the entire space as available for the map, causing a bigger background. When resizing to a smaller size it doesn't clear, leaving parts of the previous map/view in the background. This could still happen in the Alternate Design, but less often. The easy workaround is to zoom in/out or a window maximizing/minimizing.

I can fix the issue that Delphinus8821 noted above.

@Auriga2
Auriga2 marked this pull request as draft May 13, 2026 00:43
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