Fix immersive reader: extend top zone to cover visible bar heights
When top bars are showing, use their actual combined offsetHeight (+12px buffer) as the hide threshold instead of the fixed 60px. This prevents the bars from disappearing while the mouse moves from the edge zone down to click header buttons. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0037fd8db4
commit
ee8cfd8314
1 changed files with 11 additions and 2 deletions
|
|
@ -2924,8 +2924,17 @@ const _IMM_DELAY = 5000;
|
|||
const _IMM_EDGE = 60; // px from top/bottom edge
|
||||
|
||||
function _immMouseMove(e) {
|
||||
const atTop = e.clientY < _IMM_EDGE;
|
||||
const atBottom = e.clientY > window.innerHeight - _IMM_EDGE;
|
||||
// When bars are already showing, extend threshold to cover their actual height
|
||||
const topThreshold = _immTopShowing
|
||||
? (document.querySelector('.navbar')?.offsetHeight ?? 0) +
|
||||
(document.querySelector('.reader-header')?.offsetHeight ?? 0) + 12
|
||||
: _IMM_EDGE;
|
||||
const bottomThreshold = _immBottomShowing
|
||||
? (document.querySelector('.now-playing-bar')?.offsetHeight ?? 0) + 12
|
||||
: _IMM_EDGE;
|
||||
|
||||
const atTop = e.clientY < topThreshold;
|
||||
const atBottom = e.clientY > window.innerHeight - bottomThreshold;
|
||||
if (atTop !== _immTopShowing) {
|
||||
_immTopShowing = atTop;
|
||||
document.body.classList.toggle('reader-show-top', atTop);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue