Began working on methods
This commit is contained in:
@@ -79,7 +79,7 @@ function Brush(rune)
|
||||
|
||||
this.mouse_pointer = function(position)
|
||||
{
|
||||
return ronin.cursor.draw_pointer_circle(position,this.settings["size"]);
|
||||
return ronin.cursor.draw_pointer_circle(position,this.settings["size"].float);
|
||||
}
|
||||
|
||||
this.mouse_mode = function()
|
||||
|
||||
@@ -96,7 +96,40 @@ function Cursor(rune)
|
||||
this.pointer_last = this.pointer_last ? this.pointer_last : position;
|
||||
|
||||
this.layer.context().beginPath();
|
||||
this.layer.context().arc(position.x, position.y, 3.5, 0, 2 * Math.PI, false);
|
||||
this.layer.context().moveTo(this.pointer_last.x,this.pointer_last.y);
|
||||
this.layer.context().lineTo(position.x,position.y);
|
||||
this.layer.context().lineCap="round";
|
||||
this.layer.context().lineWidth = 1;
|
||||
this.layer.context().strokeStyle = "white";
|
||||
this.layer.context().stroke();
|
||||
this.layer.context().closePath();
|
||||
|
||||
this.layer.context().beginPath();
|
||||
this.layer.context().arc(position.x, position.y, size+1, 0, 2 * Math.PI, false);
|
||||
this.layer.context().lineWidth = 1;
|
||||
this.layer.context().strokeStyle = "white";
|
||||
this.layer.context().stroke();
|
||||
this.layer.context().closePath();
|
||||
|
||||
this.pointer_last = position;
|
||||
}
|
||||
|
||||
this.draw_pointer_drag = function(position)
|
||||
{
|
||||
if(!this.layer){ this.create_layer(); }
|
||||
|
||||
this.pointer_last = this.pointer_last ? this.pointer_last : position;
|
||||
|
||||
this.layer.context().beginPath();
|
||||
|
||||
this.layer.context().moveTo(position.x,position.y - 3);
|
||||
this.layer.context().lineTo(position.x,position.y + 3);
|
||||
this.layer.context().moveTo(position.x - 2,position.y - 3);
|
||||
this.layer.context().lineTo(position.x - 2,position.y + 3);
|
||||
this.layer.context().moveTo(position.x + 2,position.y - 3);
|
||||
this.layer.context().lineTo(position.x + 2,position.y + 3);
|
||||
|
||||
this.layer.context().lineCap="round";
|
||||
this.layer.context().lineWidth = 1;
|
||||
this.layer.context().strokeStyle = "white";
|
||||
this.layer.context().stroke();
|
||||
|
||||
@@ -9,6 +9,11 @@ function Default(rune)
|
||||
return "Drag";
|
||||
}
|
||||
|
||||
this.mouse_pointer = function(position)
|
||||
{
|
||||
return ronin.cursor.draw_pointer_drag(position);
|
||||
}
|
||||
|
||||
this.drag_from = null;
|
||||
this.drag_offset_x = 0;
|
||||
this.drag_offset_y = 0;
|
||||
|
||||
@@ -3,6 +3,7 @@ function Module(rune)
|
||||
this.rune = rune;
|
||||
this.element = null;
|
||||
this.settings = {};
|
||||
this.methods = {};
|
||||
this.layer = null;
|
||||
|
||||
this.docs = "Missing documentation.";
|
||||
@@ -50,7 +51,10 @@ function Module(rune)
|
||||
var h = "<b>"+ronin.module.constructor.name+"</b> ";
|
||||
|
||||
for(setting in ronin.module.settings){
|
||||
h += setting+":"+ronin.module.settings[setting].render()+" ";
|
||||
h += setting+"="+ronin.module.settings[setting].render()+" ";
|
||||
}
|
||||
for(method in ronin.module.methods){
|
||||
h += ronin.module.methods[method].render()+" ";
|
||||
}
|
||||
|
||||
h += ronin.module.mouse_mode() ? "<i>"+ronin.module.mouse_mode()+"</i>" : "";
|
||||
|
||||
@@ -4,6 +4,7 @@ function Surface(rune)
|
||||
|
||||
this.element = null;
|
||||
this.settings = {"size":new Rect("200x200")};
|
||||
this.methods = {"layer":new Method("layer",["name"])}
|
||||
|
||||
this.layers = {};
|
||||
this.active_layer = null;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
function Layer(name,manager = null)
|
||||
{
|
||||
this.rune = "@";
|
||||
Module.call(this,"#");
|
||||
|
||||
this.name = name;
|
||||
this.manager = manager;
|
||||
this.element = document.createElement("canvas");
|
||||
@@ -68,6 +69,11 @@ function Layer(name,manager = null)
|
||||
return "<span class='"+e_class+"'>"+e_name+"</span>";
|
||||
}
|
||||
|
||||
this.mouse_pointer = function(position)
|
||||
{
|
||||
return ronin.cursor.draw_pointer_drag(position);
|
||||
}
|
||||
|
||||
this.mouse_mode = function()
|
||||
{
|
||||
return "Move";
|
||||
|
||||
@@ -2,8 +2,8 @@ function Typographe(rune)
|
||||
{
|
||||
Module.call(this,rune);
|
||||
|
||||
this.parameters = [Position,Color,Value];
|
||||
this.variables = {"text" : null, "font" : "Georgia"};
|
||||
this.settings = {"color":new Color("#ffffff"),"size":new Value(10)};
|
||||
this.methods = {"draw":new Method("draw",["text","position","font"])}
|
||||
|
||||
this.active = function(cmd)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user