瀏覽代碼

CTRLPainter now resizes internal surface to match as close as possible the DOM canvas element size.

dev-tmpl
Bryan Miller 6 年之前
父節點
當前提交
b65ea61e31
共有 1 個檔案被更改,包括 7 行新增2 行删除
  1. +7
    -2
      app/js/ctrls/CTRLPainter.js

+ 7
- 2
app/js/ctrls/CTRLPainter.js 查看文件

@@ -20,10 +20,15 @@ class CTRLPainter {
throw new Error("Failed to obtain canvas context.");

//var imgdata = this.__context.getImageData();
var handle_resize = Utils.debounce((function(){
var handle_resize = Utils.debounce((function(e){
console.log("DEBOUNCED");
console.log(e);
var w = this.__canvas.clientWidth;
var h = this.__canvas.clientHeight;
this.__canvas.width = w;
this.__canvas.height = h;
console.log(this.__canvas.width + ", " + this.__canvas.height);
console.log(this.__canvas.clientWidth + ", " + this.__canvas.height);
console.log(this.__canvas.clientWidth + ", " + this.__canvas.clientHeight);
}).bind(this), 250);
window.addEventListener("resize", handle_resize);
}

Loading…
取消
儲存