From 741b5c4a5a02447097b1d406c0e2c0750c66e698 Mon Sep 17 00:00:00 2001
From: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Thu, 25 May 2017 08:58:00 -1000
Subject: [PATCH] Improved guides

---
 ...icon.dictionarism.rin => dictionarism.rin} |  0
 scripts/filters/chromatic.js                  |  4 +-
 scripts/modules/cursor.js                     | 89 +++++++------------
 scripts/modules/overlay.js                    | 79 ++++++++++++----
 scripts/modules/render.js                     |  4 +-
 scripts/modules/source.js                     |  2 +-
 scripts/modules/terminal.js                   |  2 +-
 7 files changed, 101 insertions(+), 79 deletions(-)
 rename presets/{grid.icon.dictionarism.rin => dictionarism.rin} (100%)

diff --git a/presets/grid.icon.dictionarism.rin b/presets/dictionarism.rin
similarity index 100%
rename from presets/grid.icon.dictionarism.rin
rename to presets/dictionarism.rin
diff --git a/scripts/filters/chromatic.js b/scripts/filters/chromatic.js
index d901f87..e6f0a5f 100644
--- a/scripts/filters/chromatic.js
+++ b/scripts/filters/chromatic.js
@@ -10,14 +10,14 @@ function Filter_Chromatic()
   {
     var position = cmd.position() ? cmd.position() : new Position(ronin.frame.size.width,ronin.frame.size.height);
     var value = cmd.value() ? cmd.value().float : 5;
+
     this.draw(this.context(),value,position);
   }
 
   this.preview = function(cmd)
   {
     if(cmd.position()){
-      ronin.overlay.clear();
-      ronin.overlay.draw_pointer(cmd.position());
+      ronin.overlay.draw(cmd.position());
     }
   }
 
diff --git a/scripts/modules/cursor.js b/scripts/modules/cursor.js
index f97cfa8..9d37896 100644
--- a/scripts/modules/cursor.js
+++ b/scripts/modules/cursor.js
@@ -15,17 +15,14 @@ function Cursor(rune)
 
   this.update = function(event = null)
   {
-    if(this.is_inside){
-      this.set_mode(ronin.default)
-    }
-    else if(ronin.terminal.cmd().module()){
+    if(ronin.terminal.cmd().module()){
       this.set_mode(ronin.terminal.cmd().module());
     }
     else if(keyboard.shift_held,keyboard.alt_held){
       this.set_mode(ronin.frame.active_layer);
     }
-    else if(event && event.altKey == true){
-      this.set_mode(ronin.default);
+    else if(this.is_inside){
+      this.set_mode(ronin.default)
     }
     else{
       this.set_mode(ronin.brush);
@@ -149,20 +146,16 @@ function Cursor(rune)
     this.layer.context().lineTo(position.x,position.y);
     this.layer.context().lineTo(position.x,position.y + 5);
     
-    this.layer.context().lineCap="round";
-    this.layer.context().lineWidth = 3;
+    this.layer.context().lineCap="square";
+    this.layer.context().lineWidth = 2;
     this.layer.context().strokeStyle = "#000000";
     this.layer.context().stroke();
     
-    // Overlay
-    this.layer.context().moveTo(position.x + 5,position.y);
-    this.layer.context().lineTo(position.x,position.y);
-    this.layer.context().lineTo(position.x,position.y + 5);
-    
     this.layer.context().lineCap="round";
     this.layer.context().lineWidth = 1;
     this.layer.context().strokeStyle = "#ffffff";
     this.layer.context().stroke();
+
     this.layer.context().closePath();
 
     this.pointer_last = position;
@@ -188,10 +181,16 @@ function Cursor(rune)
     this.layer.context().moveTo(position.x + radius,position.y - radius);
     this.layer.context().lineTo(position.x + size,position.y - size);
     
+    this.layer.context().lineCap="square";
+    this.layer.context().lineWidth = 2;
+    this.layer.context().strokeStyle = "#000000";
+    this.layer.context().stroke();
+    
     this.layer.context().lineCap="round";
     this.layer.context().lineWidth = 1;
-    this.layer.context().strokeStyle = "#ff0000";
+    this.layer.context().strokeStyle = "#ffffff";
     this.layer.context().stroke();
+    
     this.layer.context().closePath();
 
     this.pointer_last = position;
@@ -206,11 +205,13 @@ function Cursor(rune)
     this.layer.context().beginPath();
 
     this.layer.context().arc(position.x, position.y, size/2, 0, 2 * Math.PI, false);
-    this.layer.context().lineWidth = 3;
+
+    this.layer.context().lineWidth = 2;
     this.layer.context().strokeStyle = "#000000";
     this.layer.context().stroke();
 
     this.layer.context().arc(position.x, position.y, size/2, 0, 2 * Math.PI, false);
+
     this.layer.context().lineWidth = 1;
     this.layer.context().strokeStyle = ronin.brush.settings["color"].value != "#000000" ? ronin.brush.settings["color"].value : "#ffffff";
     this.layer.context().stroke();
@@ -228,9 +229,17 @@ function Cursor(rune)
 
     this.layer.context().beginPath();
     this.layer.context().arc(position.x, position.y, (size/2), 0, 2 * Math.PI, false);
-    this.layer.context().lineWidth = 1;
-    this.layer.context().strokeStyle = this.settings.color;
+    
+    this.layer.context().lineCap="square";
+    this.layer.context().lineWidth = 2;
+    this.layer.context().strokeStyle = "#000000";
     this.layer.context().stroke();
+    
+    this.layer.context().lineCap="round";
+    this.layer.context().lineWidth = 1;
+    this.layer.context().strokeStyle = "#ffffff";
+    this.layer.context().stroke();
+    
     this.layer.context().closePath();
 
     this.pointer_last = position;
@@ -257,52 +266,16 @@ function Cursor(rune)
     this.layer.context().moveTo(position.x - radius,position.y - radius);
     this.layer.context().lineTo(position.x - radius,position.y + radius);
     
-    this.layer.context().lineCap="round";
-    this.layer.context().lineWidth = 1;
-    this.layer.context().strokeStyle = this.settings.color;
+    this.layer.context().lineCap="square";
+    this.layer.context().lineWidth = 2;
+    this.layer.context().strokeStyle = "#000000";
     this.layer.context().stroke();
-    this.layer.context().closePath();
-
-    this.pointer_last = position;
-  }
-
-  this.draw_pointer = function(position,size = 1)
-  {
-    if(!this.is_inside){ return; }
-    if(!this.layer){ this.create_layer(); }
-
-    this.pointer_last = this.pointer_last ? this.pointer_last : position;
-
-    this.layer.context().beginPath();
-    this.layer.context().moveTo(this.pointer_last.x,this.pointer_last.y);
-    this.layer.context().lineTo(position.x,position.y);
-    this.layer.context().lineCap="round";
-    this.layer.context().lineWidth = 1;
-    this.layer.context().strokeStyle = this.settings.color;
-    this.layer.context().stroke();
-    this.layer.context().closePath();
-
-    this.layer.context().beginPath();
-    this.layer.context().arc(position.x, position.y, 0.5, 0, 2 * Math.PI, false);
-    this.layer.context().fillStyle = this.settings.color;
-    this.layer.context().fill();
-    this.layer.context().closePath();
-
-    this.layer.context().beginPath();
-    
-    this.layer.context().moveTo(position.x + 2,position.y);
-    this.layer.context().lineTo(position.x + 5,position.y);
-    this.layer.context().moveTo(position.x,position.y + 2);
-    this.layer.context().lineTo(position.x,position.y + 5);
-    this.layer.context().moveTo(position.x - 2,position.y);
-    this.layer.context().lineTo(position.x - 5,position.y);
-    this.layer.context().moveTo(position.x,position.y - 2);
-    this.layer.context().lineTo(position.x,position.y - 5);
     
     this.layer.context().lineCap="round";
     this.layer.context().lineWidth = 1;
-    this.layer.context().strokeStyle = this.settings.color;
+    this.layer.context().strokeStyle = "#ffffff";
     this.layer.context().stroke();
+    
     this.layer.context().closePath();
 
     this.pointer_last = position;
diff --git a/scripts/modules/overlay.js b/scripts/modules/overlay.js
index 4cdd816..7134a04 100644
--- a/scripts/modules/overlay.js
+++ b/scripts/modules/overlay.js
@@ -53,20 +53,28 @@ function Overlay(rune)
     this.context().lineTo(position.x-2,position.y + (rect.height/2));
 
     // Center
-    this.context().moveTo(position.x + (rect.width/2) + 3,position.y + (rect.height/2));
-    this.context().lineTo(position.x + (rect.width/2) + 5,position.y + (rect.height/2));
-    this.context().moveTo(position.x + (rect.width/2) - 3,position.y + (rect.height/2));
-    this.context().lineTo(position.x + (rect.width/2) - 5,position.y + (rect.height/2));
+    var radius = 3;
+    var radius_2 = 4;
+    this.context().moveTo(position.x + (rect.width/2) + radius,position.y + (rect.height/2));
+    this.context().lineTo(position.x + (rect.width/2) + radius_2,position.y + (rect.height/2));
+    this.context().moveTo(position.x + (rect.width/2) - radius,position.y + (rect.height/2));
+    this.context().lineTo(position.x + (rect.width/2) - radius_2,position.y + (rect.height/2));
 
-    this.context().moveTo(position.x + (rect.width/2),position.y + (rect.height/2) + 3);
-    this.context().lineTo(position.x + (rect.width/2),position.y + (rect.height/2) + 5);
-    this.context().moveTo(position.x + (rect.width/2),position.y + (rect.height/2) - 3);
-    this.context().lineTo(position.x + (rect.width/2),position.y + (rect.height/2) - 5);
+    this.context().moveTo(position.x + (rect.width/2),position.y + (rect.height/2) + radius);
+    this.context().lineTo(position.x + (rect.width/2),position.y + (rect.height/2) + radius_2);
+    this.context().moveTo(position.x + (rect.width/2),position.y + (rect.height/2) - radius);
+    this.context().lineTo(position.x + (rect.width/2),position.y + (rect.height/2) - radius_2);
     
+    this.context().lineCap="square";
+    this.context().lineWidth = 2;
+    this.context().strokeStyle = "#000000";
+    this.context().stroke();
+
     this.context().lineCap="round";
     this.context().lineWidth = 1;
-    this.context().strokeStyle = ronin.cursor.color;
+    this.context().strokeStyle = "#ffffff";
     this.context().stroke();
+
     this.context().closePath();
   }
   
@@ -83,10 +91,16 @@ function Overlay(rune)
     this.context().moveTo(position.x,position.y - 2);
     this.context().lineTo(position.x,position.y - 5);
     
+    this.context().lineCap="square";
+    this.context().lineWidth = 2;
+    this.context().strokeStyle = "#000000";
+    this.context().stroke();
+
     this.context().lineCap="round";
     this.context().lineWidth = 1;
-    this.context().strokeStyle = ronin.cursor.color;
+    this.context().strokeStyle = "#ffffff";
     this.context().stroke();
+
     this.context().closePath();
   }
   
@@ -97,10 +111,16 @@ function Overlay(rune)
     this.context().moveTo(position.x,position.y);
     this.context().lineTo(to.x,to.y);
     
+    this.context().lineCap="square";
+    this.context().lineWidth = 2;
+    this.context().strokeStyle = "#000000";
+    this.context().stroke();
+
     this.context().lineCap="round";
     this.context().lineWidth = 1;
-    this.context().strokeStyle = ronin.cursor.color;
+    this.context().strokeStyle = "#ffffff";
     this.context().stroke();
+
     this.context().closePath();
   }
 
@@ -108,9 +128,17 @@ function Overlay(rune)
   {
     this.context().beginPath();
     this.context().arc(position.x, position.y, radius, 0, 2 * Math.PI, false);
-    this.context().lineWidth = 1;
-    this.context().strokeStyle = "white";
+
+    this.context().lineCap="square";
+    this.context().lineWidth = 2;
+    this.context().strokeStyle = "#000000"
     this.context().stroke();
+    
+    this.context().lineCap="round";
+    this.context().lineWidth = 1;
+    this.context().strokeStyle = "#ffffff"
+    this.context().stroke();
+
     this.context().closePath();
   }
 
@@ -127,10 +155,16 @@ function Overlay(rune)
     this.context().moveTo(position.x,position.y-(radius-2));
     this.context().lineTo(position.x,position.y-radius);
     
+    this.context().lineCap="square";
+    this.context().lineWidth = 2;
+    this.context().strokeStyle = "#000000"
+    this.context().stroke();
+    
     this.context().lineCap="round";
     this.context().lineWidth = 1;
-    this.context().strokeStyle = ronin.cursor.color;
+    this.context().strokeStyle = "#ffffff"
     this.context().stroke();
+
     this.context().closePath();
   }
   
@@ -141,10 +175,17 @@ function Overlay(rune)
     this.context().moveTo(position.x,0);
     this.context().lineTo(position.x,ronin.frame.size.height);
     
+    this.context().lineCap="square";
+    this.context().lineWidth = 2;
+    this.context().strokeStyle = "#000000"
+    this.context().stroke();
+    
+
     this.context().lineCap="round";
     this.context().lineWidth = 1;
-    this.context().strokeStyle = ronin.cursor.color;
+    this.context().strokeStyle = "#ffffff"
     this.context().stroke();
+    
     this.context().closePath();
   }
   
@@ -155,10 +196,16 @@ function Overlay(rune)
     this.context().moveTo(0,position.y);
     this.context().lineTo(ronin.frame.size.width,position.y);
     
+    this.context().lineCap="square";
+    this.context().lineWidth = 2;
+    this.context().strokeStyle = "#000000"
+    this.context().stroke();
+    
     this.context().lineCap="round";
     this.context().lineWidth = 1;
-    this.context().strokeStyle = ronin.cursor.color;
+    this.context().strokeStyle = "#ffffff"
     this.context().stroke();
+
     this.context().closePath();
   }
 
diff --git a/scripts/modules/render.js b/scripts/modules/render.js
index 3dbced4..4c021f5 100644
--- a/scripts/modules/render.js
+++ b/scripts/modules/render.js
@@ -6,7 +6,7 @@ function Render(rune)
 
   this.add_method(new Method("balance",["color"]));
   this.add_method(new Method("stencil",["angle","color"]));
-  this.add_method(new Method("chromatic",["float"]));
+  this.add_method(new Method("chromatic",["position","float"]));
 
   this.filters["balance"] = new Filter_Balance();
   this.filters["grey"] = new Filter_Grey();
@@ -31,5 +31,7 @@ function Render(rune)
 
     if(preview){ f.preview(cmd); }
     else{ f.render(cmd); }
+
+    return "Done.";
   }
 }
diff --git a/scripts/modules/source.js b/scripts/modules/source.js
index 944802f..221ebc3 100644
--- a/scripts/modules/source.js
+++ b/scripts/modules/source.js
@@ -89,7 +89,7 @@ function Source(rune)
     
     this.layer.remove(this);
 
-    return 1,"Rendered the "+this.settings.format+" image, quality "+this.settings["quality"].to_f()+"."
+    return 1,"Rendered the "+this.settings.format+" image, "+this.settings.quality+"."
   }
 
   this.help = function(params,preview = false)
diff --git a/scripts/modules/terminal.js b/scripts/modules/terminal.js
index 49c9308..4a1caa2 100644
--- a/scripts/modules/terminal.js
+++ b/scripts/modules/terminal.js
@@ -40,7 +40,7 @@ function Terminal(rune)
     }
     if(setting){
       module.settings[setting].update(command.values());
-      this.log(new Log(module,setting+" = "+command.values()));
+      this.log(new Log(module,module.settings[setting]));
     }
     this.hint_element.innerHTML = "";
     this.input.value = "";