Plug-In: Show Layers
A pair of plug-ins for controlling visibility of the layers of the current canvas.
- Show Layers with Selected Graphics • Hides all layers of the current canvas that do not contain a selected graphic.
- Show All Layers • Shows all layers of the current canvas.
Return to: OmniGraffle Plug-In Collection
Show Layers with Selected Graphics
/*{
"type": "action",
"targets": ["omnigraffle"],
"author": "Otto Automator",
"identifier": "com.omni-automation-og-show-layers-with-selected-graphics",
"version": "1.0",
"description": "Hides all layers of the current canvas that do not contain a selected graphic.",
"label": "Show Layers with Selected Graphics",
"shortLabel": "Layers with Graphics",
"paletteLabel": "Layers with Graphics",
"image": "square.3.layers.3d.top.filled"
}*/
(() => {
const action = new PlugIn.Action(async function(selection, sender){
try {
cnvs = selection.canvas
graphx = selection.graphics
// hide all layers
cnvs.layers.forEach(layer => {layer.visible = false})
// show layers that contain a selected graphic
graphx.forEach(graphk => {graphk.layer.visible = true})
}
catch(err){
new Alert(err.name, err.message).show()
}
});
action.validate = function(selection, sender){
return (selection.graphics.length > 0)
};
return action;
})();
Show All Layers
/*{
"type": "action",
"targets": ["omnigraffle"],
"author": "Otto Automator",
"identifier": "com.omni-automation.og.show-all-layers",
"version": "1.0",
"description": "Shows all layers of the current canvas.",
"label": "Show All Layers",
"shortLabel": "Show All Layers",
"paletteLabel": "Show All Layers",
"image": "square.3.layers.3d.top.filled"
}*/
(() => {
const action = new PlugIn.Action(async function(selection, sender){
selection.canvas.layers.forEach(layr => {layr.visible = true})
});
action.validate = function(selection, sender){
return true
};
return action;
})();