mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fixed context menu. Added feature for off-clicking.
This commit is contained in:
parent
bd51742b94
commit
6e59bbd524
@ -668,6 +668,9 @@
|
||||
}else{
|
||||
$('#unzip').hide();}
|
||||
|
||||
var clientX = event.clientX;
|
||||
var clientY = event.clientY;
|
||||
|
||||
|
||||
|
||||
document.getElementById('files-tree-nav-content')
|
||||
@ -676,12 +679,27 @@
|
||||
.setAttribute('data-name', ctxmenuName);
|
||||
document.getElementById("files-tree-nav").style.display = "flex";
|
||||
document.getElementById("files-tree-nav").style.position = "fixed";
|
||||
document.getElementById("files-tree-nav").style.top = event.clientY + 'px';
|
||||
document.getElementById("files-tree-nav").style.left = event.clientX + 'px';
|
||||
domRect = document.getElementById("files-tree-nav").getBoundingClientRect();
|
||||
sum = (clientY+domRect['height']) - window.innerHeight
|
||||
if(domRect['height']+clientY > window.innerHeight){
|
||||
clientY = clientY - sum
|
||||
}
|
||||
document.getElementById("files-tree-nav").style.top = clientY + 'px';
|
||||
document.getElementById("files-tree-nav").style.left = clientX + 'px';
|
||||
console.log(domRect)
|
||||
console.log(window.innerHeight)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('click', function(e){
|
||||
let inside = (e.target.closest('#files-tree-nav'));
|
||||
if(!inside){
|
||||
let contextMenu = document.getElementById('files-tree-nav');
|
||||
contextMenu.setAttribute('style', 'display:none');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function createFileE(event) {
|
||||
bootbox.prompt("{% raw translate('serverFiles', 'createFileQuestion') %}", function(result) {
|
||||
|
Loading…
Reference in New Issue
Block a user