Skip to content

Commit 62412f8

Browse files
committed
test and fix scale
1 parent db20a22 commit 62412f8

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/main/java/com/cleanroommc/modularui/factory/HoloGuiManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public static <T extends GuiData> void open(@NotNull UIFactory<T> factory, @NotN
5151
WidgetTree.collectSyncValues(syncManager, panel);
5252
ModularContainer container = new ModularContainer(syncManager);
5353
HoloUI.builder()
54+
.screenScale(0.5f)
5455
.inFrontOf(player, 5, true)
5556
.open(screen -> {
5657
screen.setContainer(container);
@@ -87,6 +88,7 @@ public static <T extends GuiData> void open(int windowId, @NotNull UIFactory<T>
8788
HoloUI.builder()
8889
// .screenScale(0.25f)
8990
.inFrontOf(player, 5, true)
91+
.screenScale(0.5f)
9092
.open(screen1 -> {
9193
screen1.setPanel(panel);
9294
screen1.setWrapper(guiScreenWrapper);

src/main/java/com/cleanroommc/modularui/holoui/ScreenEntityRender.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ private static Vec3i calculateMousePos(Vec3d player, HoloScreenEntity screen, Ve
119119
// the x, y of look rot should be the mouse pos if scaled by looRot z
120120
// the scale factor should be the distance from the player to the plane by the z component of lookRot
121121
double sf = diff.z / lookRot.z;
122-
double mX = ((lookRot.x * sf) - diff.x) * 16;
123-
double mY = ((lookRot.y * sf) - diff.y) * 16;
122+
double mX = ((lookRot.x * sf) - diff.x) * 16 / plane.getScale();
123+
double mY = ((lookRot.y * sf) - diff.y) * 16 / plane.getScale();
124124
mY += plane.getHeight() / 2;
125125
mX += plane.getWidth() / 2;
126126

0 commit comments

Comments
 (0)