mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Fixed style issues
This commit is contained in:
parent
0e4f1046d3
commit
7c4d03b105
@ -66,15 +66,17 @@
|
|||||||
|
|
||||||
align : function(frame) {
|
align : function(frame) {
|
||||||
// Figure out the boundary
|
// Figure out the boundary
|
||||||
var minx = frame.width, miny = frame.height;
|
var minx = frame.width;
|
||||||
var maxx = 0, maxy = 0;
|
var miny = frame.height;
|
||||||
for(var col = 0; col < frame.width; col++) {
|
var maxx = 0;
|
||||||
for(var row = 0; row < frame.height; row++) {
|
var maxy = 0;
|
||||||
if(frame.pixels[col][row] !== Constants.TRANSPARENT_COLOR) {
|
for (var col = 0; col < frame.width; col++) {
|
||||||
if(row < miny) miny = row;
|
for (var row = 0; row < frame.height; row++) {
|
||||||
if(row > maxy) maxy = row;
|
if (frame.pixels[col][row] !== Constants.TRANSPARENT_COLOR) {
|
||||||
if(col < minx) minx = col;
|
miny = Math.min(miny, row);
|
||||||
if(col > maxx) maxx = col;
|
maxy = Math.max(maxy, row);
|
||||||
|
minx = Math.min(minx, col);
|
||||||
|
maxx = Math.max(maxx, col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,15 +93,15 @@
|
|||||||
// Actually move the pixels
|
// Actually move the pixels
|
||||||
var clone = frame.clone();
|
var clone = frame.clone();
|
||||||
frame.forEachPixel(function(color, x, y) {
|
frame.forEachPixel(function(color, x, y) {
|
||||||
var _x = x, _y = y;
|
var _x = x;
|
||||||
|
var _y = y;
|
||||||
|
|
||||||
x -= dx;
|
x -= dx;
|
||||||
y -= dy;
|
y -= dy;
|
||||||
|
|
||||||
if(clone.containsPixel(x, y)) {
|
if (clone.containsPixel(x, y)) {
|
||||||
frame.pixels[_x][_y] = clone.getPixel(x, y);
|
frame.pixels[_x][_y] = clone.getPixel(x, y);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
frame.pixels[_x][_y] = Constants.TRANSPARENT_COLOR;
|
frame.pixels[_x][_y] = Constants.TRANSPARENT_COLOR;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user