cleanup
This commit is contained in:
@@ -48,7 +48,9 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
|
||||
this.open = function()
|
||||
{
|
||||
var paths = dialog.showOpenDialog({properties: ['openFile'],filters:[{name:"Dotgrid Image",extensions:["dot","grid"]}]});
|
||||
if(!dialog){ return; }
|
||||
|
||||
let paths = dialog.showOpenDialog({properties: ['openFile'],filters:[{name:"Dotgrid Image",extensions:["dot","grid"]}]});
|
||||
|
||||
if(!paths){ console.log("Nothing to load"); return; }
|
||||
|
||||
@@ -76,7 +78,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
this.save_web = function(content)
|
||||
{
|
||||
console.info("Web Save");
|
||||
var win = window.open("", "Save", `toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=480,top=${screen.height-200},left=${screen.width-640}`);
|
||||
let win = window.open("", "Save", `toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=480,top=${screen.height-200},left=${screen.width-640}`);
|
||||
win.document.body.innerHTML = `<style>body { background:${dotgrid.theme.active.background}; color:${dotgrid.theme.active.f_med}} pre { color:${dotgrid.theme.active.f_high} }</style><p>To save: Copy this into a .grid file.<br />To load: Drag the .grid onto the browser window.</p><pre>${content}</pre>`;
|
||||
}
|
||||
|
||||
@@ -118,7 +120,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
this.export_web = function(content)
|
||||
{
|
||||
console.info("Web Export");
|
||||
var win = window.open("", "Save", `toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=480,top=${screen.height-200},left=${screen.width-640}`);
|
||||
let win = window.open("", "Save", `toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=480,top=${screen.height-200},left=${screen.width-640}`);
|
||||
win.document.body.innerHTML = `<style>body { background:${dotgrid.theme.active.background}}</style>${dotgrid.renderer.to_svg()}`;
|
||||
}
|
||||
|
||||
@@ -132,7 +134,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
this.tool.settings.size.height = size.height
|
||||
|
||||
try{
|
||||
var win = require('electron').remote.getCurrentWindow();
|
||||
let win = require('electron').remote.getCurrentWindow();
|
||||
win.setSize((size.width+100)*scale,(size.height+100+(interface ? 10 : 0))*scale,true);
|
||||
}
|
||||
catch(err){
|
||||
@@ -182,7 +184,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
|
||||
this.refresh = function()
|
||||
{
|
||||
var size = {width:step(window.innerWidth-90,15),height:step(window.innerHeight-120,15)}
|
||||
let size = {width:step(window.innerWidth-90,15),height:step(window.innerHeight-120,15)}
|
||||
|
||||
dotgrid.tool.settings.size.width = size.width
|
||||
dotgrid.tool.settings.size.height = size.height
|
||||
@@ -205,11 +207,11 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
var file = e.dataTransfer.files[0];
|
||||
let file = e.dataTransfer.files[0];
|
||||
|
||||
if(!file.path || file.path.indexOf(".dot") < 0 && file.path.indexOf(".grid") < 0){ console.log("Dotgrid","Not a dot file"); return; }
|
||||
|
||||
var reader = new FileReader();
|
||||
let reader = new FileReader();
|
||||
reader.onload = function(e){
|
||||
dotgrid.tool.replace(JSON.parse(e.target.result.toString().trim()));
|
||||
dotgrid.guide.refresh();
|
||||
@@ -250,7 +252,7 @@ function Dotgrid(width,height,grid_x,grid_y,block_x,block_y)
|
||||
this.paste = function(e)
|
||||
{
|
||||
if(e.target !== this.picker.el){
|
||||
var data = e.clipboardData.getData("text/source");
|
||||
let data = e.clipboardData.getData("text/source");
|
||||
if (is_json(data)) {
|
||||
data = JSON.parse(data.trim());
|
||||
dotgrid.tool.import(data);
|
||||
|
||||
Reference in New Issue
Block a user