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

@@ -4,18 +4,35 @@ function Mode_Paint()
this.name = "Paint";
this.is_drawing = false;
this.mouse_down = function(event)
{
ronin.brush.draw_start(event); ronin.brush.draw(event);
this.is_drawing = true;
for (i = 0; i < ronin.brush.pointers.length; i++) {
ronin.brush.pointers[i].start();
}
}
this.mouse_move = function(event)
{
ronin.brush.draw(event);
if(this.is_drawing === false){return;}
// this.position = new Position(event.clientX - parseFloat(ronin.surface.style.left) - parseFloat(ronin.canvas.element.style.left),event.clientY- parseFloat(ronin.surface.style.top) - parseFloat(ronin.canvas.element.style.top));
ronin.brush.position = ronin.position_in_canvas(event);
for (i = 0; i < ronin.brush.pointers.length; i++) {
ronin.brush.pointers[i].draw();
}
}
this.mouse_up = function(event)
{
ronin.brush.draw_stop(event);
this.is_drawing = false;
for (i = 0; i < ronin.brush.pointers.length; i++) {
ronin.brush.pointers[i].stop();
}
}
}