Skip to content

Commit

Permalink
Add LayerManager at Editor level
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Feb 1, 2018
1 parent 610decc commit 660039e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ module.exports = config => {
*/
DomComponents: em.get('DomComponents'),

/**
* @property {LayerManager}
* @private
*/
LayerManager: em.get('LayerManager'),

/**
* @property {CssComposer}
* @private
Expand Down
16 changes: 7 additions & 9 deletions src/navigator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = () => {
const options = {
level: 0,
config,
el: config.el,
opened: config.opened || {}
};

Expand Down Expand Up @@ -53,18 +54,11 @@ module.exports = () => {
* @private
*/
componentChanged(e, md, opts = {}) {
if (opts.fromLayers) {
return;
}

const em = config.em;
if (opts.fromLayers) return;
const opened = em.get('opened');
const model = em.getSelected();
let parent = model && model.collection ? model.collection.parent : null;

for (let cid in opened) {
opened[cid].set('open', 0);
}
for (let cid in opened) opened[cid].set('open', 0);

while (parent) {
parent.set('open', 1);
Expand All @@ -73,6 +67,10 @@ module.exports = () => {
}
},

postRender() {
console.log('post render navigator', config);
},

render() {
return layers.render().$el;
}
Expand Down

0 comments on commit 660039e

Please sign in to comment.