Korilakkuma / CanvasView

Android Application Library
Other
183 stars 72 forks source link

Found bug when drawing with rectangle and move #8

Open nguyenminhdh123 opened 8 years ago

nguyenminhdh123 commented 8 years ago

I found a bug when drawing with rectangle and move upside This bug found in method: onActionMove class CanvasView You can fix this by: from case RECTANGLE : path.reset(); path.addRect(this.startX, this.startY, x, y, Path.Direction.CCW); break;

to case RECTANGLE : path.reset(); float sX = this.startX; float sY = this.startY; float eX = x; float eY = y; if(sX > eX){ sX = x; eX = this.startX; } if(sY > eY){ sY = y; eY = this.startY; } path.addRect(sX, sY, eX, eY, Path.Direction.CCW);