MCPcopy Create free account
hub / github.com/GcsSloop/AndroidNote / onTouchEvent

Method onTouchEvent

CustomView/Advance/Code/SetPolyToPoly.java:72–95  ·  view source on GitHub ↗
(MotionEvent event)

Source from the content-addressed store, hash-verified

70 }
71
72 @Override
73 public boolean onTouchEvent(MotionEvent event) {
74
75 switch (event.getAction()){
76 case MotionEvent.ACTION_MOVE:
77 float tempX = event.getX();
78 float tempY = event.getY();
79
80 // 根据触控位置改变dst
81 for (int i=0; i<testPoint*2; i+=2 ) {
82 if (Math.abs(tempX - dst[i]) <= triggerRadius && Math.abs(tempY - dst[i+1]) <= triggerRadius){
83 dst[i] = tempX-100;
84 dst[i+1] = tempY-100;
85 break; // 防止两个点的位置重合
86 }
87 }
88
89 resetPolyMatrix(testPoint);
90 invalidate();
91 break;
92 }
93
94 return true;
95 }
96
97 public void resetPolyMatrix(int pointCount){
98 mPolyMatrix.reset();

Callers

nothing calls this directly

Calls 1

resetPolyMatrixMethod · 0.95

Tested by

no test coverage detected