mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
Slow down tab switch on drag
Avoid another tab being moved underneath the cursor if the target tab has different sidebox menu width, triggering another tab switch
This commit is contained in:
parent
34cc0ff5be
commit
cd22b9aad6
@ -358,10 +358,29 @@ window.egw_fw_ui_tab = function(_parent, _contHeaderDiv, _contDiv, _icon, _callb
|
||||
|
||||
// If dragging something over the tab, activate that app
|
||||
var tab = this.headerDiv;
|
||||
this.headerDiv.addEventListener('dragenter', (event) => {
|
||||
this.headerDiv.addEventListener('dragenter', (event) =>
|
||||
{
|
||||
event.stopPropagation();
|
||||
tab._callbackObject.call(tab);
|
||||
if (!this.headerDiv.parentElement.dataset.dragblock)
|
||||
{
|
||||
this.headerDiv.parentElement.dataset.dragblock = true;
|
||||
tab._callbackObject.call(tab);
|
||||
}
|
||||
tab.parentElement.addEventListener("dragend", dragBlockEnd)
|
||||
tab.parentElement.addEventListener("dragleave", dragBlockEnd)
|
||||
});
|
||||
var dragBlockEnd = (e) =>
|
||||
{
|
||||
|
||||
|
||||
tab.parentElement.removeEventListener("dragend", dragBlockEnd);
|
||||
tab.parentElement.removeEventListener("dragleave", dragBlockEnd);
|
||||
window.clearTimeout(tab.parentElement.dataset.dragblock);
|
||||
tab.parentElement.dataset.dragblock = window.setTimeout(() =>
|
||||
{
|
||||
tab.parentElement.removeAttribute("data-dragblock");
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
||||
//Create the close button and append it to the header div
|
||||
|
Loading…
Reference in New Issue
Block a user