Skip to content

Commit 5b7b394

Browse files
authored
Merge pull request #583 from AppDevNext/CosmeticViewPortHandler
Cosmetic ViewPortHandler
2 parents ec6dd90 + f0e7fe0 commit 5b7b394

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/utils/ViewPortHandler.kt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ open class ViewPortHandler {
342342
/**
343343
* limits the maximum scale and X translation of the given matrix
344344
*/
345-
fun limitTransAndScale(matrix: Matrix, content: RectF?) {
345+
fun limitTransAndScale(matrix: Matrix, content: RectF) {
346346
matrix.getValues(matrixBuffer)
347347

348348
val curTransX = matrixBuffer[Matrix.MTRANS_X]
@@ -357,13 +357,8 @@ open class ViewPortHandler {
357357
// min scale-y is 1f
358358
scaleY = min(max(minScaleY.toDouble(), curScaleY.toDouble()), maxScaleY.toDouble()).toFloat()
359359

360-
var width = 0f
361-
var height = 0f
362-
363-
if (content != null) {
364-
width = content.width()
365-
height = content.height()
366-
}
360+
val width: Float = content.width()
361+
val height: Float = content.height()
367362

368363
val maxTransX = -width * (scaleX - 1f)
369364
transX = min(max(curTransX.toDouble(), (maxTransX - transOffsetX).toDouble()), transOffsetX.toDouble()).toFloat()

0 commit comments

Comments
 (0)