From a0e557d24381b81828cf8b927301857f257d6ab7 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 28 Mar 2017 14:00:20 -0700 Subject: [PATCH] Completed Path --- scripts/modules/cursor.js | 1 - scripts/modules/module.js | 19 +------------------ scripts/modules/path.js | 18 ++++++++++++------ 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/scripts/modules/cursor.js b/scripts/modules/cursor.js index dfce4df..fa06e79 100644 --- a/scripts/modules/cursor.js +++ b/scripts/modules/cursor.js @@ -161,7 +161,6 @@ function Cursor(rune) this.mode.mouse_from = this.position; this.mode.mouse_held = true; this.mode.mouse_down(this.position); - console.log(this.mode) } ronin.terminal.update_hint(); diff --git a/scripts/modules/module.js b/scripts/modules/module.js index 0c9d83d..508e328 100644 --- a/scripts/modules/module.js +++ b/scripts/modules/module.js @@ -51,23 +51,6 @@ function Module(rune) ronin.terminal.log(new Log(this,"Unknown setting: "+key)); } - this.run_methods = function(cmd) - { - var methods = cmd.methods(); - for(i in methods){ - var content = methods[i].split(":"); - var name = content.shift(); - var params = content; - if(this[name]){ - this[name](params); - } - else{ - ronin.terminal.log(new Log(this,name+" is not a method of "+this.constructor.name,"error")); - } - - } - } - this.add_method = function(method) { this.methods[method.name] = method; @@ -83,7 +66,7 @@ function Module(rune) if(this.methods[method_name]){ s = this.methods[method_name].params; - s += this.methods[method_name].mouse_event ? "["+this.methods[method_name].mouse_event+"] " : ""; + s += this.methods[method_name].mouse_event ? " "+this.methods[method_name].mouse_event+" " : ""; } else{ for(method in this.methods){ diff --git a/scripts/modules/path.js b/scripts/modules/path.js index 1fff675..cd4402f 100644 --- a/scripts/modules/path.js +++ b/scripts/modules/path.js @@ -17,10 +17,13 @@ function Path(rune) if(!ronin.path.layer){ ronin.path.create_layer(); ronin.path.layer.is_blinking = true; } this.layer.clear(); - this.layer.context().lineCap = this.settings["line_cap"]; - this.layer.context().lineWidth = this.settings["line_width"]; - this.layer.context().strokeStyle = this.settings["line_color"]; - ronin.path.layer.context().stroke(new Path2D(params.content)); + + var target_layer = preview ? this.layer : ronin.frame.active_layer; + + target_layer.context().lineCap = this.settings["line_cap"]; + target_layer.context().lineWidth = this.settings["line_width"]; + target_layer.context().strokeStyle = this.settings["line_color"]; + target_layer.context().stroke(new Path2D(params.content)); } this.fill = function(params,preview = false) @@ -28,9 +31,12 @@ function Path(rune) if(!ronin.path.layer){ ronin.path.create_layer(); ronin.path.layer.is_blinking = true; } this.layer.clear(); - this.layer.context().fillStyle = this.settings["fill_color"]; - ronin.path.layer.context().fill(new Path2D(params.content)); + var target_layer = preview ? this.layer : ronin.frame.active_layer; + + target_layer.context().fillStyle = this.settings["fill_color"]; + + target_layer.context().fill(new Path2D(params.content)); } // Tools