auto-centering of save location tooltip

This commit is contained in:
ReznoRMichael 2021-07-27 23:17:38 +02:00
commit 0891e7bada
6 changed files with 30 additions and 6 deletions

View file

@ -966,14 +966,28 @@ SCROLL_BUTTON.addEventListener("click", () => {
document.getElementById("save-location-input").addEventListener("click", (e) => {
SelectCopyInputText(e, "save-location-input-tooltip", "Copied save location to clipboard");
let tooltip = document.getElementById("save-location-input-tooltip");
SelectCopyInputText(e, "save-location-input-tooltip", "Copied save files location to clipboard");
let tooltipWidth = tooltip.offsetWidth;
/* make sure that the tooltip is centered */
tooltip.style.marginLeft = `-${tooltipWidth / 2}px`;
}, false);
/* -------------- Switch text back to the default on mouse out -------------- */
document.getElementById("save-location-input").addEventListener("mouseout", () => {
let tooltip = document.getElementById("save-location-input-tooltip");
FillInnerHTML("save-location-input-tooltip", "Click once to copy to clipboard");
let tooltipWidth = tooltip.offsetWidth;
/* make sure that the tooltip is centered */
tooltip.style.marginLeft = `-${tooltipWidth / 2}px`;
}, false);
/* ------------- Checkbox functions ---------------------- */