Improving zoom in/out.

This commit is contained in:
Devine Lu Linvega
2018-01-20 11:41:55 +13:00
parent ae3b1bf9e2
commit e34146ba87
10 changed files with 236 additions and 148 deletions

View File

@@ -39,7 +39,6 @@ function Keyboard()
ronin.guide.update();
ronin.guide.clear();
ronin.guide.inspect = false;
ronin.preview.clear();
if(!ronin.commander.is_focused()){
ronin.commander.hide();
}
@@ -56,15 +55,6 @@ function Keyboard()
return;
}
if(e.key == "]"){
e.preventDefault();
ronin.brush.mod_size(1);
}
if(e.key == "["){
e.preventDefault();
ronin.brush.mod_size(-1);
}
if((e.key == "n" || e.key == "Backspace") && (e.ctrlKey || e.metaKey)){
e.preventDefault();
ronin.guide.inspect = false;
@@ -102,21 +92,6 @@ function Keyboard()
ronin.cursor.swap_layer();
}
if(e.key == "1"){
e.preventDefault();
ronin.frame.methods.zoom.run(1);
}
if(e.key == "2"){
e.preventDefault();
ronin.frame.methods.zoom.run(2);
}
if(e.key == "3"){
e.preventDefault();
ronin.frame.methods.zoom.run(4);
}
ronin.hint.update(e);
}
}

View File

@@ -7,16 +7,14 @@ function Layer(name)
this.install = function()
{
ronin.el.appendChild(this.el);
ronin.frame.el.appendChild(this.el);
}
this.update = function(zoom = {scale:1,offset:{x:0,y:0}})
{
console.log(`Updated ${this.name}`);
this.el.style.width = (ronin.frame.width * ronin.frame.zoom.scale)+"px";
this.el.style.height = (ronin.frame.height * ronin.frame.zoom.scale)+"px";
this.el.style.left = zoom.offset.x+"px";
this.el.style.top = zoom.offset.y+"px";
// this.el.style.width = (ronin.frame.width)+"px";
// this.el.style.height = (ronin.frame.height)+"px";
}
this.context = function()