From cf01d30223ac93f46ef34a953a97ae104b97416c Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Mon, 23 Sep 2019 20:25:16 +0200 Subject: [PATCH] Update width and height of the frame after render --- src/canvas/view/FrameView.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/canvas/view/FrameView.js b/src/canvas/view/FrameView.js index e6beeb82b..5931a3572 100644 --- a/src/canvas/view/FrameView.js +++ b/src/canvas/view/FrameView.js @@ -73,6 +73,14 @@ export default Backbone.View.extend({ const un = 'px'; style.width = isNumber(newW) ? `${newW}${un}` : newW; style.height = isNumber(newH) ? `${newH}${un}` : newH; + if (!width || !height) + model.set( + { + ...(!width ? { width: el.offsetWidth } : {}), + ...(!height ? { height: el.offsetHeight } : {}) + }, + { silent: 1 } + ); this.updateOffset(); // Prevent fixed highlighting box which appears when on // component hover during the animation @@ -167,7 +175,6 @@ export default Backbone.View.extend({ const root = model.get('root'); const styles = model.get('styles'); const { em } = config; - const win = this.getWindow(); const doc = this.getDoc(); const body = this.getBody(); const conf = em.get('Config'); @@ -304,6 +311,7 @@ export default Backbone.View.extend({ }) ); + this.updateDim(); this.trigger('loaded'); } });