everybody. I draw a rectangle at the top of my SurfaceView with function Motion Event from the begging point of XY. I'd like to know how to pull its sides after I've drawn the rectangle?
my code:
protected void onDraw(Canvas canvas) {
if(drawing){
canvas.drawRect(Var.Numb3,Var.Numb4,Var.Numb,Var.Numb2, paint);
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int action = event.getAction();
if (action==MotionEvent.ACTION_MOVE){
float x = event.getX();
float y = event.getY();
Var.Numb = Var.X ;
Var.Numb2 = Var.Y ;
Var.Numb3 = (int) x;
Var.Numb4 = (int) y ;
}
else if (action==MotionEvent.ACTION_DOWN){
Var.X = (int) event.getX();
Var.Y = (int) event.getY();
drawing = true;
}
else if (action==MotionEvent.ACTION_UP){
drawing = true;
}
invalidate();
return true;
}
}