Skip to content

Commit 81773c7

Browse files
committed
Make checkbox size based on the line height of the edit text
1 parent 0bd6c7c commit 81773c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecTaskListSpan.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ open class AztecTaskListSpan(
9494

9595
p.color = listStyle.indicatorColor
9696
p.style = Paint.Style.FILL
97-
97+
val drawableHeight = (0.9*(p.fontMetrics.bottom - p.fontMetrics.top))
9898
// Make sure the marker is correctly aligned on RTL languages
9999
val markerStartPosition: Float = x + (listStyle.indicatorMargin * dir) * 1f
100100
val d: Drawable = context.resources.getDrawable(R.drawable.ic_checkbox, null)
@@ -104,7 +104,7 @@ open class AztecTaskListSpan(
104104
} else {
105105
d.state = intArrayOf()
106106
}
107-
d.setBounds(leftBound - 40, baseline - 40, leftBound + 8, baseline + 8)
107+
d.setBounds((leftBound - drawableHeight*0.8).toInt(), (baseline - drawableHeight*0.8).toInt(), (leftBound + drawableHeight*0.2).toInt(), (baseline + drawableHeight*0.2).toInt())
108108
d.draw(c)
109109

110110
p.color = oldColor

0 commit comments

Comments
 (0)