Skip to content

Commit

Permalink
add export function
Browse files Browse the repository at this point in the history
  • Loading branch information
went2 committed Jul 10, 2023
1 parent 59a338d commit 78f24f5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pixel Editor</title>
</head>
Expand Down
Binary file added public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/components/uiControls/bottom/SaveButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class SaveButton implements UIComponent {
);
}
save() {
let canvas = <HTMLCanvasElement>elt("canvas");
let canvas = <HTMLCanvasElement>elt("canvas", {
width: this.picture.width,
height: this.picture.height,
});
drawPicture(this.picture, canvas, 1);
let link = elt("a", {
href: canvas.toDataURL(),
Expand Down
1 change: 1 addition & 0 deletions src/models/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function reducer(state: EditorState, action: ActionObj) {
doneAt: Date.now(),
});
} else if (action.type == "select-color") {
// console.log("select color", action);
const newColor = action.payload!.color;
return Object.assign({}, state, {
color: newColor,
Expand Down

0 comments on commit 78f24f5

Please sign in to comment.