Browse Source

Clear ComponentDrag command

drag-autoscroll-fix
Artur Arseniev 7 years ago
parent
commit
ef3b19ed48
  1. 14
      src/commands/view/ComponentDrag.js

14
src/commands/view/ComponentDrag.js

@ -1,5 +1,4 @@
import { keys, bindAll, each, isUndefined } from 'underscore';
import { on, off } from 'utils/mixins';
import Dragger from 'utils/Dragger';
module.exports = {
@ -13,8 +12,7 @@ module.exports = {
'getPosition',
'getGuidesStatic',
'renderGuide',
'getGuidesTarget',
'handleScroll'
'getGuidesTarget'
);
const { target, event, mode, dragger = {} } = opts;
const el = target.getEl();
@ -415,23 +413,13 @@ module.exports = {
});
},
handleScroll(ev) {
console.log('Im scrolling', this.ppfx, { evY: ev.clientY, ev });
},
toggleDrag(enable) {
const { ppfx, editor } = this;
const methods = { on, off };
const methodCls = enable ? 'add' : 'remove';
const canvas = this.getCanvas();
const classes = [`${ppfx}is__grabbing`];
const { Canvas } = editor;
classes.forEach(cls => canvas.classList[methodCls](cls));
Canvas[enable ? 'startAutoscroll' : 'stopAutoscroll']();
methods[enable ? 'on' : 'off'](
Canvas.getWindow(),
'scroll',
this.handleScroll
);
}
};

Loading…
Cancel
Save