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;
|
break;
|
||||||
}
|
}
|
||||||
case "interaction-mode": {
|
case "interaction-mode": {
|
||||||
if (value === "pan" || value === "select") {
|
if (value === "pan" || value === "select" || value === "text") {
|
||||||
this.#interactionMode = value;
|
this.#interactionMode = value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -496,6 +496,8 @@ export class FixedLayout extends HTMLElement {
|
|||||||
|
|
||||||
#handleMouseDown(event) {
|
#handleMouseDown(event) {
|
||||||
if (event.button !== 0) return;
|
if (event.button !== 0) return;
|
||||||
|
if (this.#isPDF && this.#interactionMode === "text" && !event.shiftKey)
|
||||||
|
return false;
|
||||||
if (this.#isPDF && this.#interactionMode === "select" && !event.shiftKey) {
|
if (this.#isPDF && this.#interactionMode === "select" && !event.shiftKey) {
|
||||||
const t = event.realTarget;
|
const t = event.realTarget;
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user