Skip to content

Commit

Permalink
feat(ui): add padding constant to Label.kt and update vertex positions
Browse files Browse the repository at this point in the history
Introduced a `PADDING` constant in the `Label` class for better control of spacing.
  • Loading branch information
AdrienBousquieEPFL committed Dec 18, 2024
1 parent b1a2adf commit a295609
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class Label(context: Context, text: String, var pos: Position, size: Float, obje
private val vertexBuffer: FloatBuffer
private val texCoordBuffer: FloatBuffer

companion object {
private const val PADDING = 0.025f
}

init {
// Initialize shader program
val vertexShaderCode = readShader(context, "label_vertex_shader.glsl")
Expand All @@ -39,16 +43,16 @@ class Label(context: Context, text: String, var pos: Position, size: Float, obje
val vertices =
floatArrayOf(
-size,
-size - objectSize - size,
-size - objectSize - PADDING,
0f, // Bottom left
size,
-size - objectSize - size,
-size - objectSize - PADDING,
0f, // Bottom right
-size,
size - objectSize - size,
size - objectSize - PADDING,
0f, // Top left
size,
size - objectSize - size,
size - objectSize - PADDING,
0f // Top right
)
vertexBuffer = vertices.toBuffer()
Expand Down

0 comments on commit a295609

Please sign in to comment.