This commit is contained in:
Devine Lu Linvega 2018-01-26 15:59:24 +13:00
parent e51568f631
commit 1c1fb8d75d
5 changed files with 19 additions and 17 deletions
sources

@ -12,7 +12,6 @@
<script type="text/javascript" src="scripts/modules/line.js"></script>
<script type="text/javascript" src="scripts/modules/io.js"></script>
<script type="text/javascript" src="scripts/modules/path.js"></script>
<script type="text/javascript" src="scripts/modules/magnet.js"></script>
<script type="text/javascript" src="scripts/modules/filter.js"></script>
<script type="text/javascript" src="scripts/modules/type.js"></script>

@ -6,7 +6,7 @@ canvas { cursor: none }
yu { display:block; }
#cursor { z-index:899; position: absolute; }
#guide { z-index:810;position: absolute; display: none}
#guide { z-index:810;position: absolute; transition: opacity 250ms; opacity: 0}
#above { z-index:800; position: absolute; }
#below { z-index:799; position: absolute; }

@ -45,8 +45,7 @@ function Cursor(rune)
pos.x -= (ronin.frame.zoom.offset.x / ronin.frame.zoom.scale);
pos.y -= (ronin.frame.zoom.offset.y / ronin.frame.zoom.scale);
var magnet_pos = ronin.magnet.filter({x:pos.x,y:pos.y});
return magnet_pos;
return pos;
}
this.mouse_down = function(e)

@ -3,17 +3,12 @@ function Guide()
Layer.call(this);
this.el.id = "guide";
this.inspect = false;
this.inspect = true;
this.update = function()
{
this.clear();
this.el.width = window.innerWidth * 2;
this.el.height = window.innerHeight * 2;
this.el.style.width = (window.innerWidth)+"px";
this.el.style.height = (window.innerHeight)+"px";
var units = this.find_units();
if(this.inspect){
@ -38,6 +33,11 @@ function Guide()
}
}
this.toggle = function()
{
this.el.style.opacity = this.el.style.opacity == 0 ? 1 : 0
}
this.toggle_color_picker = function(show)
{
if(!show){ return; }
@ -105,7 +105,7 @@ function Guide()
ctx.moveTo(u1.x * 2,u1.y * 2);
ctx.lineTo(u2.x * 2,u2.y * 2);
ctx.lineCap="round";
ctx.lineWidth = 2;
ctx.lineWidth = 0.5;
ctx.strokeStyle = color;
ctx.stroke();
ctx.closePath();
@ -159,15 +159,16 @@ function Guide()
this.draw_inspector = function()
{
this.draw_line({x:ronin.frame.width/2,y:0},{x:ronin.frame.width/2,y:ronin.frame.height},"red");
this.draw_line({x:0,y:ronin.frame.height/2},{x:ronin.frame.width,y:ronin.frame.height/2},"red");
var color = "black"
this.draw_line({x:ronin.frame.width/2,y:0},{x:ronin.frame.width/2,y:ronin.frame.height},color);
this.draw_line({x:0,y:ronin.frame.height/2},{x:ronin.frame.width,y:ronin.frame.height/2},color);
var ctx = this.context();
var w = ronin.frame.width * 2;
var h = ronin.frame.height * 2;
var angle = parseInt(ronin.commander.query().methods.inspect) > 0 ? parseInt(ronin.commander.query().methods.inspect) : 0;
var color = "red"
var angle = 45;
ctx.translate(w/2,h/2);

@ -19,7 +19,6 @@ function Ronin()
this.brush = new Brush();
this.frame = new Frame();
this.path = new Path();
this.magnet = new Magnet();
this.filter = new Filter();
this.type = new Type();
@ -28,6 +27,7 @@ function Ronin()
above : this.above,
below : this.below,
cursor : this.cursor,
guide : this.guide,
};
this.modules = {
@ -35,7 +35,6 @@ function Ronin()
frame : this.frame,
io : this.io,
path : this.path,
magnet : this.magnet,
filter : this.filter,
type : this.type
};
@ -56,6 +55,9 @@ function Ronin()
this.above.install();
this.below.install();
this.cursor.install();
this.guide.install();
this.guide.update();
this.hint.install();
@ -94,6 +96,7 @@ function Ronin()
this.controller.add("default","View","Zoom Reset",() => { ronin.frame.methods.zoom.run(1); },"1");
this.controller.add("default","View","Zoom 2x",() => { ronin.frame.methods.zoom.run(2); },"2");
this.controller.add("default","View","Zoom 4x",() => { ronin.frame.methods.zoom.run(4); },"3");
this.controller.add("default","View","Toggle Guide",() => { ronin.guide.toggle(); },"h");
this.controller.commit();