Fixes #71, issue with history

This commit is contained in:
neauoire 2020-03-26 20:35:30 +09:00
parent ab540c0f74
commit c7912e02fe
4 changed files with 16 additions and 16 deletions

View File

@ -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()

View File

@ -101,6 +101,8 @@ function Client () {
this.renderer.start()
this.interface.start()
this.history.push(this.layers) // initial state
this.source.new()
this.onResize()

View File

@ -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]
}

View File

@ -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()