瀏覽代碼

CTRLPainter now watches for offset with the combination shift+mouseleft+mousemove

dev-tmpl
Bryan Miller 5 年之前
父節點
當前提交
aceb73ceb5
共有 1 個文件被更改,包括 15 次插入0 次删除
  1. +15
    -0
      app/js/ctrls/CTRLPainter.js

+ 15
- 0
app/js/ctrls/CTRLPainter.js 查看文件

@@ -40,6 +40,8 @@ window.addEventListener("resize", HANDLE_Resize);

// Setting-up Input controls.
var input = new Input();
input.enableKeyboardInput(true);
input.enableMouseInput(true);
input.preventDefaults = true;

// Mouse handling...
@@ -95,8 +97,18 @@ class CTRLPainter {
this.__brushColor = ci;
}).bind(this);
GlobalEvents.listen("active_palette_color", handle_color_change);

var handle_offset = (function(e){
this.__offset[0] += e.x - e.lastX;
this.__offset[1] += e.y - e.lastY;
this.render();
}).bind(this);
input.listen("shift+mouseleft+mousemove", handle_offset);
}




get onePaletteMode(){return this.__onePaletteMode;}
set onePaletteMode(e){
this.__onePaletteMode = (e === true);
@@ -118,6 +130,9 @@ class CTRLPainter {
this.__gridEnabled = (e === true);
}




initialize(){
if (canvas === null){
canvas = document.getElementById(EL_CANVAS_ID);

Loading…
取消
儲存