From 941c9d6575489adaeaee9be2f10410b159dba02d Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 15 Nov 2016 17:35:15 -0800 Subject: [PATCH] Added guides to brushes. --- README.md | 8 ++++++++ scripts/ronin.brush.js | 9 +++++++++ scripts/ronin.brush.pointer.js | 4 ++-- scripts/ronin.overlay.js | 4 ++-- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 36d242a..7fa4c12 100644 --- a/README.md +++ b/README.md @@ -79,5 +79,13 @@ $ ! ; Clear temporary storage #Presets ##Radial Brush ``` +# 8 strands > 600,400 45' 3;> 600,400 90' 3;> 600,400 135' 3;> 600,400 180' 3;> 600,400 225' 3;> 600,400 270' 3;> 600,400 315' 3 +# 6 strands +> 600,400 60' 3;> 600,400 120' 3;> 600,400 180' 3;> 600,400 240' 3;> 600,400 300' 3 +``` +##Symmetry Brush +``` +# XY +> 600,400 45' 3 ``` \ No newline at end of file diff --git a/scripts/ronin.brush.js b/scripts/ronin.brush.js index 075cc70..3eec2bc 100644 --- a/scripts/ronin.brush.js +++ b/scripts/ronin.brush.js @@ -43,6 +43,15 @@ function Brush() this.passive = function(cmd) { + if(cmd.rect()){ + var x = isNaN(cmd.rect().width) ? 0 : cmd.rect().width; + var y = isNaN(cmd.rect().height) ? 0 : cmd.rect().height; + var pos = new Position(x+","+y); + ronin.overlay.draw(pos); + } + if(cmd.angle() && cmd.position()){ + ronin.overlay.draw(cmd.position()); + } } this.hint = function(cmd) diff --git a/scripts/ronin.brush.pointer.js b/scripts/ronin.brush.pointer.js index 948a716..9ab650e 100644 --- a/scripts/ronin.brush.pointer.js +++ b/scripts/ronin.brush.pointer.js @@ -55,10 +55,10 @@ function Pointer(offset = new Position(), color = new Color('000000')) return new Position(x + this.offset.x,y + this.offset.y); } else if(this.mirror && this.mirror.width > 0){ - return new Position(this.mirror.width - (ronin.brush.position.x + this.offset.x), 0 + (ronin.brush.position.y + this.offset.y)); + return new Position((2 * this.mirror.width) - (ronin.brush.position.x + this.offset.x), 0 + (ronin.brush.position.y + this.offset.y)); } else if(this.mirror && this.mirror.height > 0){ - return new Position((ronin.brush.position.x + this.offset.x), this.mirror.height - (ronin.brush.position.y + this.offset.y)); + return new Position((ronin.brush.position.x + this.offset.x), (2 * this.mirror.height) - (ronin.brush.position.y + this.offset.y)); } return new Position(ronin.brush.position.x + this.offset.x, ronin.brush.position.y + this.offset.y); } diff --git a/scripts/ronin.overlay.js b/scripts/ronin.overlay.js index b4ec87f..0a562d8 100644 --- a/scripts/ronin.overlay.js +++ b/scripts/ronin.overlay.js @@ -101,8 +101,8 @@ function Overlay(element) { this.context().beginPath(); - this.context().moveTo(position.x,0); - this.context().lineTo(position.x,this.element.height); + this.context().moveTo(0,position.y); + this.context().lineTo(this.element.width,position.y); this.context().lineCap="round"; this.context().lineWidth = 1;