2019-03-27 02:20:54 +03:00
|
|
|
//init variables
|
2021-07-19 00:17:41 +03:00
|
|
|
var canvasSize; // REFACTOR: Canvas class / getCanvasSize method
|
2021-07-23 20:05:33 +03:00
|
|
|
var zoom = 7; // REFACTOR: EditorState class/IIFE? Leave this one for later
|
2021-07-22 17:40:58 +03:00
|
|
|
var lastMouseClickPos = [0,0]; // REFACTOR: Input IIFE via getter? <- probably editor state as it is changed by tools
|
2019-03-31 16:55:08 +03:00
|
|
|
|
2019-03-27 02:20:54 +03:00
|
|
|
//common elements
|
2021-07-19 00:17:41 +03:00
|
|
|
// REFACTOR: put brush and eyedropper preview in the respective tool implementations
|
2021-11-01 13:33:18 +03:00
|
|
|
// REFACTOR: this should be in ResizableTool
|
2019-03-27 02:20:54 +03:00
|
|
|
var brushPreview = document.getElementById("brush-preview");
|
2021-07-19 00:17:41 +03:00
|
|
|
|
|
|
|
// REFACTOR: File class?
|
2019-03-27 02:20:54 +03:00
|
|
|
var canvasView = document.getElementById("canvas-view");
|
|
|
|
|
2019-03-31 17:32:49 +03:00
|
|
|
// Layers
|
2021-07-19 00:17:41 +03:00
|
|
|
// REFACTOR: File class / IIFE?
|
2019-03-31 17:32:49 +03:00
|
|
|
var layers = [];
|
2021-07-23 20:05:33 +03:00
|
|
|
// REFACTOR: File class?
|
2019-03-31 17:32:49 +03:00
|
|
|
var currentLayer;
|
|
|
|
|
2020-03-04 16:36:40 +03:00
|
|
|
// VFX layer used to draw previews of the selection and things like that
|
2021-07-19 00:17:41 +03:00
|
|
|
// REFACTOR: File class
|
2020-03-04 16:36:40 +03:00
|
|
|
var VFXLayer;
|
2020-03-04 21:46:19 +03:00
|
|
|
// TMP layer
|
2021-07-19 00:17:41 +03:00
|
|
|
// REFACTOR: File class
|
2020-03-04 21:46:19 +03:00
|
|
|
var TMPLayer;
|
2020-09-25 10:25:27 +03:00
|
|
|
|
|
|
|
// Pixel grid layer
|
2021-07-19 00:17:41 +03:00
|
|
|
// REFACTOR: File class
|
2020-09-25 10:25:27 +03:00
|
|
|
var pixelGrid;
|
2020-09-26 12:51:18 +03:00
|
|
|
|
2021-07-19 00:17:41 +03:00
|
|
|
// REFACTOR: I was thinking that the special layers (pixel grid, checkerboard ecc) could be an extension
|
|
|
|
// or a variatin of the standard Layer class? I wonder if we can use inheritance or something to
|
2021-07-22 19:11:55 +03:00
|
|
|
// recycle stuff
|