diff --git a/form/src/main/java/com/bin/david/form/core/SmartTable.java b/form/src/main/java/com/bin/david/form/core/SmartTable.java index 34c6d47..18348f7 100644 --- a/form/src/main/java/com/bin/david/form/core/SmartTable.java +++ b/form/src/main/java/com/bin/david/form/core/SmartTable.java @@ -481,9 +481,9 @@ public void setZoom(boolean zoom) { * @param maxZoom 最大缩放值 * @param minZoom 最小缩放值 */ - public void setZoom(boolean zoom, float maxZoom, float minZoom) { - + public void setZoom(boolean zoom, boolean enableDoubleTap, float maxZoom, float minZoom) { matrixHelper.setCanZoom(zoom); + matrixHelper.setEnableDoubleTap(enableDoubleTap); matrixHelper.setMinZoom(minZoom); matrixHelper.setMaxZoom(maxZoom); invalidate(); diff --git a/form/src/main/java/com/bin/david/form/matrix/MatrixHelper.java b/form/src/main/java/com/bin/david/form/matrix/MatrixHelper.java index db2c018..bb9fae9 100644 --- a/form/src/main/java/com/bin/david/form/matrix/MatrixHelper.java +++ b/form/src/main/java/com/bin/david/form/matrix/MatrixHelper.java @@ -40,6 +40,7 @@ public class MatrixHelper extends Observable implements ITou private ScaleGestureDetector mScaleGestureDetector; private GestureDetector mGestureDetector; private boolean isCanZoom = false; + private boolean isEnableDoubleTap = true; private boolean isScale; //是否正在缩小 private Rect originalRect; //原始大小 private Rect zoomRect; @@ -259,7 +260,7 @@ public boolean onDown(MotionEvent e) { //双击 @Override public boolean onDoubleTap(MotionEvent e) { - if (isCanZoom) { + if (isCanZoom && isEnableDoubleTap) { float oldZoom = zoom; if (isScale) { //缩小 zoom = zoom / 1.5f; @@ -500,7 +501,6 @@ public Rect getOriginalRect() { } - /** * 是否可以缩放 * @return 是否可以缩放 @@ -508,8 +508,16 @@ public Rect getOriginalRect() { public boolean isCanZoom() { zoom = 1f; return isCanZoom; + } + /** + * 是否可以触摸缩放 + * @return 是否可以触摸缩放 + */ + public boolean isEnableDoubleTap() { + return isEnableDoubleTap; } + /** * 获取表格改变监听 * 主要用于SmartTable view监听matrixHelper 移动和缩放 @@ -528,6 +536,14 @@ public void setOnTableChangeListener(OnTableChangeListener onTableChangeListener this.listener = onTableChangeListener; } + /** + * 设置是否可以触摸缩放 + * @param enableDoubleTap + */ + public void setEnableDoubleTap(boolean enableDoubleTap) { + isEnableDoubleTap = enableDoubleTap; + } + /** * 设置是否可以缩放 * @param canZoom