fix: fix resize and dragging

- AbstractShape: make bounds protected for subclass access
- STriangle: refactor resize logic
- SCircle: refactor resize logic (preserves equal dimensions)
- SText: add reasonable default bounds for hit testing
This commit is contained in:
2026-03-26 23:54:31 +01:00
parent fbe3714182
commit 3a6f98455a
4 changed files with 47 additions and 50 deletions

View File

@@ -18,7 +18,8 @@ public class SText extends AbstractShape {
private final int fontStyle;
private SText(int x, int y, String text, int fontSize, String fontName, int fontStyle) {
super(new Rectangle(x, y, 0, 0));
// Initialize with a reasonable default width/height so hit testing works reliably
super(new Rectangle(x, y, 100, 20));
this.text = normalizeText(text);
this.fontSize = fontSize;
this.fontName = fontName;