mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Use one noContextMenu
function in both the src/- and web/-folders
Currently we duplicate this event handler function in multiple places, which seems unnecessary.
This commit is contained in:
parent
a09b7228fb
commit
1df31c0284
7 changed files with 20 additions and 32 deletions
|
@ -19,10 +19,9 @@ import {
|
|||
DEFAULT_SCALE_VALUE,
|
||||
MAX_SCALE,
|
||||
MIN_SCALE,
|
||||
noContextMenuHandler,
|
||||
toggleCheckedBtn,
|
||||
} from "./ui_utils.js";
|
||||
import { AnnotationEditorType } from "pdfjs-lib";
|
||||
import { AnnotationEditorType, noContextMenu } from "pdfjs-lib";
|
||||
|
||||
const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading";
|
||||
|
||||
|
@ -201,7 +200,7 @@ class Toolbar {
|
|||
}
|
||||
});
|
||||
// Suppress context menus for some controls.
|
||||
scaleSelect.oncontextmenu = noContextMenuHandler;
|
||||
scaleSelect.oncontextmenu = noContextMenu;
|
||||
|
||||
this.eventBus._on("localized", () => {
|
||||
this.#wasLocalized = true;
|
||||
|
|
|
@ -604,13 +604,6 @@ function getVisibleElements({
|
|||
return { first, last, views: visible, ids };
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler to suppress context menu.
|
||||
*/
|
||||
function noContextMenuHandler(evt) {
|
||||
evt.preventDefault();
|
||||
}
|
||||
|
||||
function normalizeWheelEventDirection(evt) {
|
||||
let delta = Math.hypot(evt.deltaX, evt.deltaY);
|
||||
const angle = Math.atan2(evt.deltaY, evt.deltaX);
|
||||
|
@ -881,7 +874,6 @@ export {
|
|||
MAX_AUTO_SCALE,
|
||||
MAX_SCALE,
|
||||
MIN_SCALE,
|
||||
noContextMenuHandler,
|
||||
normalizeWheelEventDelta,
|
||||
normalizeWheelEventDirection,
|
||||
OutputScale,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue