[ReaderHighlight] NT: account for status and alt-status bars in text selection (#13348)
Some checks are pending
macos / macOS 13 x86-64 🔨15.2 🎯10.15 (push) Waiting to run
macos / macOS 14 ARM64 🔨15.4 🎯11.0 (push) Waiting to run

This commit is contained in:
David
2025-03-02 21:24:52 +00:00
committed by GitHub
parent 946080294d
commit 316eb87116

View File

@@ -2631,11 +2631,18 @@ function ReaderHighlight:onMoveHighlightIndicator(args)
if rect.x + rect.w > self.view.visible_area.w then
rect.x = self.view.visible_area.w - rect.w
end
if rect.y < 0 then
rect.y = 0
-- make sure we account for both the status bar and alt status bar so we don't overlap them with the indicator
local alt_status_bar_height = 0
if self.ui.rolling and self.ui.document.configurable.status_line == 0 then
alt_status_bar_height = self.ui.document:getHeaderHeight()
end
if rect.y + rect.h > self.view.visible_area.h then
rect.y = self.view.visible_area.h - rect.h
if rect.y < alt_status_bar_height then
rect.y = alt_status_bar_height
end
local footer_height = self.view.footer_visible and self.view.footer:getHeight() or 0
local status_bar_height = self.ui.rolling and footer_height or 0 -- for PDFs, status bar is already accounted for
if rect.y + rect.h > self.view.visible_area.h - status_bar_height then
rect.y = self.view.visible_area.h - status_bar_height - rect.h
end
UIManager:setDirty(self.dialog, "ui", self._current_indicator_pos)
self._current_indicator_pos = rect