diff --git a/modules/hud/api/hud.api b/modules/hud/api/hud.api index 3158c0268..d95cbab45 100644 --- a/modules/hud/api/hud.api +++ b/modules/hud/api/hud.api @@ -82,6 +82,8 @@ public abstract class org/polyfrost/oneconfig/api/hud/v1/Hud : org/polyfrost/one public final fun getPadLeft ()F public final fun getPadRight ()F public final fun getPadTop ()F + public final fun getPivotFractionX ()F + public final fun getPivotFractionY ()F public final fun getPoppinsFontName ()Ljava/lang/String; public final fun getPosSchema ()I public fun getRelativeX ()F diff --git a/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/Hud.kt b/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/Hud.kt index 22317d628..b1bdeba60 100644 --- a/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/Hud.kt +++ b/modules/hud/src/main/kotlin/org/polyfrost/oneconfig/api/hud/v1/Hud.kt @@ -728,6 +728,26 @@ abstract class Hud(id: String, title: String, val category: Category) : Cloneabl ?: selfAnchorPoint.takeUnless { it == HudAnchor.Auto } ?: effectiveGrowthAnchor } + /** + * How far across this HUD's box the point that holds still while it resizes horizontally sits + * + * 0 is the left edge and 1 the right + * + * A merge can hold each axis against a different neighbour so this can disagree with + * [effectiveSelfAnchorPoint] + */ + val pivotFractionX: Float get() = pinnedFracX(resolvedAnchorX?.selfPoint ?: growthAnchor) + + /** + * How far down this HUD's box the point that holds still while it resizes vertically sits + * + * 0 is the top edge and 1 the bottom + * + * A merge can hold each axis against a different neighbour so this can disagree with + * [effectiveSelfAnchorPoint] + */ + val pivotFractionY: Float get() = pinnedFracY(resolvedAnchorY?.selfPoint ?: growthAnchor) + /** Moves this HUD's own anchor point to [point] without moving the HUD on screen */ fun setSelfAnchorPointKeepingPosition(point: HudAnchor) { val absX = rawX