hdpi: add canvas hdpi support when ?hdpi=1 is in url

This commit is contained in:
jean-emmanuel 2017-04-24 14:52:19 +02:00
parent 083c3bde76
commit 95e6204b39
2 changed files with 11 additions and 4 deletions

View file

@ -29,7 +29,7 @@ module.exports = class _canvas_base extends _widgets_base {
}
resizeHandleProxy() {
this.resizeHandle(...arguments)
}
@ -37,16 +37,19 @@ module.exports = class _canvas_base extends _widgets_base {
resizeHandle(e, width, height, checkColors){
var width = width,
height = height
height = height,
ratio = CANVAS_SCALING
if (width && height) {
this.height=height
this.width=width
this.canvas[0].setAttribute('width',width)
this.canvas[0].setAttribute('height',height)
this.canvas[0].setAttribute('width',width * ratio)
this.canvas[0].setAttribute('height',height * ratio)
if (ratio != 1) this.ctx.scale(ratio, ratio)
}
if (!this.visible || checkColors) {

View file

@ -1,3 +1,5 @@
ARGV={};location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(s,k,v){ARGV[k]=v})
///////////////////////
PACKAGE = require('../../../app/package.json')
@ -24,6 +26,8 @@ PXSCALE_RESET = ()=>{
}
PXSCALE_RESET()
CANVAS_SCALING = ARGV.hdpi ? window.devicePixelRatio : 1
///////////////////////
sourceMap = require('./libs/source-map.min.js')