mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Made the color picker an IIFE
This commit is contained in:
@ -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),
|
||||
|
@ -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),
|
||||
|
@ -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') {
|
||||
|
Reference in New Issue
Block a user