diff --git a/src/canvas/view/CanvasView.js b/src/canvas/view/CanvasView.js index d5f6e1dca..50f443f00 100644 --- a/src/canvas/view/CanvasView.js +++ b/src/canvas/view/CanvasView.js @@ -36,7 +36,15 @@ export default Backbone.View.extend({ this.pfx = this.config.stylePrefix || ''; this.ppfx = this.config.pStylePrefix || ''; this.className = this.config.stylePrefix + 'canvas'; - const { em } = this; + const { em, config } = this; + this.frames = new FramesView({ + collection: model.get('frames'), + config: { + ...config, + canvasView: this, + renderContent: 1 + } + }); this.listenTo(em, 'change:canvasOffset', this.clearOff); this.listenTo(em, 'component:selected', this.checkSelected); this.listenTo(model, 'change:zoom change:x change:y', this.updateFrames); @@ -492,7 +500,7 @@ export default Backbone.View.extend({ }, render() { - const { el, $el, ppfx, model, config, em } = this; + const { el, $el, ppfx, model, em, frames } = this; const cssc = em.get('CssComposer'); const wrapper = model.get('wrapper'); $el.html(this.template()); @@ -548,14 +556,6 @@ export default Backbone.View.extend({ // Render all frames const frms = model.get('frames'); - const frames = new FramesView({ - collection: frms, - config: { - ...config, - renderContent: 1, - canvasView: this - } - }); frms.listenToLoad(); frms.on('loaded:all', () => em.trigger('loaded')); frames.render(); diff --git a/src/canvas/view/FrameWrapView.js b/src/canvas/view/FrameWrapView.js index dcc3fadae..d465bce65 100644 --- a/src/canvas/view/FrameWrapView.js +++ b/src/canvas/view/FrameWrapView.js @@ -87,6 +87,7 @@ export default Backbone.View.extend({ * @private */ updateDim() { + console.log('updateDim'); const { em, el, $el, model } = this; const { width, height } = model.attributes; const { style } = el; diff --git a/src/editor/view/EditorView.js b/src/editor/view/EditorView.js index d3c8391be..360332e8b 100644 --- a/src/editor/view/EditorView.js +++ b/src/editor/view/EditorView.js @@ -9,9 +9,11 @@ export default Backbone.View.extend({ model.view = this; this.conf = model.config; this.pn = model.get('Panels'); + this.cv = model.get('Canvas'); model.on('loaded', () => { this.pn.active(); this.pn.disableButtons(); + console.log('editorView runDefault'); model.runDefault(); setTimeout(() => model.trigger('load', model.get('Editor'))); }); @@ -27,7 +29,7 @@ export default Backbone.View.extend({ if (conf.width) contEl.css('width', conf.width); if (conf.height) contEl.css('height', conf.height); - $el.append(model.get('Canvas').render()); + $el.append(this.cv.render()); $el.append(this.pn.render()); $el.attr('class', `${pfx}editor ${pfx}one-bg ${pfx}two-color`); contEl