Made the color picker an IIFE

This commit is contained in:
unsettledgames
2021-12-04 23:11:21 +01:00
parent 07ed24cc6b
commit 71bfe543a5
11 changed files with 802 additions and 781 deletions

View File

@ -19,7 +19,7 @@ class BrushTool extends ResizableTool {
return;
//draw line to current pixel
if (cursorTarget.className == 'drawingCanvas' || cursorTarget.className == 'drawingCanvas') {
line(Math.floor(this.prevMousePos[0]/zoom),
currentLayer.drawLine(Math.floor(this.prevMousePos[0]/zoom),
Math.floor(this.prevMousePos[1]/zoom),
Math.floor(this.currMousePos[0]/zoom),
Math.floor(this.currMousePos[1]/zoom),

View File

@ -19,7 +19,7 @@ class EraserTool extends ResizableTool {
return;
//draw line to current pixel
if (cursorTarget.className == 'drawingCanvas' || cursorTarget.className == 'drawingCanvas') {
line(Math.floor(this.prevMousePos[0]/zoom),
currentLayer.drawLine(Math.floor(this.prevMousePos[0]/zoom),
Math.floor(this.prevMousePos[1]/zoom),
Math.floor(this.currMousePos[0]/zoom),
Math.floor(this.currMousePos[1]/zoom),

View File

@ -92,10 +92,10 @@ class RectangleTool extends ResizableTool {
currentLayer.context.lineWidth = this.currSize;
// Drawing the rect using 4 lines
line(startRectX, startRectY, endRectX, startRectY, this.currSize);
line(endRectX, startRectY, endRectX, endRectY, this.currSize);
line(endRectX, endRectY, startRectX, endRectY, this.currSize);
line(startRectX, endRectY, startRectX, startRectY, this.currSize);
currentLayer.drawLine(startRectX, startRectY, endRectX, startRectY, this.currSize);
currentLayer.drawLine(endRectX, startRectY, endRectX, endRectY, this.currSize);
currentLayer.drawLine(endRectX, endRectY, startRectX, endRectY, this.currSize);
currentLayer.drawLine(startRectX, endRectY, startRectX, startRectY, this.currSize);
// If I have to fill it, I do so
if (this.currFillMode == 'fill') {