hide and show layers
This commit is contained in:
parent
528593d705
commit
f0e1a2910f
12
src/main.js
12
src/main.js
|
|
@ -1160,6 +1160,7 @@ class Layer {
|
||||||
}
|
}
|
||||||
this.name = "Layer"
|
this.name = "Layer"
|
||||||
this.frames = [new Frame("keyframe", this.idx+"-F1")]
|
this.frames = [new Frame("keyframe", this.idx+"-F1")]
|
||||||
|
this.visible = true
|
||||||
pointerList[this.idx] = this
|
pointerList[this.idx] = this
|
||||||
}
|
}
|
||||||
getFrame(num) {
|
getFrame(num) {
|
||||||
|
|
@ -1273,6 +1274,11 @@ class Layer {
|
||||||
}
|
}
|
||||||
return newLayer
|
return newLayer
|
||||||
}
|
}
|
||||||
|
toggleVisibility() {
|
||||||
|
this.visible = !this.visible
|
||||||
|
updateUI()
|
||||||
|
updateMenu()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AudioLayer {
|
class AudioLayer {
|
||||||
|
|
@ -1776,6 +1782,7 @@ class GraphicsObject {
|
||||||
// this.currentFrameNum = 0;
|
// this.currentFrameNum = 0;
|
||||||
// }
|
// }
|
||||||
for (let layer of this.layers) {
|
for (let layer of this.layers) {
|
||||||
|
if (!layer.visible) continue;
|
||||||
let frame = layer.getFrame(this.currentFrameNum)
|
let frame = layer.getFrame(this.currentFrameNum)
|
||||||
for (let shape of frame.shapes) {
|
for (let shape of frame.shapes) {
|
||||||
if (context.shapeselection.indexOf(shape) >= 0) {
|
if (context.shapeselection.indexOf(shape) >= 0) {
|
||||||
|
|
@ -3611,6 +3618,11 @@ async function updateMenu() {
|
||||||
enabled: context.activeObject.layers.length > 1,
|
enabled: context.activeObject.layers.length > 1,
|
||||||
action: actions.deleteLayer.create
|
action: actions.deleteLayer.create
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: context.activeObject.activeLayer.visible ? "Hide Layer" : "Show Layer",
|
||||||
|
enabled: true,
|
||||||
|
action: () => {context.activeObject.activeLayer.toggleVisibility()}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue