mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Add 'text' interaction mode for PDF (selection-only, no smart detection)
'select' keeps smart behavior (drag text to select, drag blank to pan); 'text' always defers to the text/annotation layer so drags never pan — for users who want pure selection. Shift still force-pans in both modes; 'pan' remains force-pan.
This commit is contained in:
+3
-1
@@ -116,7 +116,7 @@ export class FixedLayout extends HTMLElement {
|
||||
break;
|
||||
}
|
||||
case "interaction-mode": {
|
||||
if (value === "pan" || value === "select") {
|
||||
if (value === "pan" || value === "select" || value === "text") {
|
||||
this.#interactionMode = value;
|
||||
}
|
||||
break;
|
||||
@@ -496,6 +496,8 @@ export class FixedLayout extends HTMLElement {
|
||||
|
||||
#handleMouseDown(event) {
|
||||
if (event.button !== 0) return;
|
||||
if (this.#isPDF && this.#interactionMode === "text" && !event.shiftKey)
|
||||
return false;
|
||||
if (this.#isPDF && this.#interactionMode === "select" && !event.shiftKey) {
|
||||
const t = event.realTarget;
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user