commit
5c4080d598
@ -70,6 +70,7 @@
|
||||
DOTGRID.controller.add("default","Effect","Thinner",() => { DOTGRID.tool.toggle("thickness",-1) },"{");
|
||||
DOTGRID.controller.add("default","Effect","Thicker +5",() => { DOTGRID.tool.toggle("thickness",5) },"]");
|
||||
DOTGRID.controller.add("default","Effect","Thinner -5",() => { DOTGRID.tool.toggle("thickness",-5) },"[");
|
||||
DOTGRID.controller.add("default","Effect","Toggle Crest",() => { DOTGRID.tool.toggleCrest(); }, "CmdOrCtrl+K");
|
||||
|
||||
DOTGRID.controller.add("default","Manual","Add Point",() => { DOTGRID.tool.addVertex(DOTGRID.cursor.pos); DOTGRID.renderer.update() },"Enter");
|
||||
DOTGRID.controller.add("default","Manual","Move Up",() => { DOTGRID.cursor.pos.y -= 15; DOTGRID.renderer.update() },"Up");
|
||||
|
@ -144,18 +144,6 @@ function Dotgrid (width, height) {
|
||||
this.renderer.update()
|
||||
}
|
||||
|
||||
this.setZoom = function (scale) {
|
||||
this.setSize({ width: this.tool.settings.size.width, height: this.tool.settings.size.height }, true, scale)
|
||||
|
||||
try {
|
||||
webFrame.setZoomFactor(scale)
|
||||
} catch (err) {
|
||||
console.log('Cannot zoom')
|
||||
}
|
||||
}
|
||||
|
||||
// Draw
|
||||
|
||||
this.resize = function () {
|
||||
const size = { width: step(window.innerWidth - 90, 15), height: step(window.innerHeight - 120, 15) }
|
||||
|
||||
@ -173,6 +161,16 @@ function Dotgrid (width, height) {
|
||||
document.title = `Dotgrid — ${size.width}x${size.height}`
|
||||
}
|
||||
|
||||
this.setZoom = function (scale) {
|
||||
this.setSize({ width: this.tool.settings.size.width, height: this.tool.settings.size.height }, true, scale)
|
||||
|
||||
try {
|
||||
webFrame.setZoomFactor(scale)
|
||||
} catch (err) {
|
||||
console.log('Cannot zoom')
|
||||
}
|
||||
}
|
||||
|
||||
// Events
|
||||
|
||||
this.drag = function (e) {
|
||||
|
@ -28,16 +28,22 @@ function Manager (dotgrid) {
|
||||
const paths = DOTGRID.tool.paths()
|
||||
|
||||
for (const id in this.layers) {
|
||||
const style = styles[id]
|
||||
const path = paths[id]
|
||||
const layer = this.layers[id]
|
||||
let style = styles[id]
|
||||
let path = paths[id]
|
||||
let layer = this.layers[id]
|
||||
// Easter Egg
|
||||
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) + 15})`)
|
||||
}
|
||||
|
||||
layer.style.strokeWidth = style.thickness
|
||||
layer.style.strokeLinecap = style.strokeLinecap
|
||||
layer.style.strokeLinejoin = style.strokeLinejoin
|
||||
layer.style.stroke = style.color
|
||||
layer.style.fill = style.fill
|
||||
layer.style.transform = style.transform
|
||||
layer.setAttribute('d', paths[id])
|
||||
layer.setAttribute('d', path)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
function Tool (dotgrid) {
|
||||
this.index = 0
|
||||
this.settings = { size: { width: 300, height: 300 } }
|
||||
this.settings = { size: { width: 300, height: 300 }, crest: false }
|
||||
this.layers = [[], [], []]
|
||||
this.styles = [
|
||||
{ thickness: 10, strokeLinecap: 'round', strokeLinejoin: 'round', color: '#f00', fill: 'none', mirror_style: 0, transform: 'rotate(45)' },
|
||||
@ -200,6 +200,12 @@ function Tool (dotgrid) {
|
||||
dotgrid.renderer.update()
|
||||
}
|
||||
|
||||
this.toggleCrest = function () {
|
||||
this.settings.crest = this.settings.crest !== true
|
||||
dotgrid.interface.update(true)
|
||||
dotgrid.renderer.update()
|
||||
}
|
||||
|
||||
this.misc = function (type) {
|
||||
dotgrid.picker.start()
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ document.onkeyup = (e) =>
|
||||
if((e.ctrlKey || e.metaKey) && ch == "s"){ DOTGRID.save(); e.preventDefault(); return; }
|
||||
if((e.ctrlKey || e.metaKey) && ch == "r"){ DOTGRID.render(); e.preventDefault(); return; }
|
||||
if((e.ctrlKey || e.metaKey) && ch == "e"){ DOTGRID.export(); e.preventDefault(); return; }
|
||||
if((e.ctrlKey || e.metaKey) && ch == "k"){ DOTGRID.tool.toggleCrest(); e.preventDefault(); return; }
|
||||
|
||||
if(ch == "backspace" && e.ctrlKey){ DOTGRID.theme.reset(); e.preventDefault(); }
|
||||
if(ch == "backspace"){ DOTGRID.tool.removeSegment(); e.preventDefault(); }
|
||||
|
Loading…
Reference in New Issue
Block a user