Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
javl committed May 5, 2023
1 parent 3267b99 commit 293a040
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ function placeImage(_image) {
}
ctx.restore();

// Make sure the image is black and white
if (settings.conversionFunction === ConversionFunctions.horizontal1bit
|| settings.conversionFunction === ConversionFunctions.vertical1bit) {
// eslint-disable-next-line no-undef
Expand All @@ -443,23 +442,21 @@ function placeImage(_image) {
if (settings.rotation === 90) {
canvas.width = settings.screenHeight;
canvas.height = settings.screenWidth;
ctx.setTransform(1, 0, 0, 1, canvas.width, 0); // set the scale and position
ctx.rotate(Math.PI / 2); // set the rotation
ctx.setTransform(1, 0, 0, 1, canvas.width, 0);
ctx.rotate(Math.PI / 2);
ctx.drawImage(clone, 0, 0);
ctx.setTransform(1, 0, 0, 1, 0, 0);
} else if (settings.rotation === 180) {
ctx.setTransform(1, 0, 0, 1, canvas.width, canvas.height); // set the scale and position
ctx.rotate(Math.PI); // set the rotation
ctx.setTransform(1, 0, 0, 1, canvas.width, canvas.height);
ctx.rotate(Math.PI);
ctx.drawImage(clone, 0, 0);
ctx.setTransform(1, 0, 0, 1, 0, 0);
} else if (settings.rotation === 270) {
canvas.width = settings.screenHeight;
canvas.height = settings.screenWidth;
ctx.setTransform(1, 0, 0, 1, 0, canvas.height); // set the scale and position
ctx.rotate(Math.PI * 1.5); // set the rotation
ctx.setTransform(1, 0, 0, 1, 0, canvas.height);
ctx.rotate(Math.PI * 1.5);
ctx.drawImage(clone, 0, 0);
ctx.setTransform(1, 0, 0, 1, 0, 0);
}
ctx.setTransform(1, 0, 0, 1, 0, 0);
}

const flipHorizontal = settings.flipHorizontally ? -1 : 1;
Expand Down

0 comments on commit 293a040

Please sign in to comment.