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:
@@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user