Browse Source

Add and use getModel in canvas module

pull/3411/head
Artur Arseniev 6 years ago
parent
commit
dd58554e52
  1. 4
      src/canvas/index.js
  2. 9
      src/commands/view/SwitchVisibility.js

4
src/canvas/index.js

@ -84,6 +84,10 @@ export default () => {
return this; return this;
}, },
getModel() {
return canvas;
},
/** /**
* Get the configuration object * Get the configuration object
* @return {Object} * @return {Object}

9
src/commands/view/SwitchVisibility.js

@ -15,9 +15,12 @@ export default {
toggleVis(ed, active = 1) { toggleVis(ed, active = 1) {
if (!ed.Commands.isActive('preview')) { if (!ed.Commands.isActive('preview')) {
const cvModel = ed.Canvas.getCanvasView().model; const cv = ed.Canvas;
ed.Canvas.getFrames().forEach(frame => this._upFrame(frame, active)); cv.getFrames().forEach(frame => this._upFrame(frame, active));
cvModel[active ? 'on' : 'off']('change:frames', this._onFramesChange); cv.getModel()[active ? 'on' : 'off'](
'change:frames',
this._onFramesChange
);
} }
}, },

Loading…
Cancel
Save