Browse Source

Add debounce in updateDim to prevent double changes

pull/2524/head
Artur Arseniev 7 years ago
parent
commit
47433f6515
  1. 8
      src/canvas/view/FrameWrapView.js

8
src/canvas/view/FrameWrapView.js

@ -88,14 +88,14 @@ export default Backbone.View.extend({
* Update dimensions of the frame * Update dimensions of the frame
* @private * @private
*/ */
updateDim() { updateDim: debounce(function() {
const { em, el, $el, model, classAnim } = this; const { em, el, $el, model, classAnim } = this;
const { width, height } = model.attributes; const { width, height } = model.attributes;
const { style } = el; const { style } = el;
const currW = style.width || ''; const currW = style.width || '';
const currH = style.height || ''; const currH = style.height || '';
const newW = width; const newW = width || '';
const newH = height; const newH = height || '';
const noChanges = currW == newW && currH == newH; const noChanges = currW == newW && currH == newH;
const un = 'px'; const un = 'px';
this.frame.rect = 0; this.frame.rect = 0;
@ -116,7 +116,7 @@ export default Backbone.View.extend({
// component hover during the animation // component hover during the animation
em.stopDefault({ preserveSelected: 1 }); em.stopDefault({ preserveSelected: 1 });
noChanges ? this.updateOffset() : $el.one(motionsEv, this.updateOffset); noChanges ? this.updateOffset() : $el.one(motionsEv, this.updateOffset);
}, }),
onScroll() { onScroll() {
const { frame, em } = this; const { frame, em } = this;

Loading…
Cancel
Save