Map Atlases [Fabric]

Map Atlases [Fabric]

178k Downloads

Anchors don't work at greater GUI Scales

Estecka opened this issue ยท 5 comments

commented

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:

  1. Launch minecraft in windowed mod; do not change the default window's size. This should give you a vertical resolution of 480px.
  2. Use the following settings:
      - Vanilla GUI Scale: 2
      - Minimap Anchor: Lower Left
      - Minimap offset: X:0 Y:-240
      - Minimap Scale: 1
  3. Load a world and bring up the minimap. It should be located precisely into the bottom left corner of the screen.
  4. 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
commented

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

commented

image
this was actual fix. they were using getGuiWidth() instead

commented

so weirdly this is only needed on fabric version. even tho they use the same exact code and im not sure why

commented

Just realized you use Mojmap. The snippet I gave uses Yarn mappings.

commented

Confirmed that fix is working. This is its equivalent in mojmap.

double guiScale = Minecraft.getInstance().getWindow().getGuiScale();