Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add get focusx and focusy #32

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.almeros.android.multitouch">

<uses-configuration android:reqTouchScreen="finger" />

mariopce marked this conversation as resolved.
Show resolved Hide resolved
<uses-feature
android:name="android.hardware.touchscreen"
android:required="true" />
<uses-feature
android:name="android.hardware.touchscreen.multitouch"
android:required="true" />


<application/>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ protected void handleInProgressEvent(int actionCode, MotionEvent event){
// a certain limit. This can help filter shaky data as a
// finger is lifted.
if (mCurrPressure / mPrevPressure > PRESSURE_THRESHOLD) {
determineFocusPoint(event);
final boolean updatePrevious = mListener.onRotate(this);
if (updatePrevious) {
mPrevEvent.recycle();
Expand All @@ -155,6 +156,25 @@ protected void resetState() {
mSloppyGesture = false;
}

private float mFocusX;
mariopce marked this conversation as resolved.
Show resolved Hide resolved
private float mFocusY;
/**
*/
public float getFocusX() {
return mFocusX;
}


/**
*/
public float getFocusY() {
mariopce marked this conversation as resolved.
Show resolved Hide resolved
return mFocusY;
}

private void determineFocusPoint(MotionEvent curr) {
mFocusX = (curr.getX(0) + curr.getX(1)) * 0.5f;
mFocusY = (curr.getY(0) + curr.getY(1)) * 0.5f;
}

/**
* Return the rotation difference from the previous rotate event to the current
Expand Down