fix(reader): mount app volume in docker-compose, move popup to body root and add smooth scroll tracking

This commit is contained in:
Antigravity committed 2026-10-05 13:02:37 +03:00
1 parent cbd65decd5
commit c5e0e2dcfa
3 files changed
+56 -27

No files matched your search

+30 -2
View File
@@ -2133,8 +2133,8 @@ document.addEventListener('DOMContentLoaded', () => {
let top = rect.bottom + 8;
// If bottom overflows viewport, flip above the word
if (top + popupHeight > viewportHeight - 12) {
if (rect.top - popupHeight - 8 >= 12 || rect.top > viewportHeight / 2) {
top = Math.max(12, rect.top - popupHeight - 8);
if (rect.top - popupHeight - 8 >= 65 || rect.top > viewportHeight / 2) {
top = Math.max(65, rect.top - popupHeight - 8);
}
}
@@ -2206,6 +2206,34 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
function updatePopupPositionOnScroll() {
if (!readerWordPopup || readerWordPopup.classList.contains('hidden')) return;
if (!popupCurrentData || !popupCurrentData.targetElement || !popupCurrentData.targetElement.isConnected) {
readerWordPopup.classList.add('hidden');
return;
}
const rect = popupCurrentData.targetElement.getBoundingClientRect();
const headerOffset = 65; // reader toolbar sticky height
if (rect.bottom < headerOffset || rect.top > window.innerHeight) {
readerWordPopup.classList.add('hidden');
return;
}
positionWordPopup(popupCurrentData.targetElement);
}
let popupScrollRaf = null;
function schedulePopupUpdate() {
if (!readerWordPopup || readerWordPopup.classList.contains('hidden')) return;
if (popupScrollRaf) return;
popupScrollRaf = requestAnimationFrame(() => {
popupScrollRaf = null;
updatePopupPositionOnScroll();
});
}
window.addEventListener('scroll', schedulePopupUpdate, { passive: true, capture: true });
window.addEventListener('resize', schedulePopupUpdate, { passive: true });
if (popupSaveBtn) {
popupSaveBtn.addEventListener('click', async () => {
if (!popupCurrentData) return;