Browse Source

Enable SelectComponent for multi-frames

pull/2524/head
Artur Arseniev 7 years ago
parent
commit
b56efdfe51
  1. 1
      src/canvas/view/FrameView.js
  2. 21
      src/commands/view/SelectComponent.js

1
src/canvas/view/FrameView.js

@ -31,6 +31,7 @@ export default Backbone.View.extend({
this.listenTo(model, 'change:x change:y', this.updatePos);
this.listenTo(this.em, 'change:device', this.updateDim);
this.updatePos();
model.view = this;
},
updatePos(md) {

21
src/commands/view/SelectComponent.js

@ -48,12 +48,21 @@ export default {
const methods = { on, off };
const body = this.getCanvasBody();
const win = this.getContentWindow();
methods[method](body, 'mouseover', this.onHover);
methods[method](body, 'mouseout', this.onOut);
methods[method](body, 'click touchend', this.onClick);
methods[method](win, 'scroll resize', this.onFrameScroll);
em[method]('component:toggled', this.onSelect, this);
em[method]('change:componentHovered', this.onHovered, this);
const trigger = (win, body) => {
methods[method](body, 'mouseover', this.onHover);
methods[method](body, 'mouseout', this.onOut);
methods[method](body, 'click touchend', this.onClick);
methods[method](win, 'scroll resize', this.onFrameScroll);
em[method]('component:toggled', this.onSelect, this);
em[method]('change:componentHovered', this.onHovered, this);
};
trigger(win, body);
em.get('Canvas')
.getFrames()
.forEach(frame => {
const { view } = frame;
trigger(view.getWindow(), view.getBody());
});
},
/**

Loading…
Cancel
Save