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{ else{
for(id in this.methods){ for(id in this.methods){
html += "<span class='method'>."+this.methods[id].name+"</span> "; html += this.methods[id]+" ";
} }
for(id in this.settings){ 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.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); 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("fill_color","#ff0000"));
this.add_setting(new Setting("line_width","3")); this.add_setting(new Setting("line_width","3"));
this.add_setting(new Setting("line_color","#999")); this.add_setting(new Setting("line_color","#999"));
@ -99,7 +104,7 @@ function Path(rune)
this.mouse_down = function(position) 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(); var line = "path."+method+" "+this.create_path();
line += "M"+position.render(); line += "M"+position.render();
ronin.terminal.update(line); ronin.terminal.update(line);

View File

@ -99,16 +99,16 @@ function Source(rune)
html = ""; html = "";
for(module_id in ronin.modules){ 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){ 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){ 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){ 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

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

View File

@ -10,4 +10,9 @@ function Mode(name,key = "")
{ {
return "?"; 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 "?"; return "?";
} }
this.toString = function()
{
return "<span class='setting'>:"+this.name+(this.key ? '['+this.value+']' : '')+"</span>"
}
this.update = function(value) this.update = function(value)
{ {
this.value = value; this.value = value;
@ -30,4 +35,5 @@ function Setting(name,value)
{ {
return new Position(this.value); return new Position(this.value);
} }
} }

View File

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