Skip to content

Commit

Permalink
Merge pull request #338 from CptbeffHeart/main
Browse files Browse the repository at this point in the history
Update ComponentUtils.kt moveToCenter
  • Loading branch information
NichtStudioCode authored Mar 26, 2024
2 parents 88f4641 + d9ff8c2 commit 853f522
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ fun <C : BuildableComponent<C, B>, B : ComponentBuilder<C, B>> ComponentBuilder<
}

fun <C : BuildableComponent<C, B>, B : ComponentBuilder<C, B>> ComponentBuilder<C, B>.moveToCenter(lang: String = "en_us"): B {
return move(-CharSizes.calculateComponentWidth(build(), lang))
return move(-CharSizes.calculateComponentWidth(build(), lang) / 2)
}

fun <C : BuildableComponent<C, B>, B : ComponentBuilder<C, B>> ComponentBuilder<C, B>.moveTo(afterStart: Number, lang: String = "en_us"): B {
return move(-CharSizes.calculateComponentWidth(build(), lang) + afterStart.toFloat())
}
}

0 comments on commit 853f522

Please sign in to comment.