Cleanup in progress
This commit is contained in:
@@ -20,12 +20,12 @@ function Cursor () {
|
||||
this.pos = this.atEvent(e)
|
||||
|
||||
// Translation
|
||||
if (DOTGRID.tool.vertexAt(this.pos)) {
|
||||
if (dotgrid.tool.vertexAt(this.pos)) {
|
||||
this.translate(this.pos, this.pos, e.shiftKey, e.ctrlKey || e.metaKey, e.altKey)
|
||||
}
|
||||
|
||||
DOTGRID.renderer.update()
|
||||
DOTGRID.interface.update()
|
||||
dotgrid.renderer.update()
|
||||
dotgrid.interface.update()
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ function Cursor () {
|
||||
}
|
||||
|
||||
if (this.last_pos.x !== this.pos.x || this.last_pos.y !== this.pos.y) {
|
||||
DOTGRID.renderer.update()
|
||||
dotgrid.renderer.update()
|
||||
}
|
||||
|
||||
DOTGRID.interface.update()
|
||||
dotgrid.interface.update()
|
||||
e.preventDefault()
|
||||
|
||||
this.last_pos = this.pos
|
||||
@@ -53,26 +53,26 @@ function Cursor () {
|
||||
this.pos = this.atEvent(e)
|
||||
|
||||
if (this.translation && !isEqual(this.translation.from, this.translation.to)) {
|
||||
if (this.translation.layer === true) { DOTGRID.tool.translateLayer(this.translation.from, this.translation.to) } else if (this.translation.copy) { DOTGRID.tool.translateCopy(this.translation.from, this.translation.to) } else if (this.translation.multi) { DOTGRID.tool.translateMulti(this.translation.from, this.translation.to) } else { DOTGRID.tool.translate(this.translation.from, this.translation.to) }
|
||||
if (this.translation.layer === true) { dotgrid.tool.translateLayer(this.translation.from, this.translation.to) } else if (this.translation.copy) { dotgrid.tool.translateCopy(this.translation.from, this.translation.to) } else if (this.translation.multi) { dotgrid.tool.translateMulti(this.translation.from, this.translation.to) } else { dotgrid.tool.translate(this.translation.from, this.translation.to) }
|
||||
} else if (e.target.id === 'guide') {
|
||||
DOTGRID.tool.addVertex({ x: this.pos.x, y: this.pos.y })
|
||||
DOTGRID.picker.stop()
|
||||
dotgrid.tool.addVertex({ x: this.pos.x, y: this.pos.y })
|
||||
dotgrid.picker.stop()
|
||||
}
|
||||
|
||||
this.translate()
|
||||
|
||||
DOTGRID.interface.update()
|
||||
DOTGRID.renderer.update()
|
||||
dotgrid.interface.update()
|
||||
dotgrid.renderer.update()
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
this.alt = function (e) {
|
||||
this.pos = this.atEvent(e)
|
||||
|
||||
DOTGRID.tool.removeSegmentsAt(this.pos)
|
||||
dotgrid.tool.removeSegmentsAt(this.pos)
|
||||
e.preventDefault()
|
||||
|
||||
setTimeout(() => { DOTGRID.tool.clear() }, 150)
|
||||
setTimeout(() => { dotgrid.tool.clear() }, 150)
|
||||
}
|
||||
|
||||
// Position Mods
|
||||
@@ -83,15 +83,15 @@ function Cursor () {
|
||||
|
||||
this.relativePos = function (pos) {
|
||||
return {
|
||||
x: pos.x - DOTGRID.renderer.el.offsetLeft,
|
||||
y: pos.y - DOTGRID.renderer.el.offsetTop
|
||||
x: pos.x - dotgrid.renderer.el.offsetLeft,
|
||||
y: pos.y - dotgrid.renderer.el.offsetTop
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
x: clamp(step(pos.x, 15), 15, dotgrid.tool.settings.size.width),
|
||||
y: clamp(step(pos.y, 15), 15, dotgrid.tool.settings.size.height)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ function Dotgrid () {
|
||||
this.install = function (host) {
|
||||
this.theme = new Theme(defaultTheme)
|
||||
this.history = new History()
|
||||
|
||||
this.source = new Source(this)
|
||||
this.manager = new Manager(this)
|
||||
this.renderer = new Renderer(this)
|
||||
this.tool = new Tool(this)
|
||||
@@ -39,25 +41,25 @@ function Dotgrid () {
|
||||
this.renderer.start()
|
||||
this.interface.start()
|
||||
|
||||
document.addEventListener('mousedown', function (e) { DOTGRID.cursor.down(e) }, false)
|
||||
document.addEventListener('mousemove', function (e) { DOTGRID.cursor.move(e) }, false)
|
||||
document.addEventListener('contextmenu', function (e) { DOTGRID.cursor.alt(e) }, false)
|
||||
document.addEventListener('mouseup', function (e) { DOTGRID.cursor.up(e) }, false)
|
||||
document.addEventListener('copy', function (e) { DOTGRID.copy(e) }, false)
|
||||
document.addEventListener('cut', function (e) { DOTGRID.cut(e) }, false)
|
||||
document.addEventListener('paste', function (e) { DOTGRID.paste(e) }, false)
|
||||
window.addEventListener('drop', DOTGRID.drag)
|
||||
document.addEventListener('mousedown', function (e) { dotgrid.cursor.down(e) }, false)
|
||||
document.addEventListener('mousemove', function (e) { dotgrid.cursor.move(e) }, false)
|
||||
document.addEventListener('contextmenu', function (e) { dotgrid.cursor.alt(e) }, false)
|
||||
document.addEventListener('mouseup', function (e) { dotgrid.cursor.up(e) }, false)
|
||||
document.addEventListener('copy', function (e) { dotgrid.copy(e) }, false)
|
||||
document.addEventListener('cut', function (e) { dotgrid.cut(e) }, false)
|
||||
document.addEventListener('paste', function (e) { dotgrid.paste(e) }, false)
|
||||
window.addEventListener('drop', dotgrid.drag)
|
||||
|
||||
this.new()
|
||||
this.source.new()
|
||||
|
||||
setTimeout(() => { document.body.className += ' ready' }, 250)
|
||||
}
|
||||
|
||||
this.update = function () {
|
||||
DOTGRID.resize()
|
||||
DOTGRID.manager.update()
|
||||
DOTGRID.interface.update()
|
||||
DOTGRID.renderer.update()
|
||||
this.resize()
|
||||
this.manager.update()
|
||||
this.interface.update()
|
||||
this.renderer.update()
|
||||
}
|
||||
|
||||
this.clear = function () {
|
||||
@@ -73,50 +75,6 @@ function Dotgrid () {
|
||||
this.update()
|
||||
}
|
||||
|
||||
// File
|
||||
|
||||
this.new = function () {
|
||||
this.setZoom(1.0)
|
||||
this.history.push(this.tool.layers)
|
||||
this.clear()
|
||||
}
|
||||
|
||||
this.open = function () {
|
||||
if (!dialog) { return }
|
||||
|
||||
const paths = dialog.showOpenDialog({ properties: ['openFile'], filters: [{ name: 'Dotgrid Image', extensions: ['dot', 'grid'] }] })
|
||||
|
||||
if (!paths) { console.warn('Nothing to load'); return }
|
||||
|
||||
fs.readFile(paths[0], 'utf-8', (err, data) => {
|
||||
if (err) { alert('An error ocurred reading the file :' + err.message); return }
|
||||
this.tool.replace(JSON.parse(data.toString().trim()))
|
||||
this.renderer.update()
|
||||
})
|
||||
}
|
||||
|
||||
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 () {
|
||||
@@ -132,6 +90,8 @@ function Dotgrid () {
|
||||
this.tool.settings.size.width = size.width
|
||||
this.tool.settings.size.height = size.height
|
||||
|
||||
console.log(this.tool.settings.size)
|
||||
|
||||
try {
|
||||
const win = require('electron').remote.getCurrentWindow()
|
||||
win.setSize((size.width + 100) * scale, (size.height + 100) * scale, false)
|
||||
@@ -196,39 +156,39 @@ function Dotgrid () {
|
||||
reader.onload = function (e) {
|
||||
const data = e.target && e.target.result ? e.target.result : ''
|
||||
if (data && !isJson(data)) { return }
|
||||
DOTGRID.tool.replace(JSON.parse(`${data}`))
|
||||
DOTGRID.renderer.update()
|
||||
dotgrid.tool.replace(JSON.parse(`${data}`))
|
||||
dotgrid.renderer.update()
|
||||
}
|
||||
reader.readAsText(file)
|
||||
}
|
||||
|
||||
this.copy = function (e) {
|
||||
DOTGRID.renderer.update()
|
||||
dotgrid.renderer.update()
|
||||
|
||||
if (e.target !== this.picker.input) {
|
||||
e.clipboardData.setData('text/source', DOTGRID.tool.export(DOTGRID.tool.layer()))
|
||||
e.clipboardData.setData('text/plain', DOTGRID.tool.path())
|
||||
e.clipboardData.setData('text/html', DOTGRID.manager.el.outerHTML)
|
||||
e.clipboardData.setData('text/svg+xml', DOTGRID.manager.el.outerHTML)
|
||||
e.clipboardData.setData('text/source', dotgrid.tool.export(dotgrid.tool.layer()))
|
||||
e.clipboardData.setData('text/plain', dotgrid.tool.path())
|
||||
e.clipboardData.setData('text/html', dotgrid.manager.el.outerHTML)
|
||||
e.clipboardData.setData('text/svg+xml', dotgrid.manager.el.outerHTML)
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
DOTGRID.renderer.update()
|
||||
dotgrid.renderer.update()
|
||||
}
|
||||
|
||||
this.cut = function (e) {
|
||||
DOTGRID.renderer.update()
|
||||
dotgrid.renderer.update()
|
||||
|
||||
if (e.target !== this.picker.input) {
|
||||
e.clipboardData.setData('text/source', DOTGRID.tool.export(DOTGRID.tool.layer()))
|
||||
e.clipboardData.setData('text/plain', DOTGRID.tool.export(DOTGRID.tool.layer()))
|
||||
e.clipboardData.setData('text/html', DOTGRID.manager.el.outerHTML)
|
||||
e.clipboardData.setData('text/svg+xml', DOTGRID.manager.el.outerHTML)
|
||||
DOTGRID.tool.layers[DOTGRID.tool.index] = []
|
||||
e.clipboardData.setData('text/source', dotgrid.tool.export(dotgrid.tool.layer()))
|
||||
e.clipboardData.setData('text/plain', dotgrid.tool.export(dotgrid.tool.layer()))
|
||||
e.clipboardData.setData('text/html', dotgrid.manager.el.outerHTML)
|
||||
e.clipboardData.setData('text/svg+xml', dotgrid.manager.el.outerHTML)
|
||||
dotgrid.tool.layers[dotgrid.tool.index] = []
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
DOTGRID.renderer.update()
|
||||
dotgrid.renderer.update()
|
||||
}
|
||||
|
||||
this.paste = function (e) {
|
||||
@@ -236,17 +196,17 @@ function Dotgrid () {
|
||||
let data = e.clipboardData.getData('text/source')
|
||||
if (isJson(data)) {
|
||||
data = JSON.parse(data.trim())
|
||||
DOTGRID.tool.import(data)
|
||||
dotgrid.tool.import(data)
|
||||
}
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
DOTGRID.renderer.update()
|
||||
dotgrid.renderer.update()
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('resize', function (e) {
|
||||
DOTGRID.update()
|
||||
dotgrid.update()
|
||||
}, false)
|
||||
|
||||
window.addEventListener('dragover', function (e) {
|
||||
@@ -263,5 +223,3 @@ function isJson (text) { try { JSON.parse(text); return true } catch (error) { r
|
||||
function isEqual (a, b) { return a && b && a.x === b.x && a.y === b.y }
|
||||
function clamp (v, min, max) { return v < min ? min : v > max ? max : v }
|
||||
function step (v, s) { return Math.round(v / s) * s }
|
||||
|
||||
const DOTGRID = new Dotgrid()
|
||||
|
||||
@@ -10,15 +10,15 @@ function Generator (layer, style) {
|
||||
for (const k1 in l) {
|
||||
const seg = l[k1]
|
||||
for (const k2 in seg.vertices) {
|
||||
if (mirror === 1 || mirror === 3) { seg.vertices[k2].x = (DOTGRID.tool.settings.size.width) - seg.vertices[k2].x + 15 }
|
||||
if (mirror === 2 || mirror === 3) { seg.vertices[k2].y = (DOTGRID.tool.settings.size.height) - seg.vertices[k2].y + 15 }
|
||||
if (mirror === 1 || mirror === 3) { seg.vertices[k2].x = (dotgrid.tool.settings.size.width) - seg.vertices[k2].x + 15 }
|
||||
if (mirror === 2 || mirror === 3) { seg.vertices[k2].y = (dotgrid.tool.settings.size.height) - seg.vertices[k2].y + 15 }
|
||||
|
||||
// Offset
|
||||
seg.vertices[k2].x += offset.x
|
||||
seg.vertices[k2].y += offset.y
|
||||
|
||||
// Rotate
|
||||
const center = { x: (DOTGRID.tool.settings.size.width / 2) + offset.x + (7.5), y: (DOTGRID.tool.settings.size.height / 2) + offset.y + 30 }
|
||||
const center = { x: (dotgrid.tool.settings.size.width / 2) + offset.x + (7.5), y: (dotgrid.tool.settings.size.height / 2) + offset.y + 30 }
|
||||
seg.vertices[k2] = rotatePoint(seg.vertices[k2], center, angle)
|
||||
|
||||
// Scale
|
||||
|
||||
@@ -51,10 +51,10 @@ function Interface (dotgrid) {
|
||||
<svg
|
||||
id="option_${name}"
|
||||
title="${name.capitalize()}"
|
||||
onmouseout="DOTGRID.interface.out('${type}','${name}')"
|
||||
onmouseup="DOTGRID.interface.up('${type}','${name}')"
|
||||
onmousedown="DOTGRID.interface.down('${type}','${name}')"
|
||||
onmouseover="DOTGRID.interface.over('${type}','${name}')"
|
||||
onmouseout="dotgrid.interface.out('${type}','${name}')"
|
||||
onmouseup="dotgrid.interface.up('${type}','${name}')"
|
||||
onmousedown="dotgrid.interface.down('${type}','${name}')"
|
||||
onmouseover="dotgrid.interface.over('${type}','${name}')"
|
||||
viewBox="0 0 300 300"
|
||||
class="icon ${type}">
|
||||
<path id="${name}_path" class="icon_path" d="${tool.icon}"/>${name === 'depth' ? `<path class="icon_path inactive" d=""/>` : ''}
|
||||
@@ -148,7 +148,7 @@ function Interface (dotgrid) {
|
||||
|
||||
document.onkeydown = function (e) {
|
||||
if (e.key === 'Tab') {
|
||||
DOTGRID.interface.toggle()
|
||||
dotgrid.interface.toggle()
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ function Controller () {
|
||||
this.menu[mode][cat][label] = { fn: fn, accelerator: accelerator }
|
||||
}
|
||||
|
||||
this.add_role = function (mode, cat, label) {
|
||||
this.addRole = function (mode, cat, label) {
|
||||
if (!this.menu[mode]) { this.menu[mode] = {} }
|
||||
if (!this.menu[mode][cat]) { this.menu[mode][cat] = {} }
|
||||
this.menu[mode][cat][label] = { role: label }
|
||||
|
||||
@@ -19,23 +19,23 @@ function Manager (dotgrid) {
|
||||
}
|
||||
|
||||
this.update = function () {
|
||||
this.el.setAttribute('width', (DOTGRID.tool.settings.size.width + 15) + 'px')
|
||||
this.el.setAttribute('height', (DOTGRID.tool.settings.size.height + 15) + 'px')
|
||||
this.el.style.width = (DOTGRID.tool.settings.size.width + 15)
|
||||
this.el.style.height = DOTGRID.tool.settings.size.height + 15
|
||||
this.el.setAttribute('width', (dotgrid.tool.settings.size.width + 15) + 'px')
|
||||
this.el.setAttribute('height', (dotgrid.tool.settings.size.height + 15) + 'px')
|
||||
this.el.style.width = (dotgrid.tool.settings.size.width + 15)
|
||||
this.el.style.height = dotgrid.tool.settings.size.height + 15
|
||||
|
||||
const styles = DOTGRID.tool.styles
|
||||
const paths = DOTGRID.tool.paths()
|
||||
const styles = dotgrid.tool.styles
|
||||
const paths = dotgrid.tool.paths()
|
||||
|
||||
for (const id in this.layers) {
|
||||
let style = styles[id]
|
||||
let path = paths[id]
|
||||
let layer = this.layers[id]
|
||||
// Easter Egg
|
||||
if (DOTGRID.tool.settings.crest === true) {
|
||||
if (dotgrid.tool.settings.crest === true) {
|
||||
style = styles[0]
|
||||
path = paths[0]
|
||||
layer.setAttribute('transform', `rotate(${parseInt(id) * 120} ${(DOTGRID.tool.settings.size.width / 2) + 7.5} ${(DOTGRID.tool.settings.size.height / 2) + 7.5})`)
|
||||
layer.setAttribute('transform', `rotate(${parseInt(id) * 120} ${(dotgrid.tool.settings.size.width / 2) + 7.5} ${(dotgrid.tool.settings.size.height / 2) + 7.5})`)
|
||||
}
|
||||
|
||||
layer.style.strokeWidth = style.thickness
|
||||
@@ -57,7 +57,7 @@ function Manager (dotgrid) {
|
||||
|
||||
// Exporters
|
||||
|
||||
this.toPNG = function (size = DOTGRID.tool.settings.size, callback) {
|
||||
this.toPNG = function (size = dotgrid.tool.settings.size, callback) {
|
||||
this.update()
|
||||
|
||||
let image64 = this.svg64()
|
||||
@@ -82,7 +82,7 @@ function Manager (dotgrid) {
|
||||
this.toGRID = function (callback) {
|
||||
this.update()
|
||||
|
||||
const text = DOTGRID.tool.export()
|
||||
const text = dotgrid.tool.export()
|
||||
const file = new Blob([text], { type: 'text/plain' })
|
||||
callback(URL.createObjectURL(file), 'export.grid')
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@ function Picker (dotgrid) {
|
||||
|
||||
this.isActive = true
|
||||
|
||||
this.input.setAttribute('placeholder', `${DOTGRID.tool.style().color.replace('#', '').trim()}`)
|
||||
this.input.setAttribute('placeholder', `${dotgrid.tool.style().color.replace('#', '').trim()}`)
|
||||
this.input.setAttribute('maxlength', 6)
|
||||
|
||||
DOTGRID.interface.el.className = 'picker'
|
||||
dotgrid.interface.el.className = 'picker'
|
||||
this.input.focus()
|
||||
this.input.value = ''
|
||||
|
||||
try { DOTGRID.controller.set('picker') } catch (err) { }
|
||||
try { dotgrid.controller.set('picker') } catch (err) { }
|
||||
}
|
||||
|
||||
this.update = function () {
|
||||
@@ -40,13 +40,13 @@ function Picker (dotgrid) {
|
||||
|
||||
this.isActive = false
|
||||
|
||||
DOTGRID.interface.el.className = ''
|
||||
dotgrid.interface.el.className = ''
|
||||
this.input.blur()
|
||||
this.input.value = ''
|
||||
|
||||
try { DOTGRID.controller.set() } catch (err) { console.log('No controller') }
|
||||
try { dotgrid.controller.set() } catch (err) { console.log('No controller') }
|
||||
|
||||
setTimeout(() => { DOTGRID.interface.update(true); DOTGRID.renderer.update() }, 250)
|
||||
setTimeout(() => { dotgrid.interface.update(true); dotgrid.renderer.update() }, 250)
|
||||
}
|
||||
|
||||
this.validate = function () {
|
||||
@@ -54,8 +54,8 @@ function Picker (dotgrid) {
|
||||
|
||||
const hex = `#${this.input.value}`
|
||||
|
||||
DOTGRID.tool.style().color = hex
|
||||
DOTGRID.tool.style().fill = DOTGRID.tool.style().fill !== 'none' ? hex : 'none'
|
||||
dotgrid.tool.style().color = hex
|
||||
dotgrid.tool.style().fill = dotgrid.tool.style().fill !== 'none' ? hex : 'none'
|
||||
|
||||
this.stop()
|
||||
}
|
||||
@@ -95,6 +95,6 @@ function Picker (dotgrid) {
|
||||
return re.test(val)
|
||||
}
|
||||
|
||||
this.input.onkeydown = function (event) { DOTGRID.picker.listen(event, true) }
|
||||
this.input.onkeyup = function (event) { DOTGRID.picker.listen(event) }
|
||||
this.input.onkeydown = function (event) { dotgrid.picker.listen(event, true) }
|
||||
this.input.onkeyup = function (event) { dotgrid.picker.listen(event) }
|
||||
}
|
||||
|
||||
45
desktop/sources/scripts/source.js
Normal file
45
desktop/sources/scripts/source.js
Normal file
@@ -0,0 +1,45 @@
|
||||
'use strict'
|
||||
|
||||
function Source (dotgrid) {
|
||||
this.new = function () {
|
||||
dotgrid.setZoom(1.0)
|
||||
dotgrid.history.push(dotgrid.tool.layers)
|
||||
dotgrid.clear()
|
||||
}
|
||||
|
||||
this.open = function () {
|
||||
if (!dialog) { return }
|
||||
|
||||
const paths = dialog.showOpenDialog({ properties: ['openFile'], filters: [{ name: 'Dotgrid Image', extensions: ['dot', 'grid'] }] })
|
||||
|
||||
if (!paths) { console.warn('Nothing to load'); return }
|
||||
|
||||
fs.readFile(paths[0], 'utf-8', (err, data) => {
|
||||
if (err) { alert('An error ocurred reading the file :' + err.message); return }
|
||||
dotgrid.tool.replace(JSON.parse(data.toString().trim()))
|
||||
dotgrid.renderer.update()
|
||||
})
|
||||
}
|
||||
|
||||
this.save = function () {
|
||||
if (dotgrid.tool.length() < 1) { console.warn('Nothing to save'); return }
|
||||
dotgrid.manager.toGRID(grab)
|
||||
}
|
||||
|
||||
this.export = function () {
|
||||
if (dotgrid.tool.length() < 1) { console.warn('Nothing to export'); return }
|
||||
dotgrid.manager.toSVG(grab)
|
||||
}
|
||||
|
||||
this.render = function () {
|
||||
if (dotgrid.tool.length() < 1) { console.warn('Nothing to render'); return }
|
||||
dotgrid.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 }))
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ function Tool (dotgrid) {
|
||||
dot.settings.size = { width: dot.settings.width, height: dot.settings.height }
|
||||
}
|
||||
if (this.settings && (this.settings.size.width !== dot.settings.size.width || this.settings.size.height !== dot.settings.size.height)) {
|
||||
dotgrid.setSize({ width: dot.settings.size.width / 15, height: dot.settings.size.height / 15 })
|
||||
dotgrid.setSize({ width: dot.settings.size.width, height: dot.settings.size.height })
|
||||
}
|
||||
|
||||
this.layers = dot.layers
|
||||
|
||||
Reference in New Issue
Block a user