mirror of
https://github.com/SimpleMobileTools/Simple-Draw.git
synced 2025-06-05 21:59:17 +02:00
Added clear canvas functionality
Method "clearCanvas" added to class MyCanvas. It will clear the path list and update the canvas status on screen.
This commit is contained in:
@ -85,6 +85,13 @@ public class MyCanvas extends View {
|
||||
canvas.drawPath(mPath, mPaint);
|
||||
}
|
||||
|
||||
public void clearCanvas(){
|
||||
mPath = new Path();
|
||||
mPaths = new LinkedHashMap<>();
|
||||
pathsUpdated();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private void actionDown(float x, float y) {
|
||||
mPath.reset();
|
||||
mPath.moveTo(x, y);
|
||||
|
@ -84,6 +84,9 @@ public class MainActivity extends SimpleActivity implements MyCanvas.PathsChange
|
||||
case R.id.settings:
|
||||
startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
|
||||
return true;
|
||||
case R.id.clear:
|
||||
mMyCanvas.clearCanvas();
|
||||
return true;
|
||||
case R.id.about:
|
||||
startActivity(new Intent(getApplicationContext(), AboutActivity.class));
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user