Anchors don't work at greater GUI Scales
Estecka opened this issue ยท 5 comments
Probably related to #105
The minimap anchor points only work properly when the vanilla GUI scale is set to 1. At any other GUI scale, the effective anchor point ends up being located farther outside of the screen, varying greatly depending on the GUI scale and the screen resolution.
I believe the faulty code is here. The correct version would look something like this:
double guiScale = MinecraftClient.getInstance().getWindow().getScaleFactor()
int x = anchorLocation.isLeft ? 0 : (int) (screenWidth / (globalScale*guiScale) ) - BG_SIZE;
int y = anchorLocation.isUp ? 0 : (int) (screenHeight / (globalScale*guiscale) ) - BG_SIZE;
I would have made a PR for this, but I was unable to test this code due to being unable to build the project.
Repro:
- Launch minecraft in windowed mod; do not change the default window's size. This should give you a vertical resolution of 480px.
- Use the following settings:
- Vanilla GUI Scale: 2
- Minimap Anchor: Lower Left
- Minimap offset: X:0 Y:-240
- Minimap Scale: 1 - Load a world and bring up the minimap. It should be located precisely into the bottom left corner of the screen.
- Open chat (to free the mouse cursor without obscuring the screen), grab the bottom of the window, and gradually increase the vertical resolution: The minimap will gradually slide off-screen through the bottom edge.
Versions:
- Minecraft 1.20.1
- Fabric Loader 0.15.7
- Fabric API 0.92.0+1.20.1
- Map Atlases 1.20-6.0.3
- Moonlight lib 1.20-2.11.9
- Cardinal Components API 5.2.2
- Mod Menu 7.2.2
- Cloth config 11.1.118
thank you for looking into this. i was aware but it being a non curcial tiny issue never looked much into it since people could just use the other configs to tweak the attachment accordingly. Ill see if that code fixes
so weirdly this is only needed on fabric version. even tho they use the same exact code and im not sure why