From c7912e02fe2d5386fca33535ec97b61e44a57ffe Mon Sep 17 00:00:00 2001 From: neauoire Date: Thu, 26 Mar 2020 20:35:30 +0900 Subject: [PATCH] Fixes #71, issue with history --- index.html | 14 +++++++------- scripts/client.js | 2 ++ scripts/lib/acels.js | 5 ----- scripts/tool.js | 11 +++++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/index.html b/index.html index 73785c9..f11876a 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,6 @@ function Acels (client) { this.el.id = 'acels' this.order = [] this.all = {} - this.roles = {} this.pipe = null this.install = (host = document.body) => { window.addEventListener('keydown', this.onKeyDown, false) @@ -44,9 +43,6 @@ function Acels (client) { if (this.order.indexOf(cat) < 0) { this.order.push(cat) } this.all[accelerator] = { cat, name, downfn, upfn, accelerator } } - this.add = (cat, role) => { - this.all[':' + role] = { cat, name: role, role } - } this.get = (accelerator) => { return this.all[accelerator] } @@ -455,6 +451,7 @@ function Client () { this.tool.start() this.renderer.start() this.interface.start() + this.history.push(this.layers) // initial state this.source.new() this.onResize() this.interface.update(true) // force an update @@ -1256,9 +1253,6 @@ function Tool (client) { this.styles[1].color = client.theme.active.f_med this.styles[2].color = client.theme.active.f_low } - this.erase = function () { - this.layers = [[], [], []] - } this.reset = function () { this.styles[0].mirror_style = 0 this.styles[1].mirror_style = 0 @@ -1270,6 +1264,12 @@ function Tool (client) { this.vertices = [] this.index = 0 } + this.erase = function () { + this.layers = [[], [], []] + this.vertices = [] + client.renderer.update() + client.interface.update(true) + } this.clear = function () { this.vertices = [] client.renderer.update() diff --git a/scripts/client.js b/scripts/client.js index 18805c0..cec13a8 100644 --- a/scripts/client.js +++ b/scripts/client.js @@ -101,6 +101,8 @@ function Client () { this.renderer.start() this.interface.start() + this.history.push(this.layers) // initial state + this.source.new() this.onResize() diff --git a/scripts/lib/acels.js b/scripts/lib/acels.js index 740b2e7..80ab5ed 100644 --- a/scripts/lib/acels.js +++ b/scripts/lib/acels.js @@ -6,7 +6,6 @@ function Acels (client) { this.order = [] this.all = {} - this.roles = {} this.pipe = null this.install = (host = document.body) => { @@ -40,10 +39,6 @@ function Acels (client) { this.all[accelerator] = { cat, name, downfn, upfn, accelerator } } - this.add = (cat, role) => { - this.all[':' + role] = { cat, name: role, role } - } - this.get = (accelerator) => { return this.all[accelerator] } diff --git a/scripts/tool.js b/scripts/tool.js index 8720502..03fdd59 100644 --- a/scripts/tool.js +++ b/scripts/tool.js @@ -20,10 +20,6 @@ function Tool (client) { this.styles[2].color = client.theme.active.f_low } - this.erase = function () { - this.layers = [[], [], []] - } - this.reset = function () { this.styles[0].mirror_style = 0 this.styles[1].mirror_style = 0 @@ -36,6 +32,13 @@ function Tool (client) { this.index = 0 } + this.erase = function () { + this.layers = [[], [], []] + this.vertices = [] + client.renderer.update() + client.interface.update(true) + } + this.clear = function () { this.vertices = [] client.renderer.update()