widget overlay: use setForcedPosition

The inventory can be moved pre-interface tick by the tli subchange
listener, as well as post-our client tick event from script events
running.

This makes it difficult to correctly and generically move the interface,
since it would have to be moved pre-interface tick and also pre-frame.

Currently the code moves the interface pre-frame, which looks okay, but
since it is ticking the interface when it is a different position,
clicks on it do not work correctly.

We do not have events for pre-interface tick, so use forced position to
reliably set the position
This commit is contained in:
Adam
2022-05-19 09:52:43 -04:00
parent cbf00f6c41
commit 004d321c15

View File

@@ -136,8 +136,7 @@ public class WidgetOverlay extends Overlay
if (getPreferredLocation() != null || getPreferredPosition() != null) if (getPreferredLocation() != null || getPreferredPosition() != null)
{ {
// The widget relative pos is relative to the parent // The widget relative pos is relative to the parent
widget.setRelativeX(bounds.x - parent.x); widget.setForcedPosition(bounds.x - parent.x, bounds.y - parent.y);
widget.setRelativeY(bounds.y - parent.y);
} }
else else
{ {
@@ -145,6 +144,7 @@ public class WidgetOverlay extends Overlay
{ {
revalidate = false; revalidate = false;
log.debug("Revalidating {}", widgetInfo); log.debug("Revalidating {}", widgetInfo);
widget.setForcedPosition(-1, -1);
// Revalidate the widget to reposition it back to its normal location after an overlay reset // Revalidate the widget to reposition it back to its normal location after an overlay reset
widget.revalidate(); widget.revalidate();
} }