Skip to content

Commit

Permalink
Support shift-arrow selection in EPUB view
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeJellinek committed Sep 5, 2023
1 parent 69ab2cb commit 327b859
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/dom/epub/epub-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,25 +452,27 @@ class EPUBView extends DOMView<EPUBViewState, EPUBViewData> {
protected override _handleKeyDown(event: KeyboardEvent) {
let { key } = event;

if (key == 'ArrowLeft') {
if (this._pageProgressionRTL) {
this.flow.navigateToNextPage();
}
else {
this.flow.navigateToPreviousPage();
}
event.preventDefault();
return;
}
if (key == 'ArrowRight') {
if (this._pageProgressionRTL) {
this.flow.navigateToPreviousPage();
if (!event.shiftKey) {
if (key == 'ArrowLeft') {
if (this._pageProgressionRTL) {
this.flow.navigateToNextPage();
}
else {
this.flow.navigateToPreviousPage();
}
event.preventDefault();
return;
}
else {
this.flow.navigateToNextPage();
if (key == 'ArrowRight') {
if (this._pageProgressionRTL) {
this.flow.navigateToPreviousPage();
}
else {
this.flow.navigateToNextPage();
}
event.preventDefault();
return;
}
event.preventDefault();
return;
}

super._handleKeyDown(event);
Expand Down

0 comments on commit 327b859

Please sign in to comment.