From ceaaf60136fc375875a654d0ab0fcbf6594386bc Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sat, 15 Jun 2019 09:55:45 +0200 Subject: [PATCH] Add a tiny patch to prevent parent selection on drop (in absolute mode) --- src/commands/index.js | 3 +++ src/commands/view/SelectComponent.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/commands/index.js b/src/commands/index.js index f397a8336..33a1a2cfa 100644 --- a/src/commands/index.js +++ b/src/commands/index.js @@ -130,6 +130,9 @@ module.exports = () => { const modes = ['absolute', 'translate']; const hideTlb = () => em.stopDefault(defComOptions); + // Dirty patch to prevent parent selection on drop (in absolute mode) + em.set('_cmpDrag', 1); + if (!sel || !sel.get('draggable')) { console.warn('The element is not draggable'); return; diff --git a/src/commands/view/SelectComponent.js b/src/commands/view/SelectComponent.js index 718f82225..91c0385b7 100644 --- a/src/commands/view/SelectComponent.js +++ b/src/commands/view/SelectComponent.js @@ -176,7 +176,9 @@ module.exports = { * @private */ onClick(e) { + const { em } = this; e.stopPropagation(); + if (em.get('_cmpDrag')) return em.set('_cmpDrag'); const $el = $(e.target); let model = $el.data('model');