Skip to content

Commit

Permalink
Call onChartScale listener after double-tap-zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Jan 22, 2020
1 parent a16b339 commit 265b933
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -580,12 +580,19 @@ public boolean onDoubleTap(MotionEvent e) {

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

mChart.zoom(mChart.isScaleXEnabled() ? 1.4f : 1f, mChart.isScaleYEnabled() ? 1.4f : 1f, trans.x, trans.y);
float scaleX = mChart.isScaleXEnabled() ? 1.4f : 1f;
float scaleY = mChart.isScaleYEnabled() ? 1.4f : 1f;

mChart.zoom(scaleX, scaleY, trans.x, trans.y);

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

if (l != null) {
l.onChartScale(e, scaleX, scaleY);
}

MPPointF.recycleInstance(trans);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public interface OnChartGestureListener {
void onChartFling(MotionEvent me1, MotionEvent me2, float velocityX, float velocityY);

/**
* Callbacks when the chart is scaled / zoomed via pinch zoom gesture.
* Callbacks when the chart is scaled / zoomed via pinch zoom / double-tap gesture.
*
* @param me
* @param scaleX scalefactor on the x-axis
Expand Down

0 comments on commit 265b933

Please sign in to comment.