Disable dragging toolbar items in mobile view since it interferes with scrolling the 3-dots more actions list

This commit is contained in:
nathan 2024-11-21 11:55:33 -07:00
parent a66eb56bde
commit 3e24641d6b

View File

@ -463,10 +463,14 @@ export class et2_toolbar extends et2_DOMWidget implements et2_IInput
this.actionbox[0].classList.add(`et2_toolbar_dropzone_more${this.id}`); this.actionbox[0].classList.add(`et2_toolbar_dropzone_more${this.id}`);
this.actions = actions; this.actions = actions;
if(!egwIsMobile())
{
let dragPosition = {x: 0, y: 0}; let dragPosition = {x: 0, y: 0};
let dragTranslate = {x: 0, y: 0}; let dragTranslate = {x: 0, y: 0};
let draggables = this.getDOMNode().querySelectorAll(`.et2_toolbar_draggable${this.id}`); let draggables = this.getDOMNode().querySelectorAll(`.et2_toolbar_draggable${this.id}`);
draggables.forEach(_item => { draggables.forEach(_item =>
{
interact(_item).draggable({ interact(_item).draggable({
startAxis: 'xy', startAxis: 'xy',
listeners: { listeners: {
@ -502,7 +506,8 @@ export class et2_toolbar extends et2_DOMWidget implements et2_IInput
dropzoneElement, // dropzone element dropzoneElement, // dropzone element
draggable, // draggable Interactable draggable, // draggable Interactable
draggableElement // draggable element draggableElement // draggable element
) { )
{
return dropped && !dropzoneElement.contains(draggableElement); return dropped && !dropzoneElement.contains(draggableElement);
}, },
accept: `.et2_toolbar_draggable${this.id}`, accept: `.et2_toolbar_draggable${this.id}`,
@ -521,7 +526,8 @@ export class et2_toolbar extends et2_DOMWidget implements et2_IInput
} }
}); });
const menulist = [`.et2_toolbar_dropzone_more${this.id}`, `#${this.id}-menulist`]; const menulist = [`.et2_toolbar_dropzone_more${this.id}`, `#${this.id}-menulist`];
menulist.forEach(_item => { menulist.forEach(_item =>
{
interact(_item).unset(); interact(_item).unset();
interact(_item).dropzone({ interact(_item).dropzone({
checker: function( checker: function(
@ -532,7 +538,8 @@ export class et2_toolbar extends et2_DOMWidget implements et2_IInput
dropzoneElement, // dropzone element dropzoneElement, // dropzone element
draggable, // draggable Interactable draggable, // draggable Interactable
draggableElement // draggable element draggableElement // draggable element
) { )
{
console.log(dragEvent); console.log(dragEvent);
return dropped && !dropzoneElement.contains(draggableElement); return dropped && !dropzoneElement.contains(draggableElement);
@ -558,6 +565,7 @@ export class et2_toolbar extends et2_DOMWidget implements et2_IInput
} }
}); });
}); });
}
toolbox.on('toggle', (e)=>{ toolbox.on('toggle', (e)=>{
const details = <HTMLDetailsElement>e.target; const details = <HTMLDetailsElement>e.target;