hdpi: add canvas hdpi support when ?hdpi=1 is in url
This commit is contained in:
parent
083c3bde76
commit
95e6204b39
2 changed files with 11 additions and 4 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue