diff --git a/src/commands/index.js b/src/commands/index.js index 476eb3f19..ecb64a398 100644 --- a/src/commands/index.js +++ b/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 diff --git a/src/commands/view/ComponentDrag.js b/src/commands/view/ComponentDrag.js index 09b104a26..33ba89075 100644 --- a/src/commands/view/ComponentDrag.js +++ b/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'](); } };