Skip to content

Commit e72614b

Browse files
committed
Rename
1 parent fc168c2 commit e72614b

3 files changed

Lines changed: 26 additions & 28 deletions

File tree

chartLib/src/main/kotlin/info/appdev/charting/charts/BarLineChartBase.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,9 +1084,9 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt
10841084
* returns the Entry object displayed at the touched position of the chart
10851085
*/
10861086
fun getEntryByTouchPoint(x: Float, y: Float): Entry? {
1087-
val h = getHighlightByTouchPoint(x, y)
1088-
if (h != null) {
1089-
return mData!!.getEntryForHighlight(h)
1087+
val highlight = getHighlightByTouchPoint(x, y)
1088+
if (highlight != null) {
1089+
return mData!!.getEntryForHighlight(highlight)
10901090
}
10911091
return null
10921092
}
@@ -1095,9 +1095,9 @@ abstract class BarLineChartBase<T : BarLineScatterCandleBubbleData<IBarLineScatt
10951095
* returns the DataSet object displayed at the touched position of the chart
10961096
*/
10971097
fun getDataSetByTouchPoint(x: Float, y: Float): IBarLineScatterCandleBubbleDataSet<*>? {
1098-
val h = getHighlightByTouchPoint(x, y)
1099-
if (h != null) {
1100-
return mData!!.getDataSetByIndex(h.dataSetIndex)
1098+
val highlight = getHighlightByTouchPoint(x, y)
1099+
if (highlight != null) {
1100+
return mData!!.getDataSetByIndex(highlight.dataSetIndex)
11011101
}
11021102
return null
11031103
}

chartLib/src/main/kotlin/info/appdev/charting/charts/PieChart.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ open class PieChart : PieRadarChartBase<PieData> {
339339

340340
override fun getIndexForAngle(angle: Float): Int {
341341
// take the current angle of the chart into consideration
342-
343342
val a = (angle - rotationAngle).getNormalizedAngle()
344343

345344
for (i in absoluteAngles.indices) {

chartLib/src/main/kotlin/info/appdev/charting/listener/BarLineChartTouchListener.kt

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)