diff --git a/README.md b/README.md index 742df93..b571ece 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ $ 3 ; Save to temporary storage, accessible with L > 10 ; Size 10 > -4 ; Eraser, Size 4 > 10,0 ; Add pointer at pos -> -400,0 ; Add mirror pointer, at 400x +> 400x0 ; Add mirror pointer, at 400x > 4 #ff0000 ; Red brush, Size 4 > ? ; Remove last pointer ``` @@ -57,8 +57,13 @@ $ 3 ; Save to temporary storage, accessible with L #Units* ``` -5 ; 5px -5,7 ; 5x 7y -7x9 ; 7w 9h -{5h - 5s} ; 5% of canvas width, minus brush speed +5 ; value: 5 +5,7 ; position: 5x 7y +7x9 ; rect: 7w 9h +#ff0000 ; color: red ``` + +- Mirror +- Filter +- Noise +- diff --git a/scripts/ronin.brush.js b/scripts/ronin.brush.js index 3377c76..407828f 100644 --- a/scripts/ronin.brush.js +++ b/scripts/ronin.brush.js @@ -12,8 +12,15 @@ function Brush() this.active = function(cmd) { + var pointer = new Pointer(); + if(cmd.position()){ - var pointer = new Pointer(cmd.position()); + pointer.position = cmd.position(); + } + if(cmd.rect()){ + pointer.mirror = cmd.rect(); + } + if(cmd.rect() || cmd.position()){ this.add_pointer(pointer); } if(cmd.color()){ @@ -33,8 +40,9 @@ function Brush() var hint_value = (cmd.value() ? "Size "+cmd.value()+" " : ""); var hint_position = (cmd.position() ? "Position "+cmd.position().x+","+cmd.position().y+" " : ""); var hint_color = (cmd.color() ? "Color "+cmd.color().hex+" " : ""); + var hint_rect = (cmd.rect() ? "Mirror "+cmd.rect().width+"/"+cmd.rect().height+" " : ""); - return "Brush: "+hint_value+hint_position+hint_color; + return "Brush: "+hint_value+hint_position+hint_color+hint_rect; } this.pointers = [new Pointer(new Position())]; diff --git a/scripts/ronin.brush.pointer.js b/scripts/ronin.brush.pointer.js index 45493ab..6559010 100644 --- a/scripts/ronin.brush.pointer.js +++ b/scripts/ronin.brush.pointer.js @@ -35,11 +35,11 @@ function Pointer(offset = new Position(), color = new Color('000000')) this.position = function() { - if(this.mirror && this.mirror.x > 0){ - return new Position(this.mirror.x - (brush.position.x + this.offset.x), 0 + (brush.position.y + this.offset.y)); + 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)); } - else if(this.mirror && this.mirror.y > 0){ - return new Position((brush.position.x + this.offset.x), this.mirror.y - (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, ronin.brush.position.y + this.offset.y); }