From bd0ea1d46b4f377a7d8fb034593ffe938a959633 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 24 May 2017 10:12:16 -1000 Subject: [PATCH] Improved hints --- scripts/modules/module.js | 12 ++++++++++-- scripts/modules/path.js | 7 ++++++- scripts/modules/source.js | 8 ++++---- scripts/units/method.js | 10 +++++----- scripts/units/mode.js | 5 +++++ scripts/units/setting.js | 6 ++++++ scripts/units/unit.js | 5 ----- 7 files changed, 36 insertions(+), 17 deletions(-) diff --git a/scripts/modules/module.js b/scripts/modules/module.js index 71884c8..2419c5e 100644 --- a/scripts/modules/module.js +++ b/scripts/modules/module.js @@ -60,10 +60,13 @@ function Module(rune) } else{ for(id in this.methods){ - html += "."+this.methods[id].name+" "; + html += this.methods[id]+" "; } for(id in this.settings){ - html += ":"+id+" "; + 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 ""+this.name+""; + } } \ No newline at end of file diff --git a/scripts/modules/path.js b/scripts/modules/path.js index 525ede7..6e82b9a 100644 --- a/scripts/modules/path.js +++ b/scripts/modules/path.js @@ -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); diff --git a/scripts/modules/source.js b/scripts/modules/source.js index 1c39215..a6404c4 100644 --- a/scripts/modules/source.js +++ b/scripts/modules/source.js @@ -99,16 +99,16 @@ function Source(rune) html = ""; for(module_id in ronin.modules){ - html += ""+ronin.modules[module_id].name+"
"; + html += ronin.modules[module_id]+"\n"; for(mode_id in ronin.modules[module_id].modes){ - html += " ~"+(ronin.modules[module_id].modes[mode_id].key ? '['+ronin.modules[module_id].modes[mode_id].key+']' : "")+""+ronin.modules[module_id].modes[mode_id].name+"
" + html += " "+ronin.modules[module_id].modes[mode_id]+"\n"; } for(setting_id in ronin.modules[module_id].settings){ - html += " :"+ronin.modules[module_id].settings[setting_id].name+"
" + html += " "+ronin.modules[module_id].settings[setting_id]+"\n"; } for(method_id in ronin.modules[module_id].methods){ - html += " ."+ronin.modules[module_id].methods[method_id].name+"
" + html += " "+ronin.modules[module_id].methods[method_id]+"\n"; } } diff --git a/scripts/units/method.js b/scripts/units/method.js index f268183..cb958c9 100644 --- a/scripts/units/method.js +++ b/scripts/units/method.js @@ -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 "."+this.name+"("+s+")"; } this.hint = function() diff --git a/scripts/units/mode.js b/scripts/units/mode.js index 10deec9..83a1d95 100644 --- a/scripts/units/mode.js +++ b/scripts/units/mode.js @@ -10,4 +10,9 @@ function Mode(name,key = "") { return "?"; } + + this.toString = function() + { + return "~"+this.name+(this.key ? '['+this.key+']' : '')+"" + } } \ No newline at end of file diff --git a/scripts/units/setting.js b/scripts/units/setting.js index 58d233d..5545596 100644 --- a/scripts/units/setting.js +++ b/scripts/units/setting.js @@ -11,6 +11,11 @@ function Setting(name,value) return "?"; } + this.toString = function() + { + return ":"+this.name+(this.key ? '['+this.value+']' : '')+"" + } + this.update = function(value) { this.value = value; @@ -30,4 +35,5 @@ function Setting(name,value) { return new Position(this.value); } + } \ No newline at end of file diff --git a/scripts/units/unit.js b/scripts/units/unit.js index 937d3a4..2468958 100644 --- a/scripts/units/unit.js +++ b/scripts/units/unit.js @@ -2,9 +2,4 @@ function Unit() { this.example = "unknown"; this.name = this.constructor.name; - - this.render = function() - { - return "[MISSING]"; - } } \ No newline at end of file