当我尝试移动线方向删除图标时,我想要旋转Bitmap for Icon删除线,并在顶部修复固定角度。
这是m行上方的删除图标
if (line_cir>1){
if (touchedline != null){
canvas.drawBitmap(bitmap1,touchedline.startX+bitmap1.getWidth(),touchedline.startY+bitmap1.getHeight(),null);
}
}
这是删除代码的代码
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
// it's the first pointer, so clear all existing pointers data
clearCirclePointer();
xTouch = event.getX(0);
yTouch = event.getY(0);
xTouch1 = event.getX(0);
yTouch1 = event.getY(0);
startX = event.getX();
startY = event.getY();
// check if we've touched inside some circle
touchedCircle = obtainTouchedCircle(xTouch, yTouch);
touchedCircle.centerX = xTouch;
touchedCircle.centerY = yTouch;
mCirclePointer.put(event.getPointerId(0), touchedCircle);
touchedline = getTouchedline(xTouch, yTouch, 0);
touchedline1 = getTouchedline(xTouch-70, yTouch-70, 0);
//for Remove Line$
if (line_cir>1) {
if (touchedline1 != null) {
if ((Math.abs(touchedline1.startX+70-xTouch1) < 40) && (Math.abs(touchedline1.startY+70 -yTouch1)< 40)) {
lines.remove(touchedline1);
line_cir = 0;
}
}
}
invalidate();
handled = true;
break;
感谢Andvace的帮助