Browse Source

Update toggleDrag

pull/1840/head
Artur Arseniev 7 years ago
parent
commit
0bd4ac2fe8
  1. 1
      src/commands/index.js
  2. 9
      src/commands/view/ComponentDrag.js

1
src/commands/index.js

@ -143,7 +143,6 @@ module.exports = () => {
// TODO move grabbing func in editor/canvas from the Sorter
dragger = editor.runCommand('core:component-drag', {
target: sel,
el: sel.view.el,
options: {
event,
onEnd

9
src/commands/view/ComponentDrag.js

@ -51,7 +51,7 @@ module.exports = {
},
setPosition
};
this.editor = editor;
let dragger = this.dragger;
if (!dragger) {
@ -71,11 +71,12 @@ module.exports = {
this.toggleDrag();
},
toggleDrag(enable) {
const { ppfx } = this;
const methodCls = enable ? 'add' : 'remove';
toggleDrag(on) {
const { ppfx, editor } = this;
const methodCls = on ? 'add' : 'remove';
const canvas = this.getCanvas();
const classes = [`${ppfx}is__grabbing`];
classes.forEach(cls => canvas.classList[methodCls](cls));
editor.Canvas[on ? 'startAutoscroll' : 'stopAutoscroll']();
}
};

Loading…
Cancel
Save