Revision eac805bd
Added by Leszek Koltunski almost 6 years ago
| src/main/java/org/distorted/magic/RubikSurfaceView.java | ||
|---|---|---|
| 39 | 39 |
// Moving the finger by 1/12 the distance of min(scrWidth,scrHeight) will start a Rotation. |
| 40 | 40 |
private final static int ROTATION_SENSITIVITY= 12; |
| 41 | 41 |
|
| 42 |
// Every 1/12 the distance of min(scrWidth,scrHeight) the direction of cube rotation will reset. |
|
| 43 |
private final static int DIRECTION_SENSITIVITY= 12; |
|
| 44 |
|
|
| 42 | 45 |
private final static int NONE =-1; |
| 43 | 46 |
private final static int FRONT = 0; // has to be 6 consecutive ints |
| 44 | 47 |
private final static int BACK = 1; // FRONT ... BOTTOM |
| ... | ... | |
| 123 | 126 |
{
|
| 124 | 127 |
mTempCurrent.set(quatFromDrag(mX-x,mY-y)); |
| 125 | 128 |
mRenderer.setQuatCurrentOnNextRender(); |
| 129 |
|
|
| 130 |
int minimumDist = (mScreenMin*mScreenMin)/(DIRECTION_SENSITIVITY*DIRECTION_SENSITIVITY); |
|
| 131 |
|
|
| 132 |
if( (mX-x)*(mX-x) + (mY-y)*(mY-y) > minimumDist ) |
|
| 133 |
{
|
|
| 134 |
mX = x; |
|
| 135 |
mY = y; |
|
| 136 |
mTempAccumulated.set(quatMultiply(mQuatCurrent, mQuatAccumulated)); |
|
| 137 |
mTempCurrent.set(0f, 0f, 0f, 1f); |
|
| 138 |
mRenderer.setQuatCurrentOnNextRender(); |
|
| 139 |
mRenderer.setQuatAccumulatedOnNextRender(); |
|
| 140 |
} |
|
| 126 | 141 |
} |
| 127 | 142 |
if( mBeginningRotation ) |
| 128 | 143 |
{
|
Also available in: Unified diff
RubikCube: further fix for dragging.