Improved hints

This commit is contained in:
Devine Lu Linvega 2017-05-24 10:12:16 -10:00
parent 6b7a10686f
commit bd0ea1d46b
7 changed files with 36 additions and 17 deletions

View File

@ -60,10 +60,13 @@ function Module(rune)
}
else{
for(id in this.methods){
html += "<span class='method'>."+this.methods[id].name+"</span> ";
html += this.methods[id]+" ";
}
for(id in this.settings){
html += "<span class='setting'>:"+id+"</span> ";
html += this.settings[id]+" ";
}
for(mode in this.modes){
html += this.modes[mode]+" ";
}
}
@ -150,4 +153,9 @@ function Module(rune)
this.key_arrow_right = function()
{
}
this.toString = function()
{
return "<span class='module'>"+this.name+"</span>";
}
}

View File

@ -2,6 +2,11 @@ function Path(rune)
{
Module.call(this,rune);
this.add_mode(new Mode("stroke"));
this.add_mode(new Mode("arc","shift"));
this.add_mode(new Mode("arc_cc","alt"));
this.add_mode(new Mode("stem","shift_alt"));
this.add_setting(new Setting("fill_color","#ff0000"));
this.add_setting(new Setting("line_width","3"));
this.add_setting(new Setting("line_color","#999"));
@ -99,7 +104,7 @@ function Path(rune)
this.mouse_down = function(position)
{
var method = ronin.terminal.cmd().method().name;
var method = ronin.terminal.cmd().method() ? ronin.terminal.cmd().method().name : "stroke";
var line = "path."+method+" "+this.create_path();
line += "M"+position.render();
ronin.terminal.update(line);

View File

@ -99,16 +99,16 @@ function Source(rune)
html = "";
for(module_id in ronin.modules){
html += "<span class='module'>"+ronin.modules[module_id].name+"</span><br/>";
html += ronin.modules[module_id]+"\n";
for(mode_id in ronin.modules[module_id].modes){
html += " <span class='mode'>~"+(ronin.modules[module_id].modes[mode_id].key ? '['+ronin.modules[module_id].modes[mode_id].key+']' : "")+""+ronin.modules[module_id].modes[mode_id].name+"</span><br />"
html += " "+ronin.modules[module_id].modes[mode_id]+"\n";
}
for(setting_id in ronin.modules[module_id].settings){
html += " <span class='setting'>:"+ronin.modules[module_id].settings[setting_id].name+"</span><br />"
html += " "+ronin.modules[module_id].settings[setting_id]+"\n";
}
for(method_id in ronin.modules[module_id].methods){
html += " <span class='method'>."+ronin.modules[module_id].methods[method_id].name+"</span><br />"
html += " "+ronin.modules[module_id].methods[method_id]+"\n";
}
}

View File

@ -7,16 +7,16 @@ function Method(name,params,mouse_event)
this.params = params;
this.mouse_event = mouse_event;
this.example = "";
this.render = function()
this.toString = function()
{
var s = name+":";
var s = "";
for(param in this.params){
s += this.params[param]+":"
s += this.params[param]+","
}
s = s.substr(0,s.length-1);
return s;
return "<span class='method'>."+this.name+"("+s+")</span>";
}
this.hint = function()

View File

@ -10,4 +10,9 @@ function Mode(name,key = "")
{
return "?";
}
this.toString = function()
{
return "<span class='mode'>~"+this.name+(this.key ? '['+this.key+']' : '')+"</span>"
}
}

View File

@ -11,6 +11,11 @@ function Setting(name,value)
return "?";
}
this.toString = function()
{
return "<span class='setting'>:"+this.name+(this.key ? '['+this.value+']' : '')+"</span>"
}
this.update = function(value)
{
this.value = value;
@ -30,4 +35,5 @@ function Setting(name,value)
{
return new Position(this.value);
}
}

View File

@ -2,9 +2,4 @@ function Unit()
{
this.example = "unknown";
this.name = this.constructor.name;
this.render = function()
{
return "[MISSING]";
}
}