From a9a421229966c5d6bc1f747ad28a652af3795a35 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sat, 18 Nov 2017 00:06:49 +0100 Subject: [PATCH] Improvement: Tile and snapshot relative to grid size --- src/js/background.js | 8 +++++--- src/js/dial.js | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index e9650a9..94bf8fc 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -296,7 +296,8 @@ app.SiteInfos.fromNewTab = function(url, callback){ // Retrieve infos from a ne imgObj.src = img; var previewWidth = 1200; // Need to be linked to settings - var previewHeight = 710; // Need to be linked to settings + var previewHeight = previewWidth / app.settings.grid.columns * app.settings.grid.rows; + if(app.settings.grid.title == true) previewHeight -= app.settings.grid.titleHeight; var canvas = document.createElement('canvas'); canvas.style.width = previewWidth.toString() + 'px'; @@ -362,7 +363,8 @@ app.SiteInfos.fromFrame = function(url, callback){ // Retrieve infos from an ifr } var previewWidth = 1200; // Need to be linked to settings - var previewHeight = 710; // Need to be linked to settings + var previewHeight = previewWidth / app.settings.grid.columns * app.settings.grid.rows; + if(app.settings.grid.title == true) previewHeight -= app.settings.grid.titleHeight; var iframe; var xmlHttp = new XMLHttpRequest(); xmlHttp.timeout = 10000 @@ -372,7 +374,7 @@ app.SiteInfos.fromFrame = function(url, callback){ // Retrieve infos from an ifr iframe.width = previewWidth iframe.height = previewHeight iframe.style.position = 'absolute'; - //iframe.style.visibility = 'hidden'; + iframe.scrolling = 'no'; var content = xmlHttp.responseText.replace('', ''); iframe.onload = function(){ pageLoaded(); } document.body.appendChild(iframe); diff --git a/src/js/dial.js b/src/js/dial.js index f55bf82..c5fcf01 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -415,8 +415,8 @@ dial.updateGridLayout = function(){ var cellHeight = fullHeight / app.settings.grid.rows; var linkWidth = 0; var linkHeight = 0; - if(cellWidth <= cellHeight * 4 / 3) cellHeight = cellWidth / 4 * 3; - else cellWidth = cellHeight / 3 * 4; + if(cellWidth <= cellHeight * app.settings.grid.columns / app.settings.grid.rows) cellHeight = cellWidth / app.settings.grid.columns * app.settings.grid.rows; + else cellWidth = cellHeight / app.settings.grid.rows * app.settings.grid.columns; linkWidth = cellWidth - 2 * (cellsMargin + 1) - 2 * borderSize; linkHeight = cellHeight - 2 * (cellsMargin + 1) - 2 * borderSize - titleBorderSize; return {