Add button to toggle layer as mask
This commit is contained in:
parent
a4236752ab
commit
7a93075312
@ -35,7 +35,7 @@ body { padding: 0px; font-family:"input_mono_regular",courier,monospace; -webkit
|
||||
#interface #menu svg.icon#option_color { opacity: 1.0; z-index:1001; position: relative; }
|
||||
#interface #menu svg.icon#option_color:hover { opacity: 0.8 }
|
||||
|
||||
#interface #picker { position: absolute; line-height: 20px; z-index: 0; width: 30px; opacity: 0; transition: all 250ms; font-size: 11px; border-radius: 3px; left: 200px; top: 0px; text-transform: uppercase; height:20px; padding:5px 0px;left:280px; overflow:hidden;}
|
||||
#interface #picker { position: absolute; line-height: 20px; z-index: 0; width: 30px; opacity: 0; transition: all 250ms; font-size: 11px; border-radius: 3px; left: 200px; top: 0px; text-transform: uppercase; height:20px; padding:5px 0px;left:310px; overflow:hidden;}
|
||||
#interface #picker:before { content:"#"; position: absolute; left:10px; opacity: 0; transition: opacity 500ms}
|
||||
#interface #picker input { background:transparent; position: absolute; left: 20px; height: 20px; width: 60px; line-height: 20px; opacity: 0; transition: opacity 500ms; text-transform: uppercase;}
|
||||
#interface #color_path { transition: all 500ms; }
|
||||
@ -47,6 +47,7 @@ body { padding: 0px; font-family:"input_mono_regular",courier,monospace; -webkit
|
||||
#interface.picker #option_thickness { opacity: 0 !important }
|
||||
#interface.picker #option_mirror { opacity: 0 !important }
|
||||
#interface.picker #option_fill { opacity: 0 !important }
|
||||
#interface.picker #option_mask { opacity: 0 !important }
|
||||
|
||||
/* Web Specific */
|
||||
|
||||
|
@ -79,6 +79,7 @@ function Client () {
|
||||
this.acels.set('Style', 'Linejoin', 'W', () => { this.tool.toggle('linejoin') })
|
||||
this.acels.set('Style', 'Mirror', 'E', () => { this.tool.toggle('mirror') })
|
||||
this.acels.set('Style', 'Fill', 'R', () => { this.tool.toggle('fill') })
|
||||
this.acels.set('Style', 'Mask', 'C', () => { this.tool.toggle('mask') })
|
||||
this.acels.set('Style', 'Thicker', '}', () => { this.tool.toggle('thickness', 1) })
|
||||
this.acels.set('Style', 'Thinner', '{', () => { this.tool.toggle('thickness', -1) })
|
||||
this.acels.set('Style', 'Thicker +5', ']', () => { this.tool.toggle('thickness', 5) })
|
||||
|
@ -23,7 +23,8 @@ function Interface (client) {
|
||||
linejoin: { key: 'W', icon: 'M60,60 L120,120 L180,120 M120,180 L180,180 L240,240' },
|
||||
thickness: { key: '', icon: 'M120,90 L120,90 L90,120 L180,210 L210,180 Z M105,105 L105,105 L60,60 M195,195 L195,195 L240,240' },
|
||||
mirror: { key: 'E', icon: 'M60,60 L60,60 L120,120 M180,180 L180,180 L240,240 M210,90 L210,90 L180,120 M120,180 L120,180 L90,210' },
|
||||
fill: { key: 'R', icon: 'M60,60 L60,150 L150,150 L240,150 L240,240 Z' }
|
||||
fill: { key: 'R', icon: 'M60,60 L60,150 L150,150 L240,150 L240,240 Z' },
|
||||
mask: { key: 'C', icon: 'M105,180 L105,180 L105,240 L240,240 L240,105 L180,105 L105,105 M105,180 L105,180 L105,105 M60,60 L60,60 L60,150 L150,150 L150,60 Z ' }
|
||||
},
|
||||
misc: {
|
||||
color: { key: 'G', icon: 'M150,60 A90,90 0 0,1 240,150 A-90,90 0 0,1 150,240 A-90,-90 0 0,1 60,150 A90,-90 0 0,1 150,60' }
|
||||
@ -138,6 +139,7 @@ function Interface (client) {
|
||||
options.toggle.linejoin.el.className.baseVal = client.tool.layer().length < 1 || !multiVertices ? 'icon inactive' : 'icon'
|
||||
options.toggle.mirror.el.className.baseVal = client.tool.layer().length < 1 ? 'icon inactive' : 'icon'
|
||||
options.toggle.fill.el.className.baseVal = client.tool.layer().length < 1 ? 'icon inactive' : 'icon'
|
||||
options.toggle.mask.el.className.baseVal = client.tool.layer().length < 1 ? 'icon inactive' : 'icon'
|
||||
options.misc.color.el.children[0].style.fill = client.tool.style().color
|
||||
options.misc.color.el.children[0].style.stroke = client.tool.style().color
|
||||
options.misc.color.el.className.baseVal = 'icon'
|
||||
@ -149,6 +151,9 @@ function Interface (client) {
|
||||
// Grid
|
||||
document.getElementById('grid_path').setAttribute('d', client.renderer.showExtras ? '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 ' : 'M65,155 Q155,245 245,155 M65,155 ')
|
||||
|
||||
// Mask
|
||||
if (!client.tool.style().mask) { document.getElementById('mask_path').setAttribute('d', 'M105,180 L105,180 L105,240 L240,240 L240,105 L180,105 L105,105 M105,180 L105,180 L105,105 M60,60 L60,60 L60,150 L150,150 L150,60 Z ') } else { document.getElementById('mask_path').setAttribute('d', 'M105,180 L105,180 L105,240 L240,240 L240,105 L180,105 L180,180 M105,180 L105,180 L180,180 M60,60 L60,60 L60,150 L150,150 L150,60 Z ') }
|
||||
|
||||
// Mirror
|
||||
document.getElementById('mirror_path').setAttribute('d', mirrorPaths[client.tool.style().mirror_style])
|
||||
this.prev_operation = client.cursor.operation
|
||||
|
@ -191,6 +191,8 @@ function Tool (client) {
|
||||
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 === 'mask') {
|
||||
this.style().mask = !this.style().mask
|
||||
} else if (type === 'thickness') {
|
||||
this.style().thickness = clamp(this.style().thickness + mod, 1, 100)
|
||||
} else if (type === 'mirror') {
|
||||
|
Loading…
Reference in New Issue
Block a user