Removed old render()
This commit is contained in:
@@ -5,13 +5,13 @@ function Brush(rune)
|
||||
this.pointers = [new Pointer(new Position("0,0"))];
|
||||
|
||||
this.add_mode(new Mode("paint"));
|
||||
this.add_mode(new Mode("erase","alt"));
|
||||
this.add_setting(new Setting("color","#00ff00"));
|
||||
this.add_mode(new Mode("erase","shift"));
|
||||
this.add_setting(new Setting("color","#000000"));
|
||||
this.add_setting(new Setting("size","2"));
|
||||
this.add_method(new Method("add_pointer",["Position","Color","Scale","mirror_x","mirror_y"]));
|
||||
this.add_method(new Method("add",["Position","Color","Scale","mirror_x","mirror_y"]));
|
||||
this.add_method(new Method("clear"));
|
||||
|
||||
this.add_pointer = function(cmd, preview = false)
|
||||
this.add = function(cmd, preview = false)
|
||||
{
|
||||
if(cmd.option("mirror_x")){
|
||||
var mirror_x = parseFloat(cmd.option("mirror_x").value);
|
||||
@@ -36,12 +36,12 @@ function Brush(rune)
|
||||
|
||||
this.pointers.push(pointer);
|
||||
|
||||
ronin.terminal.log(new Log(this,"Added pointer at: "+pointer.offset.render()));
|
||||
ronin.terminal.log(new Log(this,"Added pointer at: "+pointer.offset.toString()));
|
||||
|
||||
return 1, "ok";
|
||||
}
|
||||
|
||||
this.clear = function()
|
||||
this.remove = function()
|
||||
{
|
||||
this.pointers = [];
|
||||
return 1,"Removed all pointers.";
|
||||
|
||||
@@ -141,6 +141,6 @@ function Pointer(offset = new Position(), color = null, scale = 1)
|
||||
|
||||
this.widget = function()
|
||||
{
|
||||
return this.offset.render();
|
||||
return this.offset.toString();
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,12 @@ function Cursor(rune)
|
||||
if(this.is_inside){
|
||||
this.set_mode(ronin.default)
|
||||
}
|
||||
else if(keyboard.shift_held,keyboard.alt_held){
|
||||
this.set_mode(ronin.frame.active_layer);
|
||||
}
|
||||
else if(ronin.terminal.cmd().module()){
|
||||
this.set_mode(ronin.terminal.cmd().module());
|
||||
}
|
||||
else if(keyboard.shift_held,keyboard.alt_held){
|
||||
this.set_mode(ronin.frame.active_layer);
|
||||
}
|
||||
else if(event && event.altKey == true){
|
||||
this.set_mode(ronin.default);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ function Eye(rune)
|
||||
{
|
||||
var pixel = ronin.frame.context().getImageData(position.x*2, position.y*2, 1, 1).data;
|
||||
var hex = new Color().rgb_to_hex({r:pixel[0],g:pixel[1],b:pixel[2]});
|
||||
ronin.terminal.log(new Log(this,"Color at "+position.render()+" is "+hex));
|
||||
ronin.terminal.log(new Log(this,"Color at "+position.toString()+" is "+hex));
|
||||
}
|
||||
|
||||
// Mouse
|
||||
|
||||
@@ -57,7 +57,7 @@ function Frame(rune)
|
||||
|
||||
this.size = rect;
|
||||
|
||||
return 1, "Resized to "+this.size.render();
|
||||
return 1, "Resized to "+this.size.toString();
|
||||
}
|
||||
|
||||
this.select = function(cmd, preview = false)
|
||||
@@ -149,9 +149,9 @@ function Frame(rune)
|
||||
|
||||
this.mouse_up = function(position,rect)
|
||||
{
|
||||
ronin.overlay.draw(this.mouse_from,rect)+" "+rect.render();
|
||||
ronin.overlay.draw(this.mouse_from,rect)+" "+rect.toString();
|
||||
|
||||
var line = "frame.resize "+this.mouse_from.render()+" "+rect.render();
|
||||
var line = "frame.resize "+this.mouse_from.toString()+" "+rect.toString();
|
||||
ronin.terminal.update(line);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ function Frame(rune)
|
||||
{
|
||||
var html = ""
|
||||
|
||||
html += this.size.render()+" ";
|
||||
html += this.size.toString()+" ";
|
||||
html += this.active_layer.name+" ";
|
||||
|
||||
var user_layers = 0;
|
||||
|
||||
@@ -84,16 +84,6 @@ function Layer(name,manager = null)
|
||||
return 1, "ok";
|
||||
}
|
||||
|
||||
this.rename = function(params, preview = false)
|
||||
{
|
||||
if(preview){ return; }
|
||||
|
||||
// TODO
|
||||
// ronin.frame.layers[params.text()] = this;
|
||||
// ronin.frame.layers[this.name] = null;
|
||||
ronin.terminal.log(new Log(this,"Renamed layer "+this.name+" to "+params.text()));
|
||||
}
|
||||
|
||||
this.clear = function(params, preview = false)
|
||||
{
|
||||
if(preview){ return; }
|
||||
|
||||
@@ -4,6 +4,7 @@ function Magnet(rune)
|
||||
|
||||
this.add_setting(new Setting("grid","1x1"));
|
||||
this.add_setting(new Setting("marker","4,4"));
|
||||
this.add_setting(new Setting("color","#000000"));
|
||||
|
||||
this.add_method(new Method("grid",["rect","position"]));
|
||||
|
||||
@@ -17,8 +18,8 @@ function Magnet(rune)
|
||||
this.draw_grid(cmd.rect(),cmd.position());
|
||||
|
||||
if(preview == false){
|
||||
this.settings["grid"].update(cmd.rect().render());
|
||||
this.settings["marker"].update(cmd.position().render());
|
||||
if(cmd.rect()){ this.settings["grid"].update(cmd.rect().toString());}
|
||||
if(cmd.position()){ this.settings["marker"].update(cmd.position().toString());}
|
||||
}
|
||||
|
||||
return 1, preview ? "preview" : "ok";
|
||||
@@ -29,8 +30,8 @@ function Magnet(rune)
|
||||
if(!rect){ rect = new Rect("20x20"); }
|
||||
if(!grid){ grid = new Position("4,4"); }
|
||||
|
||||
this.settings["grid"].update(rect.render());
|
||||
this.settings["marker"].update(grid.render());
|
||||
this.settings["grid"].update(rect.toString());
|
||||
this.settings["marker"].update(grid.toString());
|
||||
|
||||
if(rect.width < 5 || rect.height < 5){ return; }
|
||||
|
||||
@@ -54,7 +55,7 @@ function Magnet(rune)
|
||||
var magnetized = this.magnetic_position(position);
|
||||
this.context().beginPath();
|
||||
this.context().arc(magnetized.x, magnetized.y, 4, 0, 2 * Math.PI, false);
|
||||
this.context().strokeStyle = 'white';
|
||||
this.context().strokeStyle = this.settings["color"].value;
|
||||
this.context().stroke();
|
||||
this.context().closePath();
|
||||
}
|
||||
@@ -63,7 +64,7 @@ function Magnet(rune)
|
||||
{
|
||||
this.context().beginPath();
|
||||
this.context().arc(position.x, position.y, size, 0, 2 * Math.PI, false);
|
||||
this.context().fillStyle = 'white';
|
||||
this.context().fillStyle = this.settings["color"].value;
|
||||
this.context().fill();
|
||||
this.context().closePath();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ function Path(rune)
|
||||
|
||||
this.add_setting(new Setting("fill_color","#ff0000"));
|
||||
this.add_setting(new Setting("line_width","3"));
|
||||
this.add_setting(new Setting("line_color","#999"));
|
||||
this.add_setting(new Setting("line_color","#ffffff"));
|
||||
this.add_setting(new Setting("line_cap","square"));
|
||||
|
||||
this.add_method(new Method("stroke",["Positions"],"Add point"));
|
||||
@@ -106,7 +106,7 @@ function Path(rune)
|
||||
{
|
||||
var method = ronin.terminal.cmd().method() ? ronin.terminal.cmd().method().name : "stroke";
|
||||
var line = "path."+method+" "+this.create_path();
|
||||
line += "M"+position.render();
|
||||
line += "M"+position.toString();
|
||||
ronin.terminal.update(line);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ function Path(rune)
|
||||
{
|
||||
var method = ronin.terminal.cmd().method().name;
|
||||
var line = "path."+method+" "+this.create_path();
|
||||
line += "L"+position.render();
|
||||
line += "L"+position.toString();
|
||||
ronin.terminal.update(line);
|
||||
}
|
||||
|
||||
@@ -123,22 +123,22 @@ function Path(rune)
|
||||
var method = ronin.terminal.cmd().method().name;
|
||||
|
||||
if(this.coordinates.length == 0){
|
||||
this.coordinates.push("M"+position.render());
|
||||
this.coordinates.push("M"+position.toString());
|
||||
}
|
||||
else{
|
||||
var offset = this.last_pos ? position.offset(this.last_pos) : position;
|
||||
|
||||
if(keyboard.shift_held == true && keyboard.alt_held == true){
|
||||
this.coordinates.push("M"+position.render());
|
||||
this.coordinates.push("M"+position.toString());
|
||||
}
|
||||
else if(keyboard.shift_held == true){
|
||||
this.coordinates.push("a"+offset.render()+" 0 0,1 "+offset.render());
|
||||
this.coordinates.push("a"+offset.toString()+" 0 0,1 "+offset.toString());
|
||||
}
|
||||
else if(keyboard.alt_held == true){
|
||||
this.coordinates.push("a"+offset.render()+" 0 0,0 "+offset.render());
|
||||
this.coordinates.push("a"+offset.toString()+" 0 0,0 "+offset.toString());
|
||||
}
|
||||
else{
|
||||
this.coordinates.push("l"+offset.render());
|
||||
this.coordinates.push("l"+offset.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ function Source(rune)
|
||||
ronin.source.unlock();
|
||||
}
|
||||
|
||||
return 1,"Loaded "+params.filepath().path+" at "+position.render();
|
||||
return 1,"Loaded "+params.filepath().path+" at "+position.toString();
|
||||
}
|
||||
|
||||
this.save = function(params,preview = false)
|
||||
|
||||
@@ -27,7 +27,7 @@ function Type(rune)
|
||||
|
||||
if(!preview){ this.layer.remove(this); }
|
||||
|
||||
return 1, "Wrote "+text+" at "+position.render();
|
||||
return 1, "Wrote "+text+" at "+position.toString();
|
||||
}
|
||||
|
||||
// Mouse
|
||||
@@ -40,7 +40,7 @@ function Type(rune)
|
||||
this.mouse_down = function(position)
|
||||
{
|
||||
var str = ronin.terminal.cmd().text() ? ronin.terminal.cmd().text() : "Placeholder";
|
||||
var line = "type.write "+position.render()+" \""+str+"\"";
|
||||
var line = "type.write "+position.toString()+" \""+str+"\"";
|
||||
ronin.terminal.update(line);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ function Type(rune)
|
||||
this.mouse_up = function(position)
|
||||
{
|
||||
var str = ronin.terminal.cmd().text() ? ronin.terminal.cmd().text() : "Placeholder";
|
||||
var line = "type.write "+position.render()+" \""+str+"\"";
|
||||
var line = "type.write "+position.toString()+" \""+str+"\"";
|
||||
ronin.terminal.update(line);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ function Angle(angle_str = "0'")
|
||||
|
||||
this.degrees = parseFloat(angle_str.replace('\'',''));
|
||||
|
||||
this.render = function()
|
||||
this.toString = function()
|
||||
{
|
||||
return this.degrees+"'";
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ function Any(str)
|
||||
this.example = "";
|
||||
this.string = str;
|
||||
|
||||
this.render = function()
|
||||
this.toString = function()
|
||||
{
|
||||
return this.string;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ function Bang()
|
||||
|
||||
this.example = "";
|
||||
|
||||
this.render = function()
|
||||
this.toString = function()
|
||||
{
|
||||
return "BANG";
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ function Color(hex = '#000000')
|
||||
return { r:rgb.r/255, g:rgb.g/255, b:rgb.b/255 }
|
||||
}
|
||||
|
||||
this.render = function()
|
||||
this.toString = function()
|
||||
{
|
||||
return this.hex;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ function Filepath(path_str)
|
||||
this.example = "assets/demo.png";
|
||||
this.path = path_str;
|
||||
|
||||
this.render = function()
|
||||
this.toString = function()
|
||||
{
|
||||
return this.path;
|
||||
}
|
||||
|
||||
@@ -6,11 +6,6 @@ function Mode(name,key = "")
|
||||
this.name = name;
|
||||
this.key = key;
|
||||
|
||||
this.render = function()
|
||||
{
|
||||
return "?";
|
||||
}
|
||||
|
||||
this.toString = function()
|
||||
{
|
||||
return "<span class='mode'>~"+this.name+(this.key ? '['+this.key+']' : '')+"</span>"
|
||||
|
||||
@@ -40,7 +40,7 @@ function Position(position_str = "0,0",y = null)
|
||||
}
|
||||
}
|
||||
|
||||
this.render = function()
|
||||
this.toString = function()
|
||||
{
|
||||
return (isNaN(this.x) ? 0 : this.x)+","+(isNaN(this.y) ? 0 : this.y);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ function Range(range_str)
|
||||
this.from = parseFloat(this.range_str.split("..")[0]);
|
||||
this.to = parseFloat(this.range_str.split("..")[1]);
|
||||
|
||||
this.render = function()
|
||||
this.toString = function()
|
||||
{
|
||||
return this.from+".."+this.to;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ function Rect(rect_str)
|
||||
|
||||
this.example = "200x300";
|
||||
|
||||
this.render = function()
|
||||
this.toString = function()
|
||||
{
|
||||
return (isNaN(this.width) ? 0 : this.width)+"x"+(isNaN(this.height) ? 0 : this.height);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ function Setting(name,value)
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
|
||||
this.render = function()
|
||||
this.toString = function()
|
||||
{
|
||||
return "?";
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ function Value(value_str)
|
||||
this.float = parseFloat(this.value);
|
||||
this.int = parseInt(this.value);
|
||||
|
||||
this.render = function()
|
||||
this.toString = function()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user