Browse Source

Prevent issues with devices with the same width. Fixes #727

pull/758/head
Artur Arseniev 8 years ago
parent
commit
1e02fcb102
  1. 13
      src/canvas/view/FrameView.js
  2. 1
      src/editor/index.js

13
src/canvas/view/FrameView.js

@ -27,11 +27,18 @@ module.exports = require('backbone').View.extend({
const em = this.em;
const device = em.getDeviceModel();
const style = this.el.style;
style.width = device ? device.get('width') : '';
style.height = device ? device.get('height') : '';
const currW = style.width || '';
const currH = style.height || '';
const newW = device ? device.get('width') : '';
const newH = device ? device.get('height') : '';
const noChanges = currW == newW && currH == newH;
style.width = newW;
style.height = newH;
this.udpateOffset();
// Prevent fixed highlighting box which appears when on
// component hover during the animation
em.stopDefault({ preserveSelected: 1 });
this.$el.on(motionsEv, this.udpateOffset);
noChanges ? this.udpateOffset() : this.$el.on(motionsEv, this.udpateOffset);
},
udpateOffset() {

1
src/editor/index.js

@ -10,6 +10,7 @@
*
* ## Components
* * `component:add` - Triggered when a new component is added to the editor, the model is passed as an argument to the callback
* * `component:clone` - Triggered when a new component is added by a clone command, the model is passed as an argument to the callback
* * `component:update` - Triggered when a component is updated (moved, styled, etc.), the model is passed as an argument to the callback
* * `component:update:{propertyName}` - Listen any property change, the model is passed as an argument to the callback
* * `component:styleUpdate` - Triggered when the style of the component is updated, the model is passed as an argument to the callback

Loading…
Cancel
Save