make sure the imported bitmap is centered

This commit is contained in:
tibbi 2017-04-09 13:13:56 +02:00
parent 6c2dc3ca63
commit 18019315e2
1 changed files with 3 additions and 1 deletions

View File

@ -116,7 +116,9 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
super.onDraw(canvas)
if (mBackgroundBitmap != null) {
canvas.drawBitmap(mBackgroundBitmap, 0f, 0f, null)
val left = (width - mBackgroundBitmap!!.width) / 2
val top = (height - mBackgroundBitmap!!.height) / 2
canvas.drawBitmap(mBackgroundBitmap, left.toFloat(), top.toFloat(), null)
}
for ((key, value) in mPaths) {