fix #1616: Calculate DP to pixel value for map label offset (#1637)

This commit is contained in:
Joshua Soberg 2025-03-04 15:40:57 -05:00 committed by GitHub
parent c597b3b000
commit 749c4b4918
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 5 deletions

View file

@ -40,3 +40,7 @@ fun Activity.hideKeyboard() {
// Converts SP to pixels.
fun Context.spToPx(sp: Float): Int =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, resources.displayMetrics).toInt()
// Converts DP to pixels.
fun Context.dpToPx(dp: Float): Int =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.displayMetrics).toInt()