From 47433f65159ddd804dc22c02f25efb6fe8270682 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Tue, 21 Jan 2020 07:59:40 +0100 Subject: [PATCH] Add debounce in updateDim to prevent double changes --- src/canvas/view/FrameWrapView.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/canvas/view/FrameWrapView.js b/src/canvas/view/FrameWrapView.js index 20b91cfee..82f524901 100644 --- a/src/canvas/view/FrameWrapView.js +++ b/src/canvas/view/FrameWrapView.js @@ -88,14 +88,14 @@ export default Backbone.View.extend({ * Update dimensions of the frame * @private */ - updateDim() { + updateDim: debounce(function() { const { em, el, $el, model, classAnim } = this; const { width, height } = model.attributes; const { style } = el; const currW = style.width || ''; const currH = style.height || ''; - const newW = width; - const newH = height; + const newW = width || ''; + const newH = height || ''; const noChanges = currW == newW && currH == newH; const un = 'px'; this.frame.rect = 0; @@ -116,7 +116,7 @@ export default Backbone.View.extend({ // component hover during the animation em.stopDefault({ preserveSelected: 1 }); noChanges ? this.updateOffset() : $el.one(motionsEv, this.updateOffset); - }, + }), onScroll() { const { frame, em } = this;