From b31db1c3b66e9c8fb22255394464a7f425f5a6a4 Mon Sep 17 00:00:00 2001 From: Aferdita Muriqi Date: Fri, 20 Oct 2023 11:24:30 -0400 Subject: [PATCH] updated pointer events and pointer --- package-lock.json | 4 +-- package.json | 2 +- src/modules/highlight/TextHighlighter.ts | 40 ++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6c4e797a..d34375ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@d-i-t-a/reader", - "version": "2.3.16", + "version": "2.3.17", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@d-i-t-a/reader", - "version": "2.3.16", + "version": "2.3.17", "license": "Apache-2.0", "dependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", diff --git a/package.json b/package.json index 8821dbb7..0bb4e5de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@d-i-t-a/reader", - "version": "2.3.16", + "version": "2.3.17", "description": "A viewer application for EPUB files.", "repository": "https://github.com/d-i-t-a/R2D2BC", "license": "Apache-2.0", diff --git a/src/modules/highlight/TextHighlighter.ts b/src/modules/highlight/TextHighlighter.ts index a57fbf18..1fd11041 100644 --- a/src/modules/highlight/TextHighlighter.ts +++ b/src/modules/highlight/TextHighlighter.ts @@ -2903,7 +2903,18 @@ export class TextHighlighter { } } - highlightArea.style.setProperty("pointer-events", "all"); + if ( + highlight.type === HighlightType.Search || + highlight.type === HighlightType.ReadAloud || + highlight.type === HighlightType.LineFocus || + highlight.type === HighlightType.PageBreak + ) { + highlightArea.style.setProperty("pointer-events", "none"); + } else { + highlightArea.style.setProperty("pointer-events", "all"); + highlightArea.style.setProperty("cursor", "hand"); + } + highlightArea.style.position = "absolute"; highlightArea.scale = scale; highlightArea.rect = { @@ -2943,7 +2954,19 @@ export class TextHighlighter { "style", `background-color: rgba(${color.red}, ${color.green}, ${color.blue}, ${DEFAULT_BACKGROUND_COLOR_OPACITY}) !important;` ); - highlightAreaLine.style.setProperty("pointer-events", "all"); + + if ( + highlight.type === HighlightType.Search || + highlight.type === HighlightType.ReadAloud || + highlight.type === HighlightType.LineFocus || + highlight.type === HighlightType.PageBreak + ) { + highlightAreaLine.style.setProperty("pointer-events", "none"); + } else { + highlightAreaLine.style.setProperty("pointer-events", "all"); + highlightAreaLine.style.setProperty("cursor", "hand"); + } + highlightAreaLine.style.position = "absolute"; highlightAreaLine.scale = scale; highlightAreaLine.rect = { @@ -3195,7 +3218,18 @@ export class TextHighlighter { } } - highlightAreaIcon.style.setProperty("pointer-events", "all"); + if ( + highlight.type === HighlightType.Search || + highlight.type === HighlightType.ReadAloud || + highlight.type === HighlightType.LineFocus || + highlight.type === HighlightType.PageBreak + ) { + highlightAreaIcon.style.setProperty("pointer-events", "none"); + } else { + highlightAreaIcon.style.setProperty("pointer-events", "all"); + highlightAreaIcon.style.setProperty("cursor", "hand"); + } + let self = this; if ( highlight.type !== HighlightType.PageBreak &&