Added rotation filter

This commit is contained in:
Devine Lu Linvega
2016-12-29 14:18:55 -07:00
parent ded226c16f
commit 782032e6b2
8 changed files with 92 additions and 45 deletions

View File

@@ -27,7 +27,39 @@ function Module(rune)
this.hint = function(cmd)
{
return "unknown";
var s = this.pad(cmd.content.join(" "));
s += cmd.content.join(" ").length == 0 ? "<span class='module'>"+this.constructor.name+"</span>" : "";
// Params
var e = 0;
while(e < 10){
if(!this.parameters[e]){ break; }
var param_name = this.parameters[e].name;
s += cmd[param_name.toLowerCase()]() ? "" : "<span class='param'>"+param_name+"</span>";
e += 1;
}
// Variables
if(this.variables){
for (var key in this.variables){
if(cmd.variable(key)){continue;}
s += "<span class='variable_key'>"+key+"</span>=<span class='variable_value'>"+this.variables[key]+"</span> ";
}
}
return s;
}
this.pad = function(input)
{
var s = "";
for (i = 0; i < input.length+2; i++){
s += "_";
}
return "<span style='color:#000'>"+s+"</span>";
}
this.widget = function()

View File

@@ -6,14 +6,13 @@ function Render(rune)
this.collection = {};
this.collection["stencil"] = new Filter_Stencil();
this.collection["rotate"] = new Filter_Rotate();
this.active = function(cmd)
{
var name = cmd.content[0];
if(!this.collection[name]){ console.log("Unknown filter:"+name); return; }
cmd.content.shift();
if(!this.collection[name]){ return; }
return this.collection[name].render(cmd);
}
@@ -21,11 +20,8 @@ function Render(rune)
this.passive = function(cmd)
{
var name = cmd.content[0];
if(!this.collection[name]){ console.log("Unknown filter:"+name); return; }
if(!this.collection[name]){ return; }
cmd.content.shift();
console.log(name);
return this.collection[name].preview(cmd);
}

View File

@@ -52,8 +52,8 @@ function Stroke(rune)
ronin.surface.context().moveTo(pos1.x,pos1.y);
ronin.surface.context().lineTo(pos2.x,pos2.y);
ronin.surface.context().lineCap="round";
ronin.surface.context().lineWidth = 1;
ronin.surface.context().strokeStyle = new Color("#ff0000").rgba();
ronin.surface.context().lineWidth = 10;
ronin.surface.context().strokeStyle = ronin.brush.color.rgba();
ronin.surface.context().stroke();
ronin.surface.context().closePath();
}