From 74f608d38c5e689f4f668c4bf767739d47ff2662 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Fri, 3 Aug 2018 09:13:14 +1200 Subject: [PATCH] Detect if is retina. --- desktop/main.js | 1 + desktop/sources/scripts/dotgrid.js | 1 - desktop/sources/scripts/guide.js | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop/main.js b/desktop/main.js index d05488c..907a25f 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -32,6 +32,7 @@ app.on('ready', () => app.win = new BrowserWindow({width: 400, height: 420, minWidth: 400, minHeight: 420,webPreferences: {zoomFactor: 1.0}, backgroundColor:"#000", frame:false, autoHideMenuBar: true, icon: __dirname + '/icon.ico'}) app.win.loadURL(`file://${__dirname}/sources/index.html`); + app.win.scaleFactor = require('electron').screen.getPrimaryDisplay().scaleFactor app.win.on('closed', () => { win = null diff --git a/desktop/sources/scripts/dotgrid.js b/desktop/sources/scripts/dotgrid.js index b2b8f1e..915e039 100644 --- a/desktop/sources/scripts/dotgrid.js +++ b/desktop/sources/scripts/dotgrid.js @@ -507,7 +507,6 @@ String.prototype.capitalize = function() return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase(); } - function is_json(text){ try{ JSON.parse(text);return true; } catch(error){ return false; }} function pos_is_equal(a,b){ return a && b && a.x == b.x && a.y == b.y } function clamp(v, min, max) { return v < min ? min : v > max ? max : v; } diff --git a/desktop/sources/scripts/guide.js b/desktop/sources/scripts/guide.js index caeebdb..d094325 100644 --- a/desktop/sources/scripts/guide.js +++ b/desktop/sources/scripts/guide.js @@ -8,7 +8,7 @@ function Guide() this.el.style.height = "320px"; this.show_extras = true; - var scale = 2; + var scale = require('electron').remote.getCurrentWindow().scaleFactor; this.start = function() {