Skip to content

Commit

Permalink
Fixes layers eventlisteners
Browse files Browse the repository at this point in the history
  • Loading branch information
aferditamuriqi committed Mar 29, 2022
1 parent 4e80b6c commit 14ba512
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@d-i-t-a/reader",
"version": "2.0.0-beta.20",
"version": "2.0.0-beta.21",
"description": "A viewer application for EPUB files.",
"repository": "https://github.com/d-i-t-a/R2D2BC",
"license": "Apache-2.0",
Expand Down
9 changes: 5 additions & 4 deletions src/modules/highlight/TextHighlighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const _blacklistIdClassForCssSelectors = [

let lastMouseDownX = -1;
let lastMouseDownY = -1;
let bodyEventListenersSet = false;
let bodyEventListeners = [];

export interface TextHighlighterProperties {
selectionMenuItems?: Array<SelectionMenuItem>;
Expand Down Expand Up @@ -200,7 +200,7 @@ export class TextHighlighter {

lastMouseDownX = -1;
lastMouseDownY = -1;
bodyEventListenersSet = false;
bodyEventListeners = [];

let self = this;
async function unselect() {
Expand Down Expand Up @@ -2459,6 +2459,7 @@ export class TextHighlighter {
let result = this.delegate.definitionsModule?.properties?.definitions?.filter(
(el: any) => el.order === Number(foundElement?.dataset.order)
)[0];
console.log(result);
if (this.delegate.definitionsModule?.api?.click) {
this.delegate.definitionsModule.api?.click(
lodash.omit(result, "callbacks"),
Expand All @@ -2479,8 +2480,8 @@ export class TextHighlighter {
const doc = win.document;
let self = this;
if (!doc.getElementById(id)) {
if (!bodyEventListenersSet) {
bodyEventListenersSet = true;
if (!bodyEventListeners[id]) {
bodyEventListeners[id] = true;

async function mousedown(ev: MouseEvent) {
lastMouseDownX = ev.clientX;
Expand Down

0 comments on commit 14ba512

Please sign in to comment.