From 1f887c67048298469af7b6c6315859e04c196db0 Mon Sep 17 00:00:00 2001 From: Jeff Wofford Date: Tue, 5 May 2020 18:13:43 -0500 Subject: [PATCH] Resolve lint errors. --- src/js/tools/drawing/Outliner.js | 7 ++++++- src/js/utils/PixelUtils.js | 17 ++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/js/tools/drawing/Outliner.js b/src/js/tools/drawing/Outliner.js index 6dccf3c7..beae82a3 100644 --- a/src/js/tools/drawing/Outliner.js +++ b/src/js/tools/drawing/Outliner.js @@ -34,6 +34,11 @@ }; ns.Outliner.prototype.replay = function (frame, replayData) { - pskl.PixelUtils.outlineSimilarConnectedPixelsFromFrame(frame, replayData.col, replayData.row, replayData.color, replayData.fillCorners); + pskl.PixelUtils.outlineSimilarConnectedPixelsFromFrame( + frame, + replayData.col, + replayData.row, + replayData.color, + replayData.fillCorners); }; })(); diff --git a/src/js/utils/PixelUtils.js b/src/js/utils/PixelUtils.js index 22ad6863..483d881e 100644 --- a/src/js/utils/PixelUtils.js +++ b/src/js/utils/PixelUtils.js @@ -170,13 +170,13 @@ /** * Acts like floodfill, except that a given pixel is only painted if it has at * least one non-filled-color neighbor. - * + * */ if (typeof replacementColor == 'string') { replacementColor = pskl.utils.colorToInt(replacementColor); } - if (fillCorners===undefined) { + if (fillCorners === undefined) { fillCorners = false; } @@ -192,13 +192,13 @@ } var atLeastOneNeighborHasNonTargetColor = function(pixel) { - for (var y = -1; y <= 1; y++ ) { - for (var x = -1; x <= 1; x++ ) { + for (var y = -1; y <= 1; y++) { + for (var x = -1; x <= 1; x++) { if (x != 0 || y != 0) { if (fillCorners || (x == 0 || y == 0)) { try { var pixelColor = frame.getPixel(pixel.col + x, pixel.row + y); - if ( pixelColor !== null && pixelColor !== targetColor) { + if (pixelColor !== null && pixelColor !== targetColor) { return true; } } catch (e) { @@ -212,11 +212,14 @@ }; var pixels = pskl.PixelUtils.getSimilarConnectedPixelsFromFrame(frame, col, row); - pixels = pixels.filter(pixel => atLeastOneNeighborHasNonTargetColor(pixel)); + pixels = pixels.filter(function(pixel) { + return atLeastOneNeighborHasNonTargetColor(pixel); + }); var paintedPixels = []; - for (var pixel of pixels) { + for (var i = 0; i < pixels.length; i++) { + var pixel = pixels[i]; frame.setPixel(pixel.col, pixel.row, replacementColor); paintedPixels.push(pixel); }