Skip to content

Instantly share code, notes, and snippets.

@AndreVero
Last active February 24, 2024 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreVero/0e084ab4eb7a84afefb9e2c70b437fc0 to your computer and use it in GitHub Desktop.
Save AndreVero/0e084ab4eb7a84afefb9e2c70b437fc0 to your computer and use it in GitHub Desktop.
Translate extension
// Get the path bounds to translate
// path exactly to the center of the circle
val pathBounds = item.path.getBounds()
// Move our path to the new position
translate(
left = currentOffset.x - pathBounds.right / 2,
top = currentOffset.y - 15.dp.toPx() - pathBounds.bottom
) {
drawPath(
path = item.path,
color = Color.Black
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment