diff --git a/desktop/main.js b/desktop/main.js index c2b8c0f..685764f 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -17,6 +17,7 @@ app.on('ready', () => { resizable: true, icon: __dirname + '/icon.ico', resizable: true, + webPreferences: { zoomFactor: 1.0 }, frame: process.platform !== 'darwin', skipTaskbar: process.platform === 'darwin', autoHideMenuBar: process.platform === 'darwin' diff --git a/desktop/sources/scripts/cursor.js b/desktop/sources/scripts/cursor.js index e0f1305..8c8d2fe 100644 --- a/desktop/sources/scripts/cursor.js +++ b/desktop/sources/scripts/cursor.js @@ -6,7 +6,7 @@ function Cursor () { this.operation = null this.translate = function (from = null, to = null, multi = false, copy = false, layer = false) { - if ((from || to) && this.translation == null) { this.translation = { multi: multi, copy: copy, layer: layer } } + if ((from || to) && this.translation === null) { this.translation = { multi: multi, copy: copy, layer: layer } } if (from) { this.translation.from = from } if (to) { this.translation.to = to } @@ -39,7 +39,7 @@ function Cursor () { this.translate(null, this.pos) } - if (this.last_pos.x != this.pos.x || this.last_pos.y != this.pos.y) { + if (this.last_pos.x !== this.pos.x || this.last_pos.y !== this.pos.y) { DOTGRID.renderer.update() } @@ -54,7 +54,7 @@ function Cursor () { 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) } - } else if (e.target.id == 'guide') { + } else if (e.target.id === 'guide') { DOTGRID.tool.addVertex({ x: this.pos.x, y: this.pos.y }) DOTGRID.picker.stop() } @@ -95,5 +95,5 @@ function Cursor () { } } - function isEqual (a, b) { return a.x == b.x && a.y == b.y } + function isEqual (a, b) { return a.x === b.x && a.y === b.y } } diff --git a/desktop/sources/scripts/dotgrid.js b/desktop/sources/scripts/dotgrid.js index 97b96fe..84b0c9d 100644 --- a/desktop/sources/scripts/dotgrid.js +++ b/desktop/sources/scripts/dotgrid.js @@ -260,7 +260,7 @@ String.prototype.capitalize = function () { } function isJson (text) { try { JSON.parse(text); return true } catch (error) { return false } } -function isEqual (a, b) { return a && b && a.x == b.x && a.y == b.y } +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 } diff --git a/desktop/sources/scripts/generator.js b/desktop/sources/scripts/generator.js index f9a6123..bf98c8c 100644 --- a/desktop/sources/scripts/generator.js +++ b/desktop/sources/scripts/generator.js @@ -10,8 +10,8 @@ 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 @@ -38,35 +38,35 @@ function Generator (layer, style) { for (const id in vertices) { if (skip > 0) { skip -= 1; continue } - let vertex = vertices[id] + let vertex = vertices[parseInt(id)] let next = vertices[parseInt(id) + 1] let afterNext = vertices[parseInt(id) + 2] - if (id == 0 && !prev || id == 0 && prev && (prev.x != vertex.x || prev.y != vertex.y)) { + if (parseInt(id) === 0 && !prev || parseInt(id) === 0 && prev && (prev.x !== vertex.x || prev.y !== vertex.y)) { html += `M${vertex.x},${vertex.y} ` } - if (type == 'line') { + if (type === 'line') { html += this._line(vertex) - } else if (type == 'arc_c') { + } else if (type === 'arc_c') { let clock = mirror > 0 && mirror < 3 ? '0,0' : '0,1' html += this._arc(vertex, next, clock) - } else if (type == 'arc_r') { + } else if (type === 'arc_r') { let clock = mirror > 0 && mirror < 3 ? '0,1' : '0,0' html += this._arc(vertex, next, clock) - } else if (type == 'arc_c_full') { + } else if (type === 'arc_c_full') { let clock = mirror > 0 ? '1,0' : '1,1' html += this._arc(vertex, next, clock) - } else if (type == 'arc_r_full') { + } else if (type === 'arc_r_full') { let clock = mirror > 0 ? '1,1' : '1,0' html += this._arc(vertex, next, clock) - } else if (type == 'bezier') { + } else if (type === 'bezier') { html += this._bezier(next, afterNext) skip = 1 } } - if (segment.type == 'close') { + if (segment.type === 'close') { html += 'Z ' } @@ -95,7 +95,7 @@ function Generator (layer, style) { let s = '' let prev = null for (const id in layer) { - const seg = layer[id] + const seg = layer[parseInt(id)] s += `${this.render(prev, seg, mirror)}` prev = seg.vertices ? seg.vertices[seg.vertices.length - 1] : null } @@ -105,7 +105,7 @@ function Generator (layer, style) { this.toString = function (offset = { x: 0, y: 0 }, scale = 1, mirror = this.style && this.style.mirror_style ? this.style.mirror_style : 0) { let s = this.convert(operate(this.layer, offset, scale)) - if (mirror == 1 || mirror == 2 || mirror == 3) { + if (mirror === 1 || mirror === 2 || mirror === 3) { s += this.convert(operate(this.layer, offset, scale, mirror), mirror) } diff --git a/desktop/sources/scripts/interface.js b/desktop/sources/scripts/interface.js index 378c8dc..5467032 100644 --- a/desktop/sources/scripts/interface.js +++ b/desktop/sources/scripts/interface.js @@ -57,7 +57,7 @@ function Interface (dotgrid) { onmouseover="DOTGRID.interface.over('${type}','${name}')" viewBox="0 0 300 300" class="icon ${type}"> - ${name == 'depth' ? `` : ''} + ${name === 'depth' ? `` : ''} ${name.capitalize()}${tool.key ? '(' + tool.key + ')' : ''} @@ -98,7 +98,7 @@ function Interface (dotgrid) { this.prev_operation = null this.update = function (force = false, id) { - if (this.prev_operation == dotgrid.cursor.operation && force == false) { return } + if (this.prev_operation === dotgrid.cursor.operation && force === false) { return } let multiVertices = null let segments = dotgrid.tool.layer() @@ -136,7 +136,7 @@ function Interface (dotgrid) { if (dotgrid.renderer.showExtras) { document.getElementById('grid_path').setAttribute('d', 'M65,155 Q155,245 245,155 M65,155 Q155,65 245,155 M155,125 A30,30 0 0,1 185,155 A30,30 0 0,1 155,185 A30,30 0 0,1 125,155 A30,30 0 0,1 155,125 ') } else { document.getElementById('grid_path').setAttribute('d', 'M65,155 Q155,245 245,155 M65,155 ') } // Mirror - if (dotgrid.tool.style().mirror_style == 0) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L60,60 L120,120 M180,180 L180,180 L240,240 M210,90 L210,90 L180,120 M120,180 L120,180 L90,210') } else if (dotgrid.tool.style().mirror_style == 1) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L240,240 M180,120 L210,90 M120,180 L90,210') } else if (dotgrid.tool.style().mirror_style == 2) { document.getElementById('mirror_path').setAttribute('d', 'M210,90 L210,90 L90,210 M60,60 L60,60 L120,120 M180,180 L180,180 L240,240') } else if (dotgrid.tool.style().mirror_style == 3) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L60,60 L120,120 L180,120 L210,90 M240,240 L240,240 L180,180 L120,180 L90,210') } else if (dotgrid.tool.style().mirror_style == 4) { document.getElementById('mirror_path').setAttribute('d', 'M120,120 L120,120 L120,120 L180,120 M120,150 L120,150 L180,150 M120,180 L120,180 L180,180 L180,180 L180,180 L240,240 M120,210 L120,210 L180,210 M120,90 L120,90 L180,90 M60,60 L60,60 L120,120 ') } + if (dotgrid.tool.style().mirror_style === 0) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L60,60 L120,120 M180,180 L180,180 L240,240 M210,90 L210,90 L180,120 M120,180 L120,180 L90,210') } else if (dotgrid.tool.style().mirror_style === 1) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L240,240 M180,120 L210,90 M120,180 L90,210') } else if (dotgrid.tool.style().mirror_style === 2) { document.getElementById('mirror_path').setAttribute('d', 'M210,90 L210,90 L90,210 M60,60 L60,60 L120,120 M180,180 L180,180 L240,240') } else if (dotgrid.tool.style().mirror_style === 3) { document.getElementById('mirror_path').setAttribute('d', 'M60,60 L60,60 L120,120 L180,120 L210,90 M240,240 L240,240 L180,180 L120,180 L90,210') } else if (dotgrid.tool.style().mirror_style === 4) { document.getElementById('mirror_path').setAttribute('d', 'M120,120 L120,120 L120,120 L180,120 M120,150 L120,150 L180,150 M120,180 L120,180 L180,180 L180,180 L180,180 L240,240 M120,210 L120,210 L180,210 M120,90 L120,90 L180,90 M60,60 L60,60 L120,120 ') } this.prev_operation = dotgrid.cursor.operation } diff --git a/desktop/sources/scripts/manager.js b/desktop/sources/scripts/manager.js index 56b0224..43dcc41 100644 --- a/desktop/sources/scripts/manager.js +++ b/desktop/sources/scripts/manager.js @@ -43,6 +43,7 @@ function Manager (dotgrid) { layer.style.strokeLinejoin = style.strokeLinejoin layer.style.stroke = style.color layer.style.fill = style.fill + layer.setAttribute('d', path) } } diff --git a/desktop/sources/scripts/picker.js b/desktop/sources/scripts/picker.js index 1eef498..29821c6 100644 --- a/desktop/sources/scripts/picker.js +++ b/desktop/sources/scripts/picker.js @@ -55,7 +55,7 @@ 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().fill = DOTGRID.tool.style().fill !== 'none' ? hex : 'none' this.stop() } @@ -66,13 +66,13 @@ function Picker (dotgrid) { return } - if (e.key == 'Enter') { + if (e.key === 'Enter') { this.validate() e.preventDefault() return } - if (e.key == 'Escape') { + if (e.key === 'Escape') { this.stop() e.preventDefault() return @@ -82,7 +82,7 @@ function Picker (dotgrid) { } function is_color (val) { - if (val.length != 3 && val.length != 6) { + if (val.length !== 3 && val.length !== 6) { return false } diff --git a/desktop/sources/scripts/renderer.js b/desktop/sources/scripts/renderer.js index 42043c7..9bbac3b 100644 --- a/desktop/sources/scripts/renderer.js +++ b/desktop/sources/scripts/renderer.js @@ -10,7 +10,7 @@ function Renderer (dotgrid) { this.context = this.el.getContext('2d') this.showExtras = true - this.scale = 2 //window.devicePixelRatio + this.scale = 2 // window.devicePixelRatio this.start = function () { this.update() @@ -101,10 +101,10 @@ function Renderer (dotgrid) { for (let x = markers.w - 1; x >= 0; x--) { for (let y = markers.h - 1; y >= 0; y--) { - let is_step = x % 4 == 0 && y % 4 == 0 + let is_step = x % 4 === 0 && y % 4 === 0 // Color let color = is_step ? dotgrid.theme.active.b_med : dotgrid.theme.active.b_low - if ((y == 0 || y == markers.h) && cursor.x == x + 1) { color = dotgrid.theme.active.b_high } else if ((x == 0 || x == markers.w - 1) && cursor.y == y + 1) { color = dotgrid.theme.active.b_high } else if (cursor.x == x + 1 && cursor.y == y + 1) { color = dotgrid.theme.active.b_high } + if ((y === 0 || y === markers.h) && cursor.x === x + 1) { color = dotgrid.theme.active.b_high } else if ((x === 0 || x === markers.w - 1) && cursor.y === y + 1) { color = dotgrid.theme.active.b_high } else if (cursor.x === x + 1 && cursor.y === y + 1) { color = dotgrid.theme.active.b_high } this.drawMarker({ x: parseInt(x * 15) + 15, @@ -129,7 +129,7 @@ function Renderer (dotgrid) { let operation = dotgrid.cursor.operation && dotgrid.cursor.operation.cast ? dotgrid.cursor.operation.cast : null if (!dotgrid.tool.canCast(operation)) { return } - if (operation == 'close') { return } + if (operation === 'close') { return } let path = new Generator([{ vertices: dotgrid.tool.vertices, type: operation }]).toString({ x: 0, y: 0 }, 2) let style = { @@ -205,7 +205,7 @@ function Renderer (dotgrid) { this.context.lineCap = style.strokeLinecap this.context.lineJoin = style.strokeLinejoin - if (style.fill && style.fill != 'none') { + if (style.fill && style.fill !== 'none') { this.context.fillStyle = style.color this.context.fill(p) } @@ -262,6 +262,6 @@ function Renderer (dotgrid) { this.context.drawImage(render, 0, 0, this.el.width, this.el.height) } - function isEqual (a, b) { return a && b && Math.abs(a.x) == Math.abs(b.x) && Math.abs(a.y) == Math.abs(b.y) } + function isEqual (a, b) { return a && b && Math.abs(a.x) === Math.abs(b.x) && Math.abs(a.y) === Math.abs(b.y) } function clamp (v, min, max) { return v < min ? min : v > max ? max : v } } diff --git a/desktop/sources/scripts/tool.js b/desktop/sources/scripts/tool.js index 43acc42..4e681c5 100644 --- a/desktop/sources/scripts/tool.js +++ b/desktop/sources/scripts/tool.js @@ -72,13 +72,13 @@ function Tool (dotgrid) { } this.replace = function (dot) { - if (!dot.layers || dot.layers.length != 3) { console.warn('Incompatible version'); return } + if (!dot.layers || dot.layers.length !== 3) { console.warn('Incompatible version'); return } if (dot.settings.width && dot.settings.height) { 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, height: dot.settings.size.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 }) } this.layers = dot.layers @@ -107,7 +107,7 @@ function Tool (dotgrid) { let segment = this.layer()[segmentId] for (const vertexId in segment.vertices) { let vertex = segment.vertices[vertexId] - if (Math.abs(pos.x) == Math.abs(vertex.x) && Math.abs(pos.y) == Math.abs(vertex.y)) { + if (Math.abs(pos.x) === Math.abs(vertex.x) && Math.abs(pos.y) === Math.abs(vertex.y)) { segment.vertices.splice(vertexId, 1) } } @@ -126,7 +126,7 @@ function Tool (dotgrid) { let segment = source[segmentId] for (const vertexId in segment.vertices) { let vertex = segment.vertices[vertexId] - if (vertex.x == Math.abs(pos.x) && vertex.y == Math.abs(pos.y)) { + if (vertex.x === Math.abs(pos.x) && vertex.y === Math.abs(pos.y)) { return segment } } @@ -145,7 +145,7 @@ function Tool (dotgrid) { let segment = this.layer()[segmentId] for (const vertexId in segment.vertices) { let vertex = segment.vertices[vertexId] - if (vertex.x == Math.abs(pos.x) && vertex.y == Math.abs(pos.y)) { + if (vertex.x === Math.abs(pos.x) && vertex.y === Math.abs(pos.y)) { return vertex } } @@ -180,19 +180,19 @@ function Tool (dotgrid) { this.i = { linecap: 0, linejoin: 0, thickness: 5 } this.toggle = function (type, mod = 1) { - if (type == 'linecap') { + if (type === 'linecap') { let a = ['butt', 'square', 'round'] this.i.linecap += mod this.style().strokeLinecap = a[this.i.linecap % a.length] - } else if (type == 'linejoin') { + } else if (type === 'linejoin') { let a = ['miter', 'round', 'bevel'] this.i.linejoin += mod this.style().strokeLinejoin = a[this.i.linejoin % a.length] - } else if (type == 'fill') { - this.style().fill = this.style().fill == 'none' ? this.style().color : 'none' - } else if (type == 'thickness') { + } else if (type === 'fill') { + this.style().fill = this.style().fill === 'none' ? this.style().color : 'none' + } else if (type === 'thickness') { this.style().thickness = clamp(this.style().thickness + mod, 1, 100) - } else if (type == 'mirror') { + } else if (type === 'mirror') { this.style().mirror_style = this.style().mirror_style > 2 ? 0 : this.style().mirror_style + 1 } else { console.warn('Unknown', type) @@ -212,23 +212,23 @@ function Tool (dotgrid) { } this.source = function (type) { - if (type == 'grid') { dotgrid.renderer.toggle() } - if (type == 'screen') { app.toggleFullscreen() } + if (type === 'grid') { dotgrid.renderer.toggle() } + if (type === 'screen') { app.toggleFullscreen() } - if (type == 'open') { dotgrid.open() } - if (type == 'save') { dotgrid.save() } - if (type == 'render') { dotgrid.render() } - if (type == 'export') { dotgrid.export() } + if (type === 'open') { dotgrid.open() } + if (type === 'save') { dotgrid.save() } + if (type === 'render') { dotgrid.render() } + if (type === 'export') { dotgrid.export() } } this.canAppend = function (content, index = this.index) { for (const id in this.layer(index)) { let stroke = this.layer(index)[id] - if (stroke.type != content.type) { continue } + if (stroke.type !== content.type) { continue } if (!stroke.vertices) { continue } if (!stroke.vertices[stroke.vertices.length - 1]) { continue } - if (stroke.vertices[stroke.vertices.length - 1].x != content.vertices[0].x) { continue } - if (stroke.vertices[stroke.vertices.length - 1].y != content.vertices[0].y) { continue } + if (stroke.vertices[stroke.vertices.length - 1].x !== content.vertices[0].x) { continue } + if (stroke.vertices[stroke.vertices.length - 1].y !== content.vertices[0].y) { continue } return id } return false @@ -237,14 +237,14 @@ function Tool (dotgrid) { this.canCast = function (type) { if (!type) { return false } // Cannot cast close twice - if (type == 'close') { + if (type === 'close') { let prev = this.layer()[this.layer().length - 1] - if (!prev || prev.type == 'close') { + if (!prev || prev.type === 'close') { return false } } - if (type == 'bezier') { - if (this.vertices.length != 3 && this.vertices.length != 5 && this.vertices.length != 7 && this.vertices.length != 9) { + if (type === 'bezier') { + if (this.vertices.length !== 3 && this.vertices.length !== 5 && this.vertices.length !== 7 && this.vertices.length !== 9) { return false } } @@ -268,7 +268,7 @@ function Tool (dotgrid) { let segment = this.layer()[segmentId] for (const vertexId in segment.vertices) { let vertex = segment.vertices[vertexId] - if (vertex.x == Math.abs(a.x) && vertex.y == Math.abs(a.y)) { + if (vertex.x === Math.abs(a.x) && vertex.y === Math.abs(a.y)) { segment.vertices[vertexId] = { x: Math.abs(b.x), y: Math.abs(b.y) } } } diff --git a/web/events.js b/web/events.js index 24dc65c..7c97c27 100644 --- a/web/events.js +++ b/web/events.js @@ -4,49 +4,49 @@ document.onkeyup = (e) => { const ch = e.key.toLowerCase(); - if(e.target && e.target.id == "picker_input"){ return; } + if(e.target && e.target.id === "picker_input"){ return; } // Output - 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((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(); } - if(ch == "escape"){ DOTGRID.tool.clear(); DOTGRID.picker.stop(); e.preventDefault(); } + if(ch === "backspace" && e.ctrlKey){ DOTGRID.theme.reset(); e.preventDefault(); } + if(ch === "backspace"){ DOTGRID.tool.removeSegment(); e.preventDefault(); } + if(ch === "escape"){ DOTGRID.tool.clear(); DOTGRID.picker.stop(); e.preventDefault(); } - if(ch == "1"){ DOTGRID.tool.selectLayer(0); e.preventDefault(); } - if(ch == "2"){ DOTGRID.tool.selectLayer(1); e.preventDefault(); } - if(ch == "3"){ DOTGRID.tool.selectLayer(2); e.preventDefault(); } + if(ch === "1"){ DOTGRID.tool.selectLayer(0); e.preventDefault(); } + if(ch === "2"){ DOTGRID.tool.selectLayer(1); e.preventDefault(); } + if(ch === "3"){ DOTGRID.tool.selectLayer(2); e.preventDefault(); } - if(ch == "h"){ DOTGRID.renderer.toggle(); e.preventDefault(); } - if(ch == "?"){ DOTGRID.reset(); DOTGRID.theme.reset(); e.preventDefault(); } + if(ch === "h"){ DOTGRID.renderer.toggle(); e.preventDefault(); } + if(ch === "?"){ DOTGRID.reset(); DOTGRID.theme.reset(); e.preventDefault(); } - if(ch == "a"){ DOTGRID.tool.cast("line"); e.preventDefault(); } - if(ch == "s"){ DOTGRID.tool.cast("arc_c"); e.preventDefault(); } - if(ch == "d"){ DOTGRID.tool.cast("arc_r"); e.preventDefault(); } - if(ch == "t"){ DOTGRID.tool.cast("arc_c_full"); e.preventDefault(); } - if(ch == "y"){ DOTGRID.tool.cast("arc_r_full"); e.preventDefault(); } - if(ch == "f"){ DOTGRID.tool.cast("bezier"); e.preventDefault(); } - if(ch == "z"){ DOTGRID.tool.cast("close"); e.preventDefault(); } + if(ch === "a"){ DOTGRID.tool.cast("line"); e.preventDefault(); } + if(ch === "s"){ DOTGRID.tool.cast("arc_c"); e.preventDefault(); } + if(ch === "d"){ DOTGRID.tool.cast("arc_r"); e.preventDefault(); } + if(ch === "t"){ DOTGRID.tool.cast("arc_c_full"); e.preventDefault(); } + if(ch === "y"){ DOTGRID.tool.cast("arc_r_full"); e.preventDefault(); } + if(ch === "f"){ DOTGRID.tool.cast("bezier"); e.preventDefault(); } + if(ch === "z"){ DOTGRID.tool.cast("close"); e.preventDefault(); } - if(ch == "q"){ DOTGRID.tool.toggle("linecap"); e.preventDefault(); } - if(ch == "w"){ DOTGRID.tool.toggle("linejoin"); e.preventDefault(); } - if(ch == "e"){ DOTGRID.tool.toggle("mirror"); e.preventDefault(); } - if(ch == "r"){ DOTGRID.tool.toggle("fill"); e.preventDefault(); } - if(ch == "g"){ DOTGRID.picker.start(); e.preventDefault(); } - if(ch == "}"){ DOTGRID.tool.toggle("thickness",1); e.preventDefault(); } - if(ch == "{"){ DOTGRID.tool.toggle("thickness",-1); e.preventDefault(); } - if(ch == "]"){ DOTGRID.tool.toggle("thickness",5); e.preventDefault(); } - if(ch == "["){ DOTGRID.tool.toggle("thickness",-5); e.preventDefault(); } + if(ch === "q"){ DOTGRID.tool.toggle("linecap"); e.preventDefault(); } + if(ch === "w"){ DOTGRID.tool.toggle("linejoin"); e.preventDefault(); } + if(ch === "e"){ DOTGRID.tool.toggle("mirror"); e.preventDefault(); } + if(ch === "r"){ DOTGRID.tool.toggle("fill"); e.preventDefault(); } + if(ch === "g"){ DOTGRID.picker.start(); e.preventDefault(); } + if(ch === "}"){ DOTGRID.tool.toggle("thickness",1); e.preventDefault(); } + if(ch === "{"){ DOTGRID.tool.toggle("thickness",-1); e.preventDefault(); } + if(ch === "]"){ DOTGRID.tool.toggle("thickness",5); e.preventDefault(); } + if(ch === "["){ DOTGRID.tool.toggle("thickness",-5); e.preventDefault(); } - if(ch == "m"){ DOTGRID.tool.merge(); e.preventDefault(); } + if(ch === "m"){ DOTGRID.tool.merge(); e.preventDefault(); } - if(ch == "i"){ DOTGRID.theme.invert(); e.preventDefault(); } + if(ch === "i"){ DOTGRID.theme.invert(); e.preventDefault(); } } document.onkeydown = (e) => { - if(e.keyCode == 9){ DOTGRID.tool.selectNextLayer(); e.preventDefault(); } + if(e.keyCode === 9){ DOTGRID.tool.selectNextLayer(); e.preventDefault(); } } \ No newline at end of file