|
|
@@ -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); |