Skip to content
Open
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@ public interface OnMultipleLongPressListener {
private int mButtonDirection = 0;


public enum AxisToCenter {
BOTH, X, Y
}

/**
* axis to be centered
*/
private AxisToCenter axisToCenter = AxisToCenter.BOTH;


/*
CONSTRUCTORS
*/
Expand Down Expand Up @@ -540,8 +550,18 @@ private int getStrength() {
* Reset the button position to the center.
*/
public void resetButtonPosition() {
mPosX = mCenterX;
mPosY = mCenterY;
switch (axisToCenter) {
case BOTH:
mPosX = mCenterX;
mPosY = mCenterY;
break;
case X:
mPosX = mCenterX;
break;
case Y:
mPosY = mCenterY;
break;
}
}


Expand Down Expand Up @@ -800,6 +820,21 @@ public void setButtonDirection(int direction) {
mButtonDirection = direction;
}

/**
* get axis to be centered
* @return
*/
public AxisToCenter getAxisToCenter() {
return axisToCenter;
}

/**
* set axis to be centered
* @param axisToCenter
*/
public void setAxisToCenter(AxisToCenter axisToCenter) {
this.axisToCenter = axisToCenter;
}

/*
IMPLEMENTS
Expand Down