Fix for hook position in wide column names, refs #2263

pull/2004/merge
Simon Willison 2024-02-19 14:01:55 -08:00
rodzic 392ca2e24c
commit 27409a7892
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -227,7 +227,15 @@ const initDatasetteTable = function (manager) {
const hook = menu.querySelector('.hook');
const icon = th.querySelector('.dropdown-menu-icon');
const iconRect = icon.getBoundingClientRect();
hook.style.left = (iconRect.left - menuLeft + 1) + 'px';
const hookLeft = (iconRect.left - menuLeft + 1) + 'px';
hook.style.left = hookLeft;
// Move the whole menu right if the hook is too far right
const menuRect = menu.getBoundingClientRect();
if (iconRect.right > menuRect.right) {
menu.style.left = (iconRect.right - menuWidth) + 'px';
// And move hook tip as well
hook.style.left = (menuWidth - 13) + 'px';
}
}
var svg = document.createElement("div");