mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Resolve lint errors.
This commit is contained in:
parent
0f5501bc3b
commit
1f887c6704
@ -34,6 +34,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
ns.Outliner.prototype.replay = function (frame, replayData) {
|
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);
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
@ -170,13 +170,13 @@
|
|||||||
/**
|
/**
|
||||||
* Acts like floodfill, except that a given pixel is only painted if it has at
|
* Acts like floodfill, except that a given pixel is only painted if it has at
|
||||||
* least one non-filled-color neighbor.
|
* least one non-filled-color neighbor.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (typeof replacementColor == 'string') {
|
if (typeof replacementColor == 'string') {
|
||||||
replacementColor = pskl.utils.colorToInt(replacementColor);
|
replacementColor = pskl.utils.colorToInt(replacementColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fillCorners===undefined) {
|
if (fillCorners === undefined) {
|
||||||
fillCorners = false;
|
fillCorners = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,13 +192,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var atLeastOneNeighborHasNonTargetColor = function(pixel) {
|
var atLeastOneNeighborHasNonTargetColor = function(pixel) {
|
||||||
for (var y = -1; y <= 1; y++ ) {
|
for (var y = -1; y <= 1; y++) {
|
||||||
for (var x = -1; x <= 1; x++ ) {
|
for (var x = -1; x <= 1; x++) {
|
||||||
if (x != 0 || y != 0) {
|
if (x != 0 || y != 0) {
|
||||||
if (fillCorners || (x == 0 || y == 0)) {
|
if (fillCorners || (x == 0 || y == 0)) {
|
||||||
try {
|
try {
|
||||||
var pixelColor = frame.getPixel(pixel.col + x, pixel.row + y);
|
var pixelColor = frame.getPixel(pixel.col + x, pixel.row + y);
|
||||||
if ( pixelColor !== null && pixelColor !== targetColor) {
|
if (pixelColor !== null && pixelColor !== targetColor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -212,11 +212,14 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var pixels = pskl.PixelUtils.getSimilarConnectedPixelsFromFrame(frame, col, row);
|
var pixels = pskl.PixelUtils.getSimilarConnectedPixelsFromFrame(frame, col, row);
|
||||||
pixels = pixels.filter(pixel => atLeastOneNeighborHasNonTargetColor(pixel));
|
pixels = pixels.filter(function(pixel) {
|
||||||
|
return atLeastOneNeighborHasNonTargetColor(pixel);
|
||||||
|
});
|
||||||
|
|
||||||
var paintedPixels = [];
|
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);
|
frame.setPixel(pixel.col, pixel.row, replacementColor);
|
||||||
paintedPixels.push(pixel);
|
paintedPixels.push(pixel);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user