@@ -323,9 +323,8 @@ class BarLineChartTouchListener(
323323
324324 if (totalDist > minScalePointerDistance) {
325325 // get the translation
326-
327- val t = getTrans(touchPointCenter.x, touchPointCenter.y)
328- val h = chart.viewPortHandler
326+ val pointF = getTrans(touchPointCenter.x, touchPointCenter.y)
327+ val viewPortHandler = chart.viewPortHandler
329328
330329 // take actions depending on the activated touch mode
331330 if (touchMode == PINCH_ZOOM ) {
@@ -335,16 +334,16 @@ class BarLineChartTouchListener(
335334
336335 val isZoomingOut = (scale < 1 )
337336
338- val canZoomMoreX = if (isZoomingOut) h .canZoomOutMoreX() else h .canZoomInMoreX()
337+ val canZoomMoreX = if (isZoomingOut) viewPortHandler .canZoomOutMoreX() else viewPortHandler .canZoomInMoreX()
339338
340- val canZoomMoreY = if (isZoomingOut) h .canZoomOutMoreY() else h .canZoomInMoreY()
339+ val canZoomMoreY = if (isZoomingOut) viewPortHandler .canZoomOutMoreY() else viewPortHandler .canZoomInMoreY()
341340
342341 val scaleX = if (chart.isScaleXEnabled) scale else 1f
343342 val scaleY = if (chart.isScaleYEnabled) scale else 1f
344343
345344 if (canZoomMoreY || canZoomMoreX) {
346345 matrix.set(savedMatrix)
347- matrix.postScale(getLimitedScaleX(scaleX, t ), getLimitedScaleY(scaleY, t ), t .x, t .y)
346+ matrix.postScale(getLimitedScaleX(scaleX, pointF ), getLimitedScaleY(scaleY, pointF ), pointF .x, pointF .y)
348347
349348 l?.onChartScale(event, scaleX, scaleY)
350349 }
@@ -355,11 +354,11 @@ class BarLineChartTouchListener(
355354 val scaleX = xDist / savedXDist // x-axis scale
356355
357356 val isZoomingOut = (scaleX < 1 )
358- val canZoomMoreX = if (isZoomingOut) h .canZoomOutMoreX() else h .canZoomInMoreX()
357+ val canZoomMoreX = if (isZoomingOut) viewPortHandler .canZoomOutMoreX() else viewPortHandler .canZoomInMoreX()
359358
360359 if (canZoomMoreX) {
361360 matrix.set(savedMatrix)
362- matrix.postScale(getLimitedScaleX(scaleX, t ), 1f , t .x, t .y)
361+ matrix.postScale(getLimitedScaleX(scaleX, pointF ), 1f , pointF .x, pointF .y)
363362
364363 l?.onChartScale(event, scaleX, 1f )
365364 }
@@ -370,17 +369,17 @@ class BarLineChartTouchListener(
370369 val scaleY = yDist / savedYDist // y-axis scale
371370
372371 val isZoomingOut = (scaleY < 1 )
373- val canZoomMoreY = if (isZoomingOut) h .canZoomOutMoreY() else h .canZoomInMoreY()
372+ val canZoomMoreY = if (isZoomingOut) viewPortHandler .canZoomOutMoreY() else viewPortHandler .canZoomInMoreY()
374373
375374 if (canZoomMoreY) {
376375 matrix.set(savedMatrix)
377- matrix.postScale(1f , getLimitedScaleY(scaleY, t ), t .x, t .y)
376+ matrix.postScale(1f , getLimitedScaleY(scaleY, pointF ), pointF .x, pointF .y)
378377
379378 l?.onChartScale(event, 1f , scaleY)
380379 }
381380 }
382381
383- PointF .recycleInstance(t )
382+ PointF .recycleInstance(pointF )
384383 }
385384 }
386385 }
@@ -389,7 +388,7 @@ class BarLineChartTouchListener(
389388 * limit scaleX range
390389 */
391390 private fun getLimitedScaleX (scaleX : Float , t : PointF ): Float {
392- val h = chart.viewPortHandler
391+ val viewPortHandler = chart.viewPortHandler
393392 tempMatrix.set(savedMatrix)
394393 tempMatrix.postScale(scaleX, 1f , t.x, t.y)
395394
@@ -401,10 +400,10 @@ class BarLineChartTouchListener(
401400
402401 var resultScaleX = scaleX
403402
404- if (calScaleX < h .minScaleX) {
405- resultScaleX = h .minScaleX / lastScaleX
406- } else if (calScaleX > h .maxScaleX) {
407- resultScaleX = h .maxScaleX / lastScaleX
403+ if (calScaleX < viewPortHandler .minScaleX) {
404+ resultScaleX = viewPortHandler .minScaleX / lastScaleX
405+ } else if (calScaleX > viewPortHandler .maxScaleX) {
406+ resultScaleX = viewPortHandler .maxScaleX / lastScaleX
408407 }
409408 return resultScaleX
410409 }
@@ -413,7 +412,7 @@ class BarLineChartTouchListener(
413412 * limit scaleY range
414413 */
415414 private fun getLimitedScaleY (scaleY : Float , t : PointF ): Float {
416- val h = chart.viewPortHandler
415+ val viewPortHandler = chart.viewPortHandler
417416 tempMatrix.set(savedMatrix)
418417 tempMatrix.postScale(1f , scaleY, t.x, t.y)
419418
@@ -425,10 +424,10 @@ class BarLineChartTouchListener(
425424
426425 var resultScaleY = scaleY
427426
428- if (calScaleY < h .minScaleY) {
429- resultScaleY = h .minScaleY / lastScaleY
430- } else if (calScaleY > h .maxScaleY) {
431- resultScaleY = h .maxScaleY / lastScaleY
427+ if (calScaleY < viewPortHandler .minScaleY) {
428+ resultScaleY = viewPortHandler .minScaleY / lastScaleY
429+ } else if (calScaleY > viewPortHandler .maxScaleY) {
430+ resultScaleY = viewPortHandler .maxScaleY / lastScaleY
432431 }
433432 return resultScaleY
434433 }
0 commit comments