Browse Source

Add a tiny patch to prevent parent selection on drop (in absolute mode)

pull/2090/head
Artur Arseniev 7 years ago
parent
commit
ceaaf60136
  1. 3
      src/commands/index.js
  2. 2
      src/commands/view/SelectComponent.js

3
src/commands/index.js

@ -130,6 +130,9 @@ module.exports = () => {
const modes = ['absolute', 'translate']; const modes = ['absolute', 'translate'];
const hideTlb = () => em.stopDefault(defComOptions); 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')) { if (!sel || !sel.get('draggable')) {
console.warn('The element is not draggable'); console.warn('The element is not draggable');
return; return;

2
src/commands/view/SelectComponent.js

@ -176,7 +176,9 @@ module.exports = {
* @private * @private
*/ */
onClick(e) { onClick(e) {
const { em } = this;
e.stopPropagation(); e.stopPropagation();
if (em.get('_cmpDrag')) return em.set('_cmpDrag');
const $el = $(e.target); const $el = $(e.target);
let model = $el.data('model'); let model = $el.data('model');

Loading…
Cancel
Save