i trying make re-sizable touch view made successfully. can find code how make view resizable on touch event.
it has 4 corners. can re-size rectangle dragging 1 of corner. want enhance logic , want put rotation in code. find angle when user touch center of 1 of edge of rectangle. problem can't new position of corners can redraw rectangle , rotation possible.
question : how can calculate 4 corners new position based on angle?.
if know angle rotate don't need calculate rectangle's vertices. simple way below
@override protected void ondraw(canvas canvas) { super.ondraw(canvas); canvas.save(); canvas.rotate(60.0f); paint.setcolor(color.black); paint.setstyle(paint.style.stroke); canvas.drawrect(10, 10, 100, 100, paint); canvas.restore(); }
Comments
Post a Comment