mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Tweak the new mouseState
parameter, and its usage, in the viewer components and the AnnotationLayer
- Actually remove the `isDown` property when destroying the scripting-instance. - Mark all `mouseState` usage as "private" in the various classes. - Ensure that the `AnnotationLayer` actually treats the parameter as properly *optional*, the same way that the viewer components do. - For now remove the `mouseState` parameter from the `PDFPageView` class, and keep it only on the `BaseViewer`, since it's questionable if all of the scripting-functionality will work all that well without e.g. a full `BaseViewer`. - Append the `mouseState` to the JSDoc for the `AnnotationElement` class, and just move its definition into the base-`AnnotationElement` class.
This commit is contained in:
parent
e6e2809825
commit
6dc39cb873
5 changed files with 11 additions and 10 deletions
|
@ -30,6 +30,7 @@ import { SimpleLinkService } from "./pdf_link_service.js";
|
|||
* @property {IL10n} l10n - Localization service.
|
||||
* @property {boolean} [enableScripting]
|
||||
* @property {Promise<boolean>} [hasJSActionsPromise]
|
||||
* @property {Object} [mouseState]
|
||||
*/
|
||||
|
||||
class AnnotationLayerBuilder {
|
||||
|
|
|
@ -794,6 +794,7 @@ const PDFViewerApplication = {
|
|||
}
|
||||
events.clear();
|
||||
|
||||
delete this._mouseState.isDown;
|
||||
this._scriptingInstance = null;
|
||||
},
|
||||
|
||||
|
|
|
@ -79,7 +79,8 @@ const DEFAULT_CACHE_SIZE = 10;
|
|||
* @property {IL10n} l10n - Localization service.
|
||||
* @property {boolean} [enableScripting] - Enable embedded script execution.
|
||||
* The default value is `false`.
|
||||
* @property {Object} [mouseState] - The mouse button state.
|
||||
* @property {Object} [mouseState] - The mouse button state. The default value
|
||||
* is `null`.
|
||||
*/
|
||||
|
||||
function PDFPageViewBuffer(size) {
|
||||
|
@ -195,7 +196,7 @@ class BaseViewer {
|
|||
this.maxCanvasPixels = options.maxCanvasPixels;
|
||||
this.l10n = options.l10n || NullL10n;
|
||||
this.enableScripting = options.enableScripting || false;
|
||||
this.mouseState = options.mouseState || null;
|
||||
this._mouseState = options.mouseState || null;
|
||||
|
||||
this.defaultRenderingQueue = !options.renderingQueue;
|
||||
if (this.defaultRenderingQueue) {
|
||||
|
@ -540,7 +541,6 @@ class BaseViewer {
|
|||
maxCanvasPixels: this.maxCanvasPixels,
|
||||
l10n: this.l10n,
|
||||
enableScripting: this.enableScripting,
|
||||
mouseState: this.mouseState,
|
||||
});
|
||||
this._pages.push(pageView);
|
||||
}
|
||||
|
@ -1301,7 +1301,7 @@ class BaseViewer {
|
|||
enableScripting,
|
||||
hasJSActionsPromise:
|
||||
hasJSActionsPromise || this.pdfDocument?.hasJSActions(),
|
||||
mouseState,
|
||||
mouseState: mouseState || this._mouseState,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ import { viewerCompatibilityParams } from "./viewer_compatibility.js";
|
|||
* @property {IL10n} l10n - Localization service.
|
||||
* @property {boolean} [enableScripting] - Enable embedded script execution.
|
||||
* The default value is `false`.
|
||||
* @property {Object} [mouseState] - The mouse button state.
|
||||
*/
|
||||
|
||||
const MAX_CANVAS_PIXELS = viewerCompatibilityParams.maxCanvasPixels || 16777216;
|
||||
|
@ -110,7 +109,6 @@ class PDFPageView {
|
|||
this.enableWebGL = options.enableWebGL || false;
|
||||
this.l10n = options.l10n || NullL10n;
|
||||
this.enableScripting = options.enableScripting || false;
|
||||
this.mouseState = options.mouseState || null;
|
||||
|
||||
this.paintTask = null;
|
||||
this.paintedViewportMap = new WeakMap();
|
||||
|
@ -554,7 +552,7 @@ class PDFPageView {
|
|||
this.l10n,
|
||||
this.enableScripting,
|
||||
/* hasJSActionsPromise = */ null,
|
||||
this.mouseState
|
||||
/* mouseState = */ null
|
||||
);
|
||||
}
|
||||
this._renderAnnotationLayer();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue