Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<script type="text/template" id="main">
<div id="ui">
<div id="clear-button" class="button">Clear</div><div id="save-button" class="button">Save</div>
<div id="clear-button" class="button">Clear</div><a id="save-button" class="button">Save</a>

<div class="control-label">Quality</div>
<div class="buttons" id="qualities"></div>
Expand Down
1 change: 1 addition & 0 deletions paint.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ body {
cursor: pointer;

pointer-events: auto;
text-decoration: none;
}

#clear-button {
Expand Down
7 changes: 6 additions & 1 deletion paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,10 @@ var Paint = (function () {
};

Paint.prototype.save = function () {
//reset attributes so nothing gets saved if we hit an error somewhere
this.saveButton.removeAttribute('download');
this.saveButton.setAttribute('href', '#');

//we first render the painting to a WebGL texture

var wgl = this.wgl;
Expand Down Expand Up @@ -971,7 +975,8 @@ var Paint = (function () {
imageData.data.set(savePixels);
saveContext.putImageData(imageData, 0, 0);

window.open(saveCanvas.toDataURL());
this.saveButton.setAttribute('download', 'painting.png');
this.saveButton.setAttribute('href', saveCanvas.toDataURL());
};

Paint.prototype.onMouseMove = function (event) {
Expand Down