Added retina support.
This commit is contained in:
parent
61d34036cd
commit
4ab7d27367
@ -15,6 +15,7 @@ function Surface (ronin) {
|
|||||||
this._guide.addEventListener('mousedown', ronin.commander.onMouseDown, false)
|
this._guide.addEventListener('mousedown', ronin.commander.onMouseDown, false)
|
||||||
this._guide.addEventListener('mousemove', ronin.commander.onMouseMove, false)
|
this._guide.addEventListener('mousemove', ronin.commander.onMouseMove, false)
|
||||||
this._guide.addEventListener('mouseup', ronin.commander.onMouseUp, false)
|
this._guide.addEventListener('mouseup', ronin.commander.onMouseUp, false)
|
||||||
|
// this.context.imageSmoothingEnabled = false
|
||||||
this.context.scale(this.ratio, this.ratio)
|
this.context.scale(this.ratio, this.ratio)
|
||||||
this.guide.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}`)
|
console.log('Surface', `Resize: ${size.w}x${size.h}`)
|
||||||
this.el.width = size.w
|
this.el.width = size.w
|
||||||
this.el.height = size.h
|
this.el.height = size.h
|
||||||
this.el.style.width = size.w + 'px'
|
this.el.style.width = (size.w / this.ratio) + 'px'
|
||||||
this.el.style.height = size.h + 'px'
|
this.el.style.height = (size.h / this.ratio) + 'px'
|
||||||
this._guide.width = size.w
|
this._guide.width = size.w
|
||||||
this._guide.height = size.h
|
this._guide.height = size.h
|
||||||
this._guide.style.width = size.w + 'px'
|
this._guide.style.width = (size.w / this.ratio) + 'px'
|
||||||
this._guide.style.height = size.h + 'px'
|
this._guide.style.height = (size.h / this.ratio) + 'px'
|
||||||
if (fit === true) {
|
if (fit === true) {
|
||||||
this.fitWindow(size)
|
this.fitWindow(size)
|
||||||
}
|
}
|
||||||
@ -183,11 +184,11 @@ function Surface (ronin) {
|
|||||||
const win = require('electron').remote.getCurrentWindow()
|
const win = require('electron').remote.getCurrentWindow()
|
||||||
const pad = { w: ronin.commander.isVisible === true ? 400 : 60, h: 60 }
|
const pad = { w: ronin.commander.isVisible === true ? 400 : 60, h: 60 }
|
||||||
if (size.w < 10 || size.h < 10) { return }
|
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.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 () {
|
this.onResize = function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user