Store overlay bounds for overlays at LEFT and RIGHT OverlayPositions
This commit is contained in:
@@ -27,11 +27,13 @@ package net.runelite.client.ui.overlay;
|
|||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
public abstract class Overlay
|
public abstract class Overlay
|
||||||
{
|
{
|
||||||
private OverlayPosition position; // where to draw it
|
private OverlayPosition position; // where to draw it
|
||||||
private OverlayPriority priority; // if multiple overlays exist in the same position, who wins
|
private OverlayPriority priority; // if multiple overlays exist in the same position, who wins
|
||||||
|
private Rectangle bounds; //screen bounds of overlay after OverlayRenderer decides location
|
||||||
|
|
||||||
public Overlay(OverlayPosition position)
|
public Overlay(OverlayPosition position)
|
||||||
{
|
{
|
||||||
@@ -65,4 +67,14 @@ public abstract class Overlay
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract Dimension render(Graphics2D graphics);
|
public abstract Dimension render(Graphics2D graphics);
|
||||||
|
|
||||||
|
public Rectangle getBounds()
|
||||||
|
{
|
||||||
|
return bounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void storeBounds(Rectangle bounds)
|
||||||
|
{
|
||||||
|
this.bounds = bounds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.runelite.client.ui.overlay;
|
package net.runelite.client.ui.overlay;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -61,6 +61,9 @@ public class TopDownRendererLeft implements Renderer
|
|||||||
if (dimension == null)
|
if (dimension == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Rectangle bounds = new Rectangle(BORDER_LEFT, y, (int) dimension.getWidth(), (int) dimension.getHeight());
|
||||||
|
overlay.storeBounds(bounds);
|
||||||
|
|
||||||
y += dimension.getHeight() + PADDING;
|
y += dimension.getHeight() + PADDING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ package net.runelite.client.ui.overlay;
|
|||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -74,6 +75,9 @@ public class TopDownRendererRight implements Renderer
|
|||||||
graphics.drawImage(image, clientWidth - BORDER_RIGHT - (int) dimension.getWidth(), y, null);
|
graphics.drawImage(image, clientWidth - BORDER_RIGHT - (int) dimension.getWidth(), y, null);
|
||||||
graphics.dispose();
|
graphics.dispose();
|
||||||
|
|
||||||
|
Rectangle bounds = new Rectangle(clientWidth - BORDER_RIGHT - (int) dimension.getWidth(), y, (int) dimension.getWidth(), (int) dimension.getHeight());
|
||||||
|
overlay.storeBounds(bounds);
|
||||||
|
|
||||||
y += dimension.getHeight() + PADDING;
|
y += dimension.getHeight() + PADDING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user