Animated canvas size.
This commit is contained in:
@@ -370,18 +370,10 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y,thickness = 3,lineca
|
||||
this.draw();
|
||||
}
|
||||
|
||||
this.zoom = false;
|
||||
|
||||
this.toggle_zoom = function()
|
||||
{
|
||||
dotgrid.set_size(!dotgrid.zoom ? {width:600,height:600} : {width:300,height:300})
|
||||
dotgrid.zoom = dotgrid.zoom ? false : true;
|
||||
}
|
||||
|
||||
this.set_size = function(size = {width:300,height:300})
|
||||
this.set_size = function(size = {width:300,height:300},interface = true)
|
||||
{
|
||||
var win = require('electron').remote.getCurrentWindow();
|
||||
win.setSize(size.width+100,size.height+120);
|
||||
win.setSize(size.width+100,size.height+100+(interface ? 10 : 0),true);
|
||||
|
||||
this.width = size.width
|
||||
this.height = size.height
|
||||
|
||||
@@ -2,7 +2,6 @@ function Interface()
|
||||
{
|
||||
this.el = document.createElement("div");
|
||||
this.el.id = "interface";
|
||||
this.is_visible = true;
|
||||
|
||||
this.start = function()
|
||||
{
|
||||
@@ -47,13 +46,28 @@ function Interface()
|
||||
document.getElementById("export").className.baseVal = dotgrid.segments.length < 1 ? "icon inactive" : "icon";
|
||||
}
|
||||
|
||||
this.update_size = function()
|
||||
{
|
||||
var size = this.zoom ? {width:600,height:600} : {width:300,height:300};
|
||||
|
||||
dotgrid.set_size(size,this.is_visible);
|
||||
}
|
||||
|
||||
this.is_visible = true;
|
||||
this.zoom = false;
|
||||
|
||||
this.toggle = function()
|
||||
{
|
||||
this.is_visible = this.is_visible ? false : true;
|
||||
this.el.className = this.is_visible ? "visible" : "hidden";
|
||||
|
||||
const {dialog,app} = require('electron').remote;
|
||||
var win = require('electron').remote.getCurrentWindow();
|
||||
win.setSize(400,this.is_visible ? 420 : 400);
|
||||
this.update_size();
|
||||
}
|
||||
|
||||
this.toggle_zoom = function()
|
||||
{
|
||||
this.zoom = this.zoom ? false : true;
|
||||
|
||||
this.update_size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ function Keyboard()
|
||||
{
|
||||
// zoom
|
||||
if(e.key == "~" || e.keyCode == 192){
|
||||
dotgrid.toggle_zoom();
|
||||
dotgrid.interface.toggle_zoom();
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user