Skip to content

Commit f4868ae

Browse files
authored
Fix vertical scrolls, removed some logs (#7)
1 parent 542646e commit f4868ae

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

cameraview/src/main/java/com/otaliastudios/cameraview/CameraView.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,13 @@ public boolean onTouchEvent(MotionEvent event) {
412412
// Pass to our own GestureLayouts
413413
CameraOptions options = mCameraController.getCameraOptions(); // Non null
414414
if (mPinchGestureLayout.onTouchEvent(event)) {
415-
Log.e(TAG, "pinch!");
415+
// Log.e(TAG, "pinch!");
416416
onGesture(mPinchGestureLayout, options);
417417
} else if (mScrollGestureLayout.onTouchEvent(event)) {
418-
Log.e(TAG, "scroll!");
418+
// Log.e(TAG, "scroll!");
419419
onGesture(mScrollGestureLayout, options);
420420
} else if (mTapGestureLayout.onTouchEvent(event)) {
421-
Log.e(TAG, "tap!");
421+
// Log.e(TAG, "tap!");
422422
onGesture(mTapGestureLayout, options);
423423
}
424424
return true;
@@ -1252,8 +1252,8 @@ public void run() {
12521252
int w = consistentWithView ? getWidth() : getHeight();
12531253
int h = consistentWithView ? getHeight() : getWidth();
12541254
AspectRatio targetRatio = AspectRatio.of(w, h);
1255-
Log.e(TAG, "is Consistent? " + consistentWithView);
1256-
Log.e(TAG, "viewWidth? " + getWidth() + ", viewHeight? " + getHeight());
1255+
// Log.e(TAG, "is Consistent? " + consistentWithView);
1256+
// Log.e(TAG, "viewWidth? " + getWidth() + ", viewHeight? " + getHeight());
12571257
jpeg2 = CropHelper.cropToJpeg(jpeg, targetRatio, mJpegQuality);
12581258
}
12591259
dispatchOnPictureTaken(jpeg2);

cameraview/src/main/views/com/otaliastudios/cameraview/ScrollGestureLayout.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected void onInitialize(Context context) {
3333
@Override
3434
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
3535
boolean horizontal;
36-
Log.e("ScrollGestureLayout", "onScroll, distanceX="+distanceX+", distanceY="+distanceY);
36+
// Log.e("ScrollGestureLayout", "onScroll, distanceX="+distanceX+", distanceY="+distanceY);
3737
if (e1.getX() != mPoints[0].x || e1.getY() != mPoints[0].y) {
3838
// First step. We choose now if it's a vertical or horizontal scroll, and
3939
// stick to it for the whole gesture.
@@ -46,7 +46,7 @@ public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float d
4646
}
4747
mPoints[1].set(e2.getX(), e2.getY());
4848
mDistance = horizontal ? (distanceX / getWidth()) : (distanceY / getHeight());
49-
mDistance = -mDistance; // they are provided inverted.
49+
mDistance = horizontal ? -mDistance : mDistance; // When vertical, up = positive
5050
mNotify = true;
5151
return true;
5252
}
@@ -71,7 +71,7 @@ public boolean onTouchEvent(MotionEvent event) {
7171
mDetector.onTouchEvent(event);
7272

7373
// Keep notifying CameraView as long as the gesture goes.
74-
if (mNotify) Log.e("ScrollGestureLayout", "notifying a gesture "+mType.name());
74+
// if (mNotify) Log.e("ScrollGestureLayout", "notifying a gesture "+mType.name());
7575
return mNotify;
7676
}
7777

@@ -91,7 +91,7 @@ public float scaleValue(float currValue, float minValue, float maxValue) {
9191
float newValue = currValue + delta;
9292
if (newValue < minValue) newValue = minValue;
9393
if (newValue > maxValue) newValue = maxValue;
94-
Log.e("ScrollGestureLayout", "curr="+currValue+", min="+minValue+", max="+maxValue+", out="+newValue);
94+
// Log.e("ScrollGestureLayout", "curr="+currValue+", min="+minValue+", max="+maxValue+", out="+newValue);
9595
return newValue;
9696
}
9797

0 commit comments

Comments
 (0)