diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 113fc8208..76ff7e1a9 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -72,6 +72,7 @@ module.exports = { ['/api/panels', 'Panels'], ['/api/pages', 'Pages'], ['/api/page', `${subDivider}Page`], + ['/api/layer_manager', 'Layers'], ['/api/style_manager', 'Style Manager'], ['/api/sector', `${subDivider}Sector`], ['/api/property', `${subDivider}Property`], diff --git a/docs/api/layer_manager.md b/docs/api/layer_manager.md index 1a3557d1c..7e4f248a6 100644 --- a/docs/api/layer_manager.md +++ b/docs/api/layer_manager.md @@ -28,7 +28,15 @@ const layers = editor.Layers; * [setRoot][1] * [getRoot][2] -* [getLayerData][3] +* [getComponents][3] +* [setOpen][4] +* [isOpen][5] +* [setVisible][6] +* [isVisible][7] +* [setlocked][8] +* [isLocked][9] +* [setName][10] +* [getLayerData][11] [Page]: page.html @@ -40,7 +48,7 @@ Update root layer with another component. ### Parameters -* `component` **([Component] | [String][4])** Component to be set as root +* `component` **([Component] | [String][12])** Component to be set as root ### Examples @@ -63,77 +71,132 @@ const layerRoot = layers.getRoot(); Returns **[Component]** -## getLayerData +## getComponents -Get layer data from a component. +Get valid layer child components (eg. excludes non layerable components). ### Parameters -* `component` **[Component]** Component from which you want to read layer data. +* `component` **[Component]** Component from which you want to get child components ### Examples ```javascript const component = editor.getSelected(); -const layerData = layers.getLayerData(component); -console.log(layerData); +const components = layers.getComponents(component); +console.log(components); ``` -Returns **LayerData** Object containing layer data +Returns **[Array][13]<[Component]>** + +## setOpen + +Update the layer open state of the component. + +### Parameters + +* `component` **[Component]** Component to update +* `value` **[Boolean][14]** + +## isOpen + +Check the layer open state of the component. + +### Parameters + +* `component` **[Component]** + +Returns **[Boolean][14]** ## setVisible -Update component visibility +Update the layer visibility state of the component. ### Parameters -* `component` **Component** -* `value` **[boolean][5]** +* `component` **[Component]** Component to update +* `value` **[Boolean][14]** ## isVisible -Check if the component is visible +Check the layer visibility state of the component. ### Parameters -* `component` **Component** +* `component` **[Component]** -Returns **[boolean][5]** +Returns **[Boolean][14]** ## setLocked -Update component locked value +Update the layer locked state of the component. ### Parameters -* `component` **Component** -* `value` **[boolean][5]** +* `component` **[Component]** Component to update +* `value` **[Boolean][14]** ## isLocked -Check if the component is locked +Check the layer locked state of the component. ### Parameters -* `component` **Component** +* `component` **[Component]** -Returns **[boolean][5]** +Returns **[Boolean][14]** ## setName -Update component name +Update the layer name state of the component. + +### Parameters + +* `component` **[Component]** Component to update +* `value` **[String][12]** New name + +## getLayerData + +Get layer data from a component. ### Parameters -* `component` **Component** -* `value` **[string][4]** +* `component` **[Component]** Component from which you want to read layer data. + +### Examples + +```javascript +const component = editor.getSelected(); +const layerData = layers.getLayerData(component); +console.log(layerData); +``` + +Returns **LayerData** Object containing layer data [1]: #setroot [2]: #getroot -[3]: #getlayerdata +[3]: #getcomponents + +[4]: #setopen + +[5]: #isopen + +[6]: #setvisible + +[7]: #isvisible + +[8]: #setlocked + +[9]: #islocked + +[10]: #setname + +[11]: #getlayerdata + +[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array -[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean diff --git a/src/navigator/index.ts b/src/navigator/index.ts index 684cc1d43..0acb19b30 100644 --- a/src/navigator/index.ts +++ b/src/navigator/index.ts @@ -107,7 +107,7 @@ export default class LayerManager extends Module { } /** - * Update root layer with another component. + * Update the root layer with another component. * @param {[Component]|String} component Component to be set as root * @return {[Component]} * @example