Skip to content

Commit

Permalink
switch rotate and flip button
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Nov 26, 2023
1 parent 17a06b0 commit dedb4fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/helpers/images/tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ export async function tile(origin: ImageSource, options: TileOptions = {}): Prom
) => {
ctx.clearRect(x, y, input.width, input.height);
ctx.setTransform(new DOMMatrix([scale, 0, 0, scale, x, y])); // sets scale and origin
ctx.rotate(rotation * (Math.PI / 180));
ctx.rotate(rotation * (Math.PI / 180)); // cast to radians
ctx.drawImage(image, -image.width / 2, -image.height / 2);

ctx.restore(); // reset context position to its origin
};

const drawMirroredImage = (x = 0, y = 0) => {
Expand Down Expand Up @@ -74,7 +72,7 @@ export async function tile(origin: ImageSource, options: TileOptions = {}): Prom
for (let y = 0; y < 3; ++y) {
drawRotatedImage(
input,
x * input.width + input.width / 2,
x * input.width + input.width / 2, // middle of tile
y * input.height + input.height / 2,
1,
angles[y][x],
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/utility/buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export const imageButtons = new ActionRowBuilder<ButtonBuilder>().addComponents(
);
export const tileButtons = new ActionRowBuilder<ButtonBuilder>().addComponents(
tile,
flip,
rotate,
flip,
palette,
);
export const textureButtons = new ActionRowBuilder<ButtonBuilder>().addComponents(
Expand Down

0 comments on commit dedb4fc

Please sign in to comment.