Display a guide for the mirror brush
This commit is contained in:
parent
25aff03ccf
commit
d6c2c776a7
@ -19,6 +19,13 @@ function Guide()
|
||||
if(this.inspect){
|
||||
this.draw_inspector();
|
||||
}
|
||||
|
||||
// Brush mirrors
|
||||
for(id in ronin.brush.pointers){
|
||||
var pointer = ronin.brush.pointers[id];
|
||||
if(!pointer.options.mirror){ continue; }
|
||||
units.push({x1:pointer.options.mirror.x,y1:0,x2:pointer.options.mirror.x,y2:ronin.frame.height})
|
||||
}
|
||||
|
||||
if(units.length == 0){ return; }
|
||||
|
||||
@ -29,6 +36,10 @@ function Guide()
|
||||
|
||||
this.draw = function(u = null)
|
||||
{
|
||||
if(u && u.x1 != null && u.y1 != null && u.x2 != null && u.y2 != null){
|
||||
this.draw_line({x:u.x1,y:u.y1},{x:u.x2,y:u.y2})
|
||||
}
|
||||
|
||||
if(u && u.x && u.y){
|
||||
this.draw_pos(u);
|
||||
}
|
||||
|
@ -5,8 +5,7 @@ function Brush()
|
||||
this.settings = {size:4,color:"#000"};
|
||||
|
||||
this.pointers = [
|
||||
new Pointer({offset:{x:0,y:0}}),
|
||||
new Pointer({offset:{x:0,y:0},mirror:{x:400,y:0}})
|
||||
new Pointer({offset:{x:0,y:0}})
|
||||
];
|
||||
|
||||
this.ports.speed = new Port(this,"speed",false,true,0,50,"The cursor speed");
|
||||
@ -109,8 +108,8 @@ function Pointer(options)
|
||||
var ctx = ronin.render.context();
|
||||
|
||||
if(this.options.mirror){
|
||||
line.from.x = this.options.mirror.x - line.from.x;
|
||||
line.to.x = this.options.mirror.x - line.to.x;
|
||||
line.from.x = (this.options.mirror.x *2) - line.from.x;
|
||||
line.to.x = (this.options.mirror.x*2) - line.to.x;
|
||||
}
|
||||
|
||||
ctx.beginPath();
|
||||
|
Loading…
x
Reference in New Issue
Block a user