From 4ab7d27367a5cb50f4c300def8c142a21e0755c4 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 18 Jul 2019 20:02:42 +0900 Subject: [PATCH] Added retina support. --- desktop/sources/scripts/surface.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/desktop/sources/scripts/surface.js b/desktop/sources/scripts/surface.js index 578f1d9..36ab155 100644 --- a/desktop/sources/scripts/surface.js +++ b/desktop/sources/scripts/surface.js @@ -15,6 +15,7 @@ function Surface (ronin) { this._guide.addEventListener('mousedown', ronin.commander.onMouseDown, false) this._guide.addEventListener('mousemove', ronin.commander.onMouseMove, false) this._guide.addEventListener('mouseup', ronin.commander.onMouseUp, false) + // this.context.imageSmoothingEnabled = false this.context.scale(this.ratio, this.ratio) this.guide.scale(this.ratio, this.ratio) } @@ -164,12 +165,12 @@ function Surface (ronin) { console.log('Surface', `Resize: ${size.w}x${size.h}`) this.el.width = size.w this.el.height = size.h - this.el.style.width = size.w + 'px' - this.el.style.height = size.h + 'px' + this.el.style.width = (size.w / this.ratio) + 'px' + this.el.style.height = (size.h / this.ratio) + 'px' this._guide.width = size.w this._guide.height = size.h - this._guide.style.width = size.w + 'px' - this._guide.style.height = size.h + 'px' + this._guide.style.width = (size.w / this.ratio) + 'px' + this._guide.style.height = (size.h / this.ratio) + 'px' if (fit === true) { this.fitWindow(size) } @@ -183,11 +184,11 @@ function Surface (ronin) { const win = require('electron').remote.getCurrentWindow() const pad = { w: ronin.commander.isVisible === true ? 400 : 60, h: 60 } if (size.w < 10 || size.h < 10) { return } - win.setSize(Math.floor(size.w + pad.w), Math.floor(size.h + pad.h), true) + win.setSize(Math.floor((size.w / this.ratio) + pad.w), Math.floor((size.h / this.ratio) + pad.h), true) } this.maximize = function () { - this.resize({ x: 0, y: 0, w: window.innerWidth - 60, h: window.innerHeight - 60, t: 'rect' }) + this.resize({ x: 0, y: 0, w: (window.innerWidth * this.ratio) - 60, h: (window.innerHeight * this.ratio) - 60, t: 'rect' }) } this.onResize = function () {