Added merge
This commit is contained in:
parent
65698e937d
commit
b13c811703
@ -84,6 +84,7 @@
|
|||||||
DOTGRID.controller.add("default","Layers","Background",() => { DOTGRID.tool.select_layer(2) },"CmdOrCtrl+3");
|
DOTGRID.controller.add("default","Layers","Background",() => { DOTGRID.tool.select_layer(2) },"CmdOrCtrl+3");
|
||||||
DOTGRID.controller.add("default","Layers","Next Layer",() => { DOTGRID.tool.select_next_layer() },"Tab");
|
DOTGRID.controller.add("default","Layers","Next Layer",() => { DOTGRID.tool.select_next_layer() },"Tab");
|
||||||
DOTGRID.controller.add("default","Layers","Prev Layer",() => { DOTGRID.tool.select_prev_layer() },"Shift+Tab");
|
DOTGRID.controller.add("default","Layers","Prev Layer",() => { DOTGRID.tool.select_prev_layer() },"Shift+Tab");
|
||||||
|
DOTGRID.controller.add("default","Layers","Merge Layers",() => { DOTGRID.tool.merge() },"M");
|
||||||
|
|
||||||
DOTGRID.controller.add("default","View","Color Picker",() => { DOTGRID.picker.start(); },"G");
|
DOTGRID.controller.add("default","View","Color Picker",() => { DOTGRID.picker.start(); },"G");
|
||||||
DOTGRID.controller.add("default","View","Toggle Grid",() => { DOTGRID.guide.toggle(); },"H");
|
DOTGRID.controller.add("default","View","Toggle Grid",() => { DOTGRID.guide.toggle(); },"H");
|
||||||
|
@ -18,6 +18,10 @@ DOTGRID.Tool = function () {
|
|||||||
this.styles[2].color = DOTGRID.theme.active.f_low
|
this.styles[2].color = DOTGRID.theme.active.f_low
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.erase = function () {
|
||||||
|
this.layers = [[], [], []]
|
||||||
|
}
|
||||||
|
|
||||||
this.reset = function () {
|
this.reset = function () {
|
||||||
this.styles[0].mirror_style = 0
|
this.styles[0].mirror_style = 0
|
||||||
this.styles[1].mirror_style = 0
|
this.styles[1].mirror_style = 0
|
||||||
@ -25,7 +29,7 @@ DOTGRID.Tool = function () {
|
|||||||
this.styles[0].fill = 'none'
|
this.styles[0].fill = 'none'
|
||||||
this.styles[1].fill = 'none'
|
this.styles[1].fill = 'none'
|
||||||
this.styles[2].fill = 'none'
|
this.styles[2].fill = 'none'
|
||||||
this.layers = [[], [], []]
|
this.erase()
|
||||||
this.vertices = []
|
this.vertices = []
|
||||||
this.index = 0
|
this.index = 0
|
||||||
}
|
}
|
||||||
@ -315,6 +319,16 @@ DOTGRID.Tool = function () {
|
|||||||
DOTGRID.guide.update()
|
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
|
// Style
|
||||||
|
|
||||||
this.style = function () {
|
this.style = function () {
|
||||||
|
@ -6,33 +6,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"layers": [
|
"layers": [
|
||||||
[
|
|
||||||
{
|
|
||||||
"type": "arc_c",
|
|
||||||
"vertices": [
|
|
||||||
{
|
|
||||||
"x": 135,
|
|
||||||
"y": 165
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"x": 165,
|
|
||||||
"y": 135
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"x": 195,
|
|
||||||
"y": 165
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"x": 165,
|
|
||||||
"y": 195
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"x": 135,
|
|
||||||
"y": 165
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"type": "arc_r",
|
"type": "arc_r",
|
||||||
@ -80,9 +53,32 @@
|
|||||||
"y": 165
|
"y": 165
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
],
|
{
|
||||||
[
|
"type": "arc_c",
|
||||||
|
"vertices": [
|
||||||
|
{
|
||||||
|
"x": 135,
|
||||||
|
"y": 165
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 165,
|
||||||
|
"y": 135
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 195,
|
||||||
|
"y": 165
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 165,
|
||||||
|
"y": 195
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 135,
|
||||||
|
"y": 165
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "arc_c",
|
"type": "arc_c",
|
||||||
"vertices": [
|
"vertices": [
|
||||||
@ -112,7 +108,72 @@
|
|||||||
"type": "close",
|
"type": "close",
|
||||||
"vertices": []
|
"vertices": []
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "arc_r",
|
||||||
|
"vertices": [
|
||||||
|
{
|
||||||
|
"x": 255,
|
||||||
|
"y": 165
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 165,
|
||||||
|
"y": 75
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 75,
|
||||||
|
"y": 165
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 135,
|
||||||
|
"y": 225
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 195,
|
||||||
|
"y": 165
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "arc_c",
|
||||||
|
"vertices": [
|
||||||
|
{
|
||||||
|
"x": 195,
|
||||||
|
"y": 165
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 195,
|
||||||
|
"y": 165
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 165,
|
||||||
|
"y": 195
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 135,
|
||||||
|
"y": 165
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 135,
|
||||||
|
"y": 165
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 195,
|
||||||
|
"y": 105
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 255,
|
||||||
|
"y": 165
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "close",
|
||||||
|
"vertices": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[]
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
{
|
{
|
||||||
@ -128,7 +189,7 @@
|
|||||||
"strokeLinecap": "round",
|
"strokeLinecap": "round",
|
||||||
"strokeLinejoin": "round",
|
"strokeLinejoin": "round",
|
||||||
"color": "#000",
|
"color": "#000",
|
||||||
"fill": "none",
|
"fill": "#000",
|
||||||
"mirror_style": 0
|
"mirror_style": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,8 @@ document.onkeyup = (e) =>
|
|||||||
if(ch == "]"){ DOTGRID.tool.toggle("thickness",5); e.preventDefault(); }
|
if(ch == "]"){ DOTGRID.tool.toggle("thickness",5); 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 == "i"){ DOTGRID.theme.invert(); e.preventDefault(); }
|
if(ch == "i"){ DOTGRID.theme.invert(); e.preventDefault(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user