浏览代码

CTRLPainter watching window resize. Using Debounce.

dev-tmpl
Bryan Miller 6 年前
父节点
当前提交
7fe55cd661
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. +7
    -1
      app/js/ui/CTRLPainter.js

+ 7
- 1
app/js/ui/CTRLPainter.js 查看文件

@@ -1,3 +1,4 @@
import Utils from "/app/js/Utils.js";
import GlobalEvents from "/app/js/EventCaller.js";

const EL_CANVAS_ID = "painter";
@@ -19,7 +20,12 @@ class CTRLPainter {
throw new Error("Failed to obtain canvas context.");

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

get scale(){

正在加载...
取消
保存