overlayrenderer: Make minimum overlay size configurable per-overlay (#12611)

Halve the minimum for Screen Marker Overlay to "fix" #12267 (set to 16).
Any smaller than 16 makes subsequent resizes impossible because the
cursor type never changes from center (move mode).
This commit is contained in:
Jacob Mischka
2020-10-23 12:28:59 -05:00
committed by GitHub
parent da6cb1bc65
commit 46e9e93050
3 changed files with 7 additions and 5 deletions

View File

@@ -49,6 +49,7 @@ public class ScreenMarkerOverlay extends Overlay
setLayer(OverlayLayer.ALWAYS_ON_TOP); setLayer(OverlayLayer.ALWAYS_ON_TOP);
setPriority(OverlayPriority.HIGH); setPriority(OverlayPriority.HIGH);
setResizable(true); setResizable(true);
setMinimumSize(16);
setResettable(false); setResettable(false);
} }

View File

@@ -51,6 +51,7 @@ public abstract class Overlay implements LayoutableRenderableEntity
private OverlayLayer layer = OverlayLayer.UNDER_WIDGETS; private OverlayLayer layer = OverlayLayer.UNDER_WIDGETS;
private final List<OverlayMenuEntry> menuEntries = new ArrayList<>(); private final List<OverlayMenuEntry> menuEntries = new ArrayList<>();
private boolean resizable; private boolean resizable;
private int minimumSize = 32;
private boolean resettable = true; private boolean resettable = true;
/** /**

View File

@@ -70,7 +70,6 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
private static final int BORDER = 5; private static final int BORDER = 5;
private static final int BORDER_TOP = BORDER + 15; private static final int BORDER_TOP = BORDER + 15;
private static final int PADDING = 2; private static final int PADDING = 2;
private static final int MIN_OVERLAY_SIZE = 32;
private static final int OVERLAY_RESIZE_TOLERANCE = 5; private static final int OVERLAY_RESIZE_TOLERANCE = 5;
private static final Dimension SNAP_CORNER_SIZE = new Dimension(80, 80); private static final Dimension SNAP_CORNER_SIZE = new Dimension(80, 80);
private static final Color SNAP_CORNER_COLOR = new Color(0, 255, 255, 50); private static final Color SNAP_CORNER_COLOR = new Color(0, 255, 255, 50);
@@ -536,8 +535,9 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
// center // center
} }
final int widthOverflow = Math.max(0, MIN_OVERLAY_SIZE - width); final int minOverlaySize = currentManagedOverlay.getMinimumSize();
final int heightOverflow = Math.max(0, MIN_OVERLAY_SIZE - height); final int widthOverflow = Math.max(0, minOverlaySize - width);
final int heightOverflow = Math.max(0, minOverlaySize - height);
final int dx = x - originalX; final int dx = x - originalX;
final int dy = y - originalY; final int dy = y - originalY;
@@ -545,7 +545,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
// dimensions and adjust the x/y position accordingly as needed // dimensions and adjust the x/y position accordingly as needed
if (widthOverflow > 0) if (widthOverflow > 0)
{ {
width = MIN_OVERLAY_SIZE; width = minOverlaySize;
if (dx > 0) if (dx > 0)
{ {
@@ -554,7 +554,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
} }
if (heightOverflow > 0) if (heightOverflow > 0)
{ {
height = MIN_OVERLAY_SIZE; height = minOverlaySize;
if (dy > 0) if (dy > 0)
{ {