Added merge

This commit is contained in:
Devine Lu Linvega
2019-01-08 10:34:57 +12:00
parent 65698e937d
commit b13c811703
4 changed files with 111 additions and 33 deletions

View File

@@ -18,6 +18,10 @@ DOTGRID.Tool = function () {
this.styles[2].color = DOTGRID.theme.active.f_low
}
this.erase = function () {
this.layers = [[], [], []]
}
this.reset = function () {
this.styles[0].mirror_style = 0
this.styles[1].mirror_style = 0
@@ -25,7 +29,7 @@ DOTGRID.Tool = function () {
this.styles[0].fill = 'none'
this.styles[1].fill = 'none'
this.styles[2].fill = 'none'
this.layers = [[], [], []]
this.erase()
this.vertices = []
this.index = 0
}
@@ -315,6 +319,16 @@ DOTGRID.Tool = function () {
DOTGRID.guide.update()
}
this.merge = function () {
const merged = [].concat(this.layers[0]).concat(this.layers[1]).concat(this.layers[2])
this.erase()
this.layers[this.index] = merged
DOTGRID.history.push(this.layers)
this.clear()
DOTGRID.guide.update()
}
// Style
this.style = function () {