Browse Source

Prevent frame scroll on the first component drag. Fixes #3134

pull/3147/head
Artur Arseniev 6 years ago
parent
commit
d3256e621b
  1. 6
      src/canvas/view/FrameView.js

6
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

Loading…
Cancel
Save