[DEV] some updates

This commit is contained in:
Edouard DUPIN 2025-08-10 00:50:06 +02:00
parent 565c436b6d
commit 40484df7ff
3 changed files with 126 additions and 96 deletions

View File

@ -68,6 +68,11 @@ public record DimensionBorderRadius(
this(new BorderRadius(size, size, size, size), Distance.PIXEL); this(new BorderRadius(size, size, size, size), Distance.PIXEL);
} }
public DimensionBorderRadius(final float topLeft, final float topRight, final float bottomRight,
final float bottomLeft) {
this(new BorderRadius(topLeft, topRight, bottomRight, bottomLeft), Distance.PIXEL);
}
public DimensionBorderRadius(final BorderRadius size) { public DimensionBorderRadius(final BorderRadius size) {
this(size, Distance.PIXEL); this(size, Distance.PIXEL);
} }

View File

@ -65,6 +65,18 @@ public record DimensionInsets(
this(new Insets(size, size, size, size), Distance.PIXEL); this(new Insets(size, size, size, size), Distance.PIXEL);
} }
/**
* Constructor
* @param size Requested dimension
*/
public DimensionInsets(final float top, final float right, final float bottom, final float left) {
this(new Insets(top, right, bottom, left), Distance.PIXEL);
}
public DimensionInsets(final float yyy, final float xxx) {
this(new Insets(yyy, xxx, yyy, xxx), Distance.PIXEL);
}
public DimensionInsets(final Insets size) { public DimensionInsets(final Insets size) {
this(size, Distance.PIXEL); this(size, Distance.PIXEL);
} }

View File

@ -19,6 +19,14 @@ public record Insets(
return new Vector2f(this.left + this.right, this.top + this.bottom); return new Vector2f(this.left + this.right, this.top + this.bottom);
} }
public Vector2f getOrigin() {
return new Vector2f(this.left, this.bottom);
}
public Vector2f getEnd() {
return new Vector2f(this.right, this.top);
}
public static Insets valueOf(String value) { public static Insets valueOf(String value) {
float val1 = 0; float val1 = 0;
float val2 = 0; float val2 = 0;
@ -430,4 +438,9 @@ public record Insets(
final float val4 = Float.valueOf(valuesW); final float val4 = Float.valueOf(valuesW);
return new Insets(val1, val2, val3, val4); return new Insets(val1, val2, val3, val4);
} }
@CheckReturnValue
public boolean isZero() {
return this.top == 0.0f && this.right == 0.0f && this.bottom == 0.0f && this.left == 0.0f;
}
} }