Migrated brush mouse events into cursor.paint
This commit is contained in:
parent
01e8b81fda
commit
53898a5881
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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> ";
|
||||
|
Loading…
x
Reference in New Issue
Block a user