-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for different padding on all 4 sides
- Loading branch information
Showing
11 changed files
with
109 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 10 additions & 2 deletions
12
src/main/kotlin/com/neptuneclient/voidui/ui/elements/Text.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/kotlin/com/neptuneclient/voidui/ui/objects/EdgeInsets.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.neptuneclient.voidui.ui.objects | ||
|
||
data class EdgeInsets( | ||
val left: Float, | ||
val top: Float, | ||
val right: Float, | ||
val bottom: Float, | ||
) { | ||
companion object { | ||
@JvmStatic | ||
fun all(value: Float) = EdgeInsets(value, value, value, value) | ||
@JvmStatic | ||
fun only( | ||
left: Float = 0f, | ||
top: Float = 0f, | ||
right: Float = 0f, | ||
bottom: Float = 0f | ||
) = EdgeInsets(left, top, right, bottom) | ||
@JvmStatic | ||
fun symmetric( | ||
vertical: Float = 0f, | ||
horizontal: Float = 0f | ||
) = EdgeInsets(horizontal, vertical, horizontal, vertical) | ||
val zero = EdgeInsets(0f, 0f, 0f, 0f) | ||
} | ||
|
||
val horizontal get() = left + right | ||
val vertical get() = top + bottom | ||
|
||
operator fun plus(other: EdgeInsets) = EdgeInsets( | ||
left + other.left, | ||
top + other.top, | ||
right + other.right, | ||
bottom + other.bottom | ||
) | ||
|
||
operator fun minus(other: EdgeInsets) = EdgeInsets( | ||
left - other.left, | ||
top - other.top, | ||
right - other.right, | ||
bottom - other.bottom | ||
) | ||
|
||
operator fun times(other: EdgeInsets) = EdgeInsets( | ||
left * other.left, | ||
top * other.top, | ||
right * other.right, | ||
bottom * other.bottom | ||
) | ||
|
||
operator fun div(other: EdgeInsets) = EdgeInsets( | ||
left / other.left, | ||
top / other.top, | ||
right / other.right, | ||
bottom / other.bottom | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters