|
@@ -342,6 +342,13 @@ public class CircularSeekBar extends View {
|
|
|
Log.i("pq","progressMark width:"+size1);
|
|
|
float x = markPointX - (adjust / 2);
|
|
|
Log.i("pq","result:"+x);
|
|
|
+ if(angle!=0){
|
|
|
+ float radian = (float) Math.toRadians(angle);
|
|
|
+ Log.i("pq", "radian:" + radian);
|
|
|
+ markPointX = (float) (cx + Math.sin(radian) * outerRadius);
|
|
|
+ }else{
|
|
|
+ markPointX = startPointX;
|
|
|
+ }
|
|
|
return markPointX;
|
|
|
}
|
|
|
|
|
@@ -359,6 +366,13 @@ public class CircularSeekBar extends View {
|
|
|
Log.i("pq","progressMark height:"+size1);
|
|
|
float y = markPointY - (adjust / 2);
|
|
|
Log.i("pq","result:"+y);
|
|
|
+ if(angle!=0){
|
|
|
+ float radian = (float) Math.toRadians(angle);
|
|
|
+ Log.i("pq", "radian:" + radian);
|
|
|
+ markPointY = (float) (cy - Math.cos(radian) * outerRadius);
|
|
|
+ }else{
|
|
|
+ markPointY =startPointY;
|
|
|
+ }
|
|
|
return markPointY;
|
|
|
}
|
|
|
|
|
@@ -490,6 +504,7 @@ public class CircularSeekBar extends View {
|
|
|
int newAngle = (newPercent * 360) / 100 ;
|
|
|
this.setAngle(newAngle);
|
|
|
this.setProgressPercent(newPercent);
|
|
|
+ invalidate();
|
|
|
}
|
|
|
mListener.onProgressChange(this, this.getProgress());
|
|
|
CALLED_FROM_ANGLE = false;
|
|
@@ -587,8 +602,8 @@ public class CircularSeekBar extends View {
|
|
|
if (distance < outerRadius + adjustmentFactor && distance > innerRadius - adjustmentFactor && !up) {
|
|
|
IS_PRESSED = true;
|
|
|
|
|
|
- markPointX = (float) (cx + outerRadius * Math.cos(Math.atan2(x - cx, cy - y) - (Math.PI /2)));
|
|
|
- markPointY = (float) (cy + outerRadius * Math.sin(Math.atan2(x - cx, cy - y) - (Math.PI /2)));
|
|
|
+// markPointX = (float) (cx + outerRadius * Math.cos(Math.atx - cx, cy - y) - (Math.PI /2)));
|
|
|
+// markPointY = (float) (cy + outerRadius * Math.sin(Math.atan2(x - cx, cy - y) - (Math.PI /2)));
|
|
|
|
|
|
float degrees = (float) ((float) ((Math.toDegrees(Math.atan2(x - cx, cy - y)) + 360.0)) % 360.0);
|
|
|
// and to make it count 0-360
|