[FEAT] Multi select, flip, rotate, multi remove
This commit is contained in:
@@ -48,7 +48,16 @@ export const shareSpritesheet = async (layersRef: Ref<Layer[]>, columns: Ref<num
|
||||
if (!ctx) return null;
|
||||
canvas.width = sprite.width;
|
||||
canvas.height = sprite.height;
|
||||
ctx.drawImage(sprite.img, 0, 0);
|
||||
if (sprite.rotation || sprite.flipX || sprite.flipY) {
|
||||
ctx.save();
|
||||
ctx.translate(sprite.width / 2, sprite.height / 2);
|
||||
ctx.rotate((sprite.rotation * Math.PI) / 180);
|
||||
ctx.scale(sprite.flipX ? -1 : 1, sprite.flipY ? -1 : 1);
|
||||
ctx.drawImage(sprite.img, -sprite.width / 2, -sprite.height / 2);
|
||||
ctx.restore();
|
||||
} else {
|
||||
ctx.drawImage(sprite.img, 0, 0);
|
||||
}
|
||||
const base64 = canvas.toDataURL('image/png');
|
||||
return {
|
||||
id: sprite.id,
|
||||
@@ -56,6 +65,9 @@ export const shareSpritesheet = async (layersRef: Ref<Layer[]>, columns: Ref<num
|
||||
height: sprite.height,
|
||||
x: sprite.x,
|
||||
y: sprite.y,
|
||||
rotation: sprite.rotation || 0,
|
||||
flipX: sprite.flipX || false,
|
||||
flipY: sprite.flipY || false,
|
||||
base64,
|
||||
name: sprite.file.name,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user