Skip to content

Commit fcc5af7

Browse files
committed
Call onChartScale listener after double-tap-zoom
ChartsOrg/Charts#3770
1 parent 13aee59 commit fcc5af7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/listener/BarLineChartTouchListener.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,19 @@ public boolean onDoubleTap(MotionEvent e) {
580580

581581
MPPointF trans = getTrans(e.getX(), e.getY());
582582

583-
mChart.zoom(mChart.isScaleXEnabled() ? 1.4f : 1f, mChart.isScaleYEnabled() ? 1.4f : 1f, trans.x, trans.y);
583+
float scaleX = mChart.isScaleXEnabled() ? 1.4f : 1f;
584+
float scaleY = mChart.isScaleYEnabled() ? 1.4f : 1f;
585+
586+
mChart.zoom(scaleX, scaleY, trans.x, trans.y);
584587

585588
if (mChart.isLogEnabled())
586589
Log.i("BarlineChartTouch", "Double-Tap, Zooming In, x: " + trans.x + ", y: "
587590
+ trans.y);
588591

592+
if (l != null) {
593+
l.onChartScale(e, scaleX, scaleY);
594+
}
595+
589596
MPPointF.recycleInstance(trans);
590597
}
591598

MPChartLib/src/main/java/com/github/mikephil/charting/listener/OnChartGestureListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public interface OnChartGestureListener {
5757
void onChartFling(MotionEvent me1, MotionEvent me2, float velocityX, float velocityY);
5858

5959
/**
60-
* Callbacks when the chart is scaled / zoomed via pinch zoom gesture.
60+
* Callbacks when the chart is scaled / zoomed via pinch zoom / double-tap gesture.
6161
*
6262
* @param me
6363
* @param scaleX scalefactor on the x-axis

0 commit comments

Comments
 (0)