1
mirror of https://github.com/Shiewk/Widgets.git synced 2026-04-28 11:34:17 +02:00

Add helpful context menus (right click) to the position editing screen

- Right click on widget: Opening widget settings, setting anchor or deactivating the widget
- Right click on empty space: Enabling widgets
This commit is contained in:
Shy
2025-11-24 11:41:08 +01:00
parent 2c51b05b22
commit df5b83a3f7
8 changed files with 304 additions and 22 deletions
@@ -59,4 +59,20 @@ public abstract class ModWidget {
settings.offsetX += dx;
settings.offsetY += dy;
}
public void setPos(Anchor anchor, int offsetX, int offsetY){
getSettings().setPos(anchor, offsetX, offsetY);
}
public void setAbsolutePos(int x, int y, int scaledWindowWidth, int scaledWindowHeight) {
Anchor anchor = Anchor.getAnchor(scaledWindowWidth, scaledWindowHeight, x, y);
if (anchor == null) {
throw new IllegalArgumentException("Provided coordinates have no corresponding anchor");
}
settings.setPos(
anchor,
x - anchor.getAlignStartPosX(scaledWindowWidth),
y - anchor.getAlignStartPosY(scaledWindowHeight)
);
}
}