retina: attempt to detect retina and adjust pixel scaling accordingly
This commit is contained in:
parent
5c87b61030
commit
467183bf31
2 changed files with 15 additions and 8 deletions
|
|
@ -126,12 +126,14 @@ var callbacks = module.exports = {
|
|||
},
|
||||
|
||||
applyStyle: function(data){
|
||||
var style = document.createElement('style')
|
||||
style.innerHTML = data.join('')
|
||||
var style = document.createElement('style'),
|
||||
css = data.join('')
|
||||
style.innerHTML = css
|
||||
document.body.appendChild(style)
|
||||
GRIDWIDTH = getComputedStyle(document.documentElement).getPropertyValue("--grid-width")
|
||||
PXSCALE = getComputedStyle(document.documentElement).getPropertyValue("--pixel-scale")
|
||||
INITIALZOOM = PXSCALE
|
||||
if (css.indexOf('--pixel-scale') != -1) {
|
||||
PXSCALE_RESET()
|
||||
}
|
||||
},
|
||||
|
||||
reloadCss: function(){
|
||||
|
|
@ -143,8 +145,7 @@ var callbacks = module.exports = {
|
|||
$('canvas').trigger('resize',[0,0,true])
|
||||
},100)
|
||||
GRIDWIDTH = getComputedStyle(document.documentElement).getPropertyValue("--grid-width")
|
||||
PXSCALE = getComputedStyle(document.documentElement).getPropertyValue("--pixel-scale")
|
||||
INITIALZOOM = PXSCALE
|
||||
PXSCALE_RESET()
|
||||
},
|
||||
readOnly: function(){
|
||||
READ_ONLY = true
|
||||
|
|
|
|||
|
|
@ -11,8 +11,14 @@ READ_ONLY = false
|
|||
TABS = {}
|
||||
|
||||
|
||||
PXSCALE = getComputedStyle(document.documentElement).getPropertyValue("--pixel-scale")
|
||||
INITIALZOOM = PXSCALE
|
||||
PXSCALE = 1
|
||||
INITIALZOOM = 1
|
||||
PXSCALE_RESET = ()=>{
|
||||
PXSCALE = (window.devicePixelRatio || 1) * getComputedStyle(document.documentElement).getPropertyValue("--pixel-scale")
|
||||
document.documentElement.style.setProperty("--pixel-scale", PXSCALE)
|
||||
INITIALZOOM = PXSCALE
|
||||
}
|
||||
PXSCALE_RESET()
|
||||
|
||||
///////////////////////
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue