mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Fixed infinite loop when filling an area with the same colour
This commit is contained in:
parent
aea3942349
commit
1a69b48297
@ -41,13 +41,17 @@ function fill(cursorLocation) {
|
||||
|
||||
//the new color to fill with
|
||||
var fillColor = hexToRgb(currentLayer.context.fillStyle);
|
||||
console.log("here");
|
||||
|
||||
//if you try to fill with the same color that's already there, exit the function
|
||||
if (clusterColor[0] == fillColor.r &&
|
||||
clusterColor[1] == fillColor.g &&
|
||||
clusterColor[2] == fillColor.b &&
|
||||
clusterColor[3] == fillColor.a)
|
||||
return;
|
||||
clusterColor[3] != 0) {
|
||||
console.log("Returned");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//loop until there are no more values left in this array
|
||||
while (topmostPixelsArray.length) {
|
||||
|
@ -231,7 +231,6 @@ function draw (mouseEvent) {
|
||||
//draw line to current pixel
|
||||
if (dragging) {
|
||||
if (mouseEvent.target.className == 'drawingCanvas' || mouseEvent.target.className == 'drawingCanvas') {
|
||||
console.log("Mouse coords: " + (cursorLocation[0] / zoom) + "," + cursorLocation[1] / zoom);
|
||||
line(Math.floor(lastMouseClickPos[0]/zoom),
|
||||
Math.floor(lastMouseClickPos[1]/zoom),
|
||||
Math.floor(cursorLocation[0]/zoom),
|
||||
|
Loading…
Reference in New Issue
Block a user