diff --git a/paginator.js b/paginator.js index 3e21920..f236876 100644 --- a/paginator.js +++ b/paginator.js @@ -138,6 +138,13 @@ const getVisibleRange = (doc, start, end, mapRect) => { return range } +const selectionIsBackward = sel => { + const range = document.createRange() + range.setStart(sel.anchorNode, sel.anchorOffset) + range.setEnd(sel.focusNode, sel.focusOffset) + return range.collapsed +} + const setSelectionTo = (target, collapse) => { let range if (target.startContainer) range = target.cloneRange() @@ -427,6 +434,7 @@ export class Paginator extends HTMLElement { #scrollBounds #touchState #touchScrolled + #lastVisibleRange constructor() { super() this.#root.innerHTML = `