Getting back to normality

This commit is contained in:
Devine Lu Linvega
2017-05-21 09:26:25 -10:00
parent 84244c1437
commit de175e12e7
11 changed files with 188 additions and 163 deletions

View File

@@ -2,6 +2,7 @@ function Method(name,params,mouse_event)
{
Unit.call(this);
this.host = null;
this.name = name;
this.params = params;
this.mouse_event = mouse_event;
@@ -17,4 +18,25 @@ function Method(name,params,mouse_event)
return s;
}
this.help = function()
{
var s = "";
for(id in this.params){
s += this.params[id]+":"
}
s = s.substr(0,s.length-1);
return s;
}
this.preview = function(cmd)
{
return this.host[this.name](cmd,true);
}
this.run = function(cmd)
{
return this.host[this.name](cmd,false);
}
}

View File

@@ -2,12 +2,13 @@ function Rect(rect_str)
{
Unit.call(this);
this.example = "200x300";
this.rect_str = rect_str;
this.width = rect_str ? parseFloat(this.rect_str.split("x")[0]) : 0;
this.height = rect_str ? parseFloat(this.rect_str.split("x")[1]) : 0;
this.example = "200x300";
this.render = function()
{
return (isNaN(this.width) ? 0 : this.width)+"x"+(isNaN(this.height) ? 0 : this.height);