Reverted io
This commit is contained in:
parent
24a7b76254
commit
03cb438b9b
@ -91,7 +91,7 @@ function Cursor () {
|
||||
this.snapPos = function (pos) {
|
||||
return {
|
||||
x: clamp(step(pos.x, 15), 15, DOTGRID.tool.settings.size.width),
|
||||
y: clamp(step(pos.y, 15), 15, DOTGRID.tool.settings.size.height + 15)
|
||||
y: clamp(step(pos.y, 15), 15, DOTGRID.tool.settings.size.height)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,28 @@ function Dotgrid (width, height) {
|
||||
})
|
||||
}
|
||||
|
||||
this.save = function () {
|
||||
if (DOTGRID.tool.length() < 1) { console.warn('Nothing to save'); return }
|
||||
this.manager.toGRID(grab)
|
||||
}
|
||||
|
||||
this.export = function () {
|
||||
if (DOTGRID.tool.length() < 1) { console.warn('Nothing to export'); return }
|
||||
this.manager.toSVG(grab)
|
||||
}
|
||||
|
||||
this.render = function () {
|
||||
if (DOTGRID.tool.length() < 1) { console.warn('Nothing to render'); return }
|
||||
this.manager.toPNG({ width: DOTGRID.tool.settings.size.width * 2, height: DOTGRID.tool.settings.size.height * 2 }, grab)
|
||||
}
|
||||
|
||||
function grab (base64, name) {
|
||||
const link = document.createElement('a')
|
||||
link.setAttribute('href', base64)
|
||||
link.setAttribute('download', name)
|
||||
link.dispatchEvent(new MouseEvent(`click`, { bubbles: true, cancelable: true, view: window }))
|
||||
}
|
||||
|
||||
// Basics
|
||||
|
||||
this.getSize = function () {
|
||||
|
@ -79,28 +79,4 @@ function Manager (dotgrid) {
|
||||
const file = new Blob([text], { type: 'text/plain' })
|
||||
callback(URL.createObjectURL(file), 'export.grid')
|
||||
}
|
||||
|
||||
// Helpers
|
||||
|
||||
this.save = function () {
|
||||
if (DOTGRID.tool.length() < 1) { console.warn('Nothing to save'); return }
|
||||
this.toGRID(grab)
|
||||
}
|
||||
|
||||
this.export = function () {
|
||||
if (DOTGRID.tool.length() < 1) { console.warn('Nothing to export'); return }
|
||||
this.toSVG(grab)
|
||||
}
|
||||
|
||||
this.render = function () {
|
||||
if (DOTGRID.tool.length() < 1) { console.warn('Nothing to render'); return }
|
||||
this.toPNG({ width: DOTGRID.tool.settings.size.width * 2, height: DOTGRID.tool.settings.size.height * 2 }, grab)
|
||||
}
|
||||
|
||||
function grab (base64, name) {
|
||||
const link = document.createElement('a')
|
||||
link.setAttribute('href', base64)
|
||||
link.setAttribute('download', name)
|
||||
link.dispatchEvent(new MouseEvent(`click`, { bubbles: true, cancelable: true, view: window }))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user