Implemented brush mirror.
This commit is contained in:
@@ -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())];
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user