From bfaa5310f6fe576e7cf3a75a8ceb6bc877b3067c Mon Sep 17 00:00:00 2001
From: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Tue, 20 Dec 2016 11:53:36 -0700
Subject: [PATCH] Fixed pointer effects

---
 index.html                                  |  2 +-
 scripts/core/{hint.js => commander.hint.js} |  0
 scripts/modules/brush.pointer.js            | 40 ++++++++++++++-------
 scripts/modules/module.js                   |  1 -
 4 files changed, 28 insertions(+), 15 deletions(-)
 rename scripts/core/{hint.js => commander.hint.js} (100%)

diff --git a/index.html b/index.html
index 366009b..c0e30c2 100644
--- a/index.html
+++ b/index.html
@@ -36,8 +36,8 @@
     <script type="text/javascript" src="scripts/core/cursor.js"></script>
     <script type="text/javascript" src="scripts/core/command.js"></script>
     <script type="text/javascript" src="scripts/core/commander.js"></script>
+    <script type="text/javascript" src="scripts/core/commander.hint.js"></script>
     <script type="text/javascript" src="scripts/core/ronin.js"></script>
-    <script type="text/javascript" src="scripts/core/hint.js"></script>
     <script type="text/javascript" src="scripts/core/widget.js"></script>
     
     <link rel="stylesheet" type="text/css" href="links/main.css"/>
diff --git a/scripts/core/hint.js b/scripts/core/commander.hint.js
similarity index 100%
rename from scripts/core/hint.js
rename to scripts/core/commander.hint.js
diff --git a/scripts/modules/brush.pointer.js b/scripts/modules/brush.pointer.js
index 3dec91e..a45a932 100644
--- a/scripts/modules/brush.pointer.js
+++ b/scripts/modules/brush.pointer.js
@@ -7,7 +7,7 @@ function Pointer(offset = new Position(), color = new Color('000000'))
   this.distance = 0;
   
   // Parameters
-  
+
   this.thickness = function()
   {
     var ratio = 10/this.position().distance_to(this.position_prev);
@@ -41,23 +41,15 @@ function Pointer(offset = new Position(), color = new Color('000000'))
   
   this.position = function()
   {
-    if(this.angle){
-      var angle_radian = this.angle.degrees * Math.PI / 180;
-      var deltaX = ronin.brush.position.x - this.offset.x;
-      var deltaY = ronin.brush.position.y - this.offset.y;
-      var t = Math.atan2(deltaY, deltaX) + angle_radian;
-      var radius = ronin.brush.position.distance_to(this.offset);
-      var x = Math.cos(t) * radius;
-      var y = Math.sin(t) * radius;
-      return new Position(x + this.offset.x,y + this.offset.y);
+    if(this.angle && this.offset){
+      return this.position_rotation();
     }
     else if(this.mirror && this.mirror.width > 0){
-      return new Position((2 * this.mirror.width) - (ronin.brush.position.x + this.offset.x), 0 + (ronin.brush.position.y + this.offset.y));
+      return this.position_mirror_x();
     }
     else if(this.mirror && this.mirror.height > 0){
-      return new Position((ronin.brush.position.x + this.offset.x), (2 * this.mirror.height) - (ronin.brush.position.y + this.offset.y));
+      return this.position_mirror_y();
     }
-    
     return this.position_default();
   }
   
@@ -68,6 +60,28 @@ function Pointer(offset = new Position(), color = new Color('000000'))
     return ronin.cursor.position.add(this.offset);
   }
   
+  this.position_mirror_x = function()
+  {
+    return new Position((2 * this.mirror.width) - (ronin.cursor.position.x + this.offset.x), 0 + (ronin.cursor.position.y + this.offset.y));
+  }
+  
+  this.position_mirror_y = function()
+  {
+    return new Position((ronin.cursor.position.x + this.offset.x), (2 * this.mirror.height) - (ronin.cursor.position.y + this.offset.y));
+  }
+  
+  this.position_rotation = function()
+  {
+    var angle_radian = this.angle.degrees * Math.PI / 180;
+    var deltaX = ronin.cursor.position.x - this.offset.x;
+    var deltaY = ronin.cursor.position.y - this.offset.y;
+    var t = Math.atan2(deltaY, deltaX) + angle_radian;
+    var radius = ronin.cursor.position.distance_to(this.offset);
+    var x = Math.cos(t) * radius;
+    var y = Math.sin(t) * radius;
+    return new Position(x + this.offset.x,y + this.offset.y);
+  }
+  
   this.start = function()
   {
   }
diff --git a/scripts/modules/module.js b/scripts/modules/module.js
index d83aabe..63996ac 100644
--- a/scripts/modules/module.js
+++ b/scripts/modules/module.js
@@ -21,7 +21,6 @@ function Module(rune)
       if(!cmd.variable(key)){ continue; }
       this.variables[key] = cmd.variable(key).value;
     }
-    console.log(this.variables);
   }
   
   this.hint = function(cmd)