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
1 change: 1 addition & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
</div>
</div>
<div class="topbar-btn" id="editor-btn-convert">Convert to commands..</div>
<div class="topbar-btn" id="editor-btn-save-png">Save as PNG..</div>
<div class="topbar-btn">Help
<div class="topbar-menu topbar-menu-help">
<div class="topbar-menu-item" id="editor-help-faq">
Expand Down
8 changes: 8 additions & 0 deletions app/models/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,14 @@ function MineartCanvas() {
this.render()
}

this.getDataUrl = function() {
if (store.imageWidth > 256 || store.imageHeight > 256) {
if (!confirm("Images with width/length more than 256 blocks may cause performance issues.\nContinue?"))
return null
}
return canvasTemp.toDataURL()
}

this.render = () => {
this._renderMainCanvas()
this._renderOverlayCanvas()
Expand Down
8 changes: 8 additions & 0 deletions app/screens/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,14 @@ const store = {
this.$helpControls.onclick = () => {
store.parent.modals.openModal('controls')
}
this.$btnSavePng.onclick = function() {
var n = new Image
, e = store.parent.mineartCanvas.getDataUrl();
if (null !== e) {
n.src = e;
window.open(e).document.write(n.outerHTML)
}
}
}
}

Expand Down