mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
commit
0644c9d6cb
1 changed files with 4 additions and 2 deletions
|
@ -38,9 +38,11 @@ class FixedRatioSurfaceView @JvmOverloads constructor(
|
|||
newWidth = width
|
||||
newHeight = (width / aspectRatio).roundToInt()
|
||||
}
|
||||
setMeasuredDimension(newWidth, newHeight)
|
||||
val left = (width - newWidth) / 2;
|
||||
val top = (height - newHeight) / 2;
|
||||
setLeftTopRightBottom(left, top, left + newWidth, top + newHeight)
|
||||
} else {
|
||||
setMeasuredDimension(width, height)
|
||||
setLeftTopRightBottom(0, 0, width, height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue