Migrated brush mouse events into cursor.paint

This commit is contained in:
Devine Lu Linvega
2016-12-19 10:14:07 -07:00
parent 01e8b81fda
commit 53898a5881
2 changed files with 21 additions and 36 deletions

View File

@@ -6,7 +6,6 @@ function Brush(rune)
this.pointers = [new Pointer(new Position())];
this.position = new Position();
this.is_drawing = false;
this.size = 1;
this.opacity = 1;
this.color = new Color();
@@ -61,38 +60,7 @@ function Brush(rune)
{
this.pointers.push(pointer);
}
// Draw
this.draw = function(e)
{
if(this.is_drawing === false){return;}
this.position = new Position(e.clientX - parseFloat(ronin.surface.style.left) - parseFloat(ronin.canvas.element.style.left),e.clientY- parseFloat(ronin.surface.style.top) - parseFloat(ronin.canvas.element.style.top));
for (i = 0; i < this.pointers.length; i++) {
this.pointers[i].draw();
}
}
this.draw_start = function(e)
{
this.is_drawing = true;
for (i = 0; i < this.pointers.length; i++) {
this.pointers[i].start();
}
}
this.draw_stop = function(e)
{
this.is_drawing = false;
for (i = 0; i < this.pointers.length; i++) {
this.pointers[i].stop();
}
}
this.widget = function()
{
return "> "+this.size+" <span style='color:"+this.color.render()+"'>"+this.color.render()+"</span> ";