From d3256e621bb43a537213ffcd86b10dc0bd070c0b Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 19 Nov 2020 14:04:46 +0100 Subject: [PATCH] Prevent frame scroll on the first component drag. Fixes #3134 --- src/canvas/view/FrameView.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/canvas/view/FrameView.js b/src/canvas/view/FrameView.js index ab01e1e34..6d8afa2de 100644 --- a/src/canvas/view/FrameView.js +++ b/src/canvas/view/FrameView.js @@ -1,5 +1,5 @@ import Backbone from 'backbone'; -import { bindAll, isString, debounce } from 'underscore'; +import { bindAll, isString, debounce, isUndefined } from 'underscore'; import CssRulesView from 'css_composer/view/CssRulesView'; import ComponentView from 'dom_components/view/ComponentView'; import { @@ -162,11 +162,12 @@ export default Backbone.View.extend({ autoscroll() { if (this.dragging) { + const { lastClientY } = this; const canvas = this.em.get('Canvas'); const win = this.getWindow(); const body = this.getBody(); const actualTop = body.scrollTop; - const clientY = this.lastClientY || 0; + const clientY = lastClientY || 0; const limitTop = canvas.getConfig().autoscrollLimit; const limitBottom = this.getRect().height - limitTop; let nextTop = actualTop; @@ -180,6 +181,7 @@ export default Backbone.View.extend({ } if ( + !isUndefined(lastClientY) && // Fixes #3134 nextTop !== actualTop && nextTop > 0 && nextTop < this.lastMaxHeight