Removed modes, merged with modules.
This commit is contained in:
@@ -5,7 +5,6 @@ function Brush(rune)
|
||||
this.parameters = [Position,Rect,Angle,Color,Value,Bang];
|
||||
this.pointers = [new Pointer(new Position())];
|
||||
|
||||
this.position = new Position();
|
||||
this.size = 1;
|
||||
this.opacity = 1;
|
||||
this.color = new Color();
|
||||
@@ -63,6 +62,43 @@ function Brush(rune)
|
||||
|
||||
this.widget = function()
|
||||
{
|
||||
return "> "+this.size+" <span style='color:"+this.color.render()+"'>"+this.color.render()+"</span> ";
|
||||
return "> "+this.size+" <span>"+this.color.render()+"</span> ";
|
||||
}
|
||||
|
||||
// Cursor
|
||||
|
||||
this.is_drawing = false;
|
||||
|
||||
this.mouse_down = function(position)
|
||||
{
|
||||
this.is_drawing = true;
|
||||
|
||||
for (i = 0; i < ronin.brush.pointers.length; i++) {
|
||||
ronin.brush.pointers[i].start();
|
||||
}
|
||||
|
||||
ronin.stroke.new_stroke();
|
||||
}
|
||||
|
||||
this.mouse_move = function(position)
|
||||
{
|
||||
if(this.is_drawing === false){ return; }
|
||||
|
||||
for (i = 0; i < ronin.brush.pointers.length; i++) {
|
||||
ronin.brush.pointers[i].draw();
|
||||
}
|
||||
|
||||
ronin.stroke.append_stroke(position);
|
||||
}
|
||||
|
||||
this.mouse_up = function(position)
|
||||
{
|
||||
this.is_drawing = false;
|
||||
|
||||
for (i = 0; i < ronin.brush.pointers.length; i++) {
|
||||
ronin.brush.pointers[i].stop();
|
||||
}
|
||||
|
||||
ronin.stroke.save_stroke();
|
||||
}
|
||||
}
|
@@ -67,4 +67,33 @@ function Canvas(rune)
|
||||
{
|
||||
return "@ "+this.element.width+"x"+this.element.height+" ";
|
||||
}
|
||||
|
||||
// Cursor
|
||||
|
||||
this.drag_from = null;
|
||||
|
||||
this.mouse_down = function(position)
|
||||
{
|
||||
this.drag_from = ronin.position_in_window(position);
|
||||
}
|
||||
|
||||
this.mouse_move = function(position)
|
||||
{
|
||||
if(this.drag_from === null){ return; }
|
||||
|
||||
position = ronin.position_in_window(position);
|
||||
|
||||
var offset_x = this.drag_from.x - position.x;
|
||||
var offset_y = this.drag_from.y - position.y;
|
||||
|
||||
ronin.surface.style.left = ronin.surface.style.left ? parseInt(ronin.surface.style.left) - offset_x : offset_x;
|
||||
ronin.surface.style.top = ronin.surface.style.top ? parseInt(ronin.surface.style.top) - offset_y : offset_y;
|
||||
|
||||
this.drag_from = new Position(position.x,position.y);
|
||||
}
|
||||
|
||||
this.mouse_up = function(event)
|
||||
{
|
||||
this.drag_from = null;
|
||||
}
|
||||
}
|
@@ -24,4 +24,17 @@ function Module(rune)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
this.mouse_down = function(position)
|
||||
{
|
||||
}
|
||||
|
||||
this.mouse_move = function(position)
|
||||
{
|
||||
}
|
||||
|
||||
this.mouse_up = function(position)
|
||||
{
|
||||
}
|
||||
}
|
@@ -118,4 +118,38 @@ function Overlay(rune)
|
||||
{
|
||||
this.context().clearRect(0, 0, ronin.canvas.element.width, ronin.canvas.element.height);
|
||||
}
|
||||
|
||||
// Cursor
|
||||
|
||||
this.live_draw_from = null;
|
||||
|
||||
this.mouse_down = function(position)
|
||||
{
|
||||
ronin.overlay.clear();
|
||||
ronin.overlay.draw_pointer(position);
|
||||
this.live_draw_from = position;
|
||||
commander.show();
|
||||
commander.element_input.focus();
|
||||
commander.element_input.value = "| "+this.live_draw_from.render();
|
||||
}
|
||||
|
||||
this.mouse_move = function(position)
|
||||
{
|
||||
if(this.live_draw_from === null){ return; }
|
||||
|
||||
ronin.overlay.clear();
|
||||
|
||||
var rect = new Rect();
|
||||
rect.width = position.x - this.live_draw_from.x;
|
||||
rect.height = position.y - this.live_draw_from.y;
|
||||
|
||||
ronin.overlay.draw_rect(this.live_draw_from,rect);
|
||||
commander.element_input.value = "| "+this.live_draw_from.render()+" "+rect.render();
|
||||
}
|
||||
|
||||
this.mouse_up = function(position)
|
||||
{
|
||||
this.live_draw_from = null;
|
||||
commander.element_input.focus();
|
||||
}
|
||||
}
|
@@ -24,8 +24,8 @@ function Stroke(rune)
|
||||
for (i = 0; i < this.positions.length; i++) {
|
||||
s += this.positions[i].render()+" ";
|
||||
}
|
||||
if(this.positions.length > 0){ ronin.history.add(s); }
|
||||
this.positions = null;
|
||||
ronin.history.add(s);
|
||||
}
|
||||
|
||||
// Module
|
||||
|
Reference in New Issue
Block a user