Added eraser.
This commit is contained in:
parent
1414fe0651
commit
8a74bcb3ab
@ -7,6 +7,7 @@ function Pointer(offset = new Position(), color = new Color('000000'))
|
||||
this.draw = function()
|
||||
{
|
||||
if(!this.position_prev){this.position_prev = this.position(); }
|
||||
if(ronin.brush.size < 0){ this.erase(); return; }
|
||||
|
||||
context.beginPath();
|
||||
context.moveTo(this.position_prev.x,this.position_prev.y);
|
||||
@ -20,6 +21,11 @@ function Pointer(offset = new Position(), color = new Color('000000'))
|
||||
this.position_prev = this.position();
|
||||
}
|
||||
|
||||
this.erase = function()
|
||||
{
|
||||
context.clearRect(this.position().x - (ronin.brush.size/2), this.position().y - (ronin.brush.size/2), ronin.brush.size, ronin.brush.size);
|
||||
}
|
||||
|
||||
this.thickness = function()
|
||||
{
|
||||
var ratio = 10/this.position().distance_to(this.position_prev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user