Access the isOffscreenCanvasSupported
option *once* in PDFViewerApplication._initializeViewerComponents
There's no good reason for getting this option multiple times in the same method. Also, we can slightly re-factor how the `editorStampButton` is made visible.
This commit is contained in:
parent
73d650af3e
commit
7e04ca395f
15
web/app.js
15
web/app.js
@ -495,6 +495,9 @@ const PDFViewerApplication = {
|
||||
const container = appConfig.mainContainer,
|
||||
viewer = appConfig.viewerContainer;
|
||||
const annotationEditorMode = AppOptions.get("annotationEditorMode");
|
||||
const isOffscreenCanvasSupported =
|
||||
AppOptions.get("isOffscreenCanvasSupported") &&
|
||||
FeatureTest.isOffscreenCanvasSupported;
|
||||
const pageColors =
|
||||
AppOptions.get("forcePageColors") ||
|
||||
window.matchMedia("(forced-colors: active)").matches
|
||||
@ -521,7 +524,7 @@ const PDFViewerApplication = {
|
||||
imageResourcesPath: AppOptions.get("imageResourcesPath"),
|
||||
enablePrintAutoRotate: AppOptions.get("enablePrintAutoRotate"),
|
||||
useOnlyCssZoom: AppOptions.get("useOnlyCssZoom"),
|
||||
isOffscreenCanvasSupported: AppOptions.get("isOffscreenCanvasSupported"),
|
||||
isOffscreenCanvasSupported,
|
||||
maxCanvasPixels: AppOptions.get("maxCanvasPixels"),
|
||||
enablePermissions: AppOptions.get("enablePermissions"),
|
||||
pageColors,
|
||||
@ -560,14 +563,8 @@ const PDFViewerApplication = {
|
||||
|
||||
if (appConfig.annotationEditorParams) {
|
||||
if (annotationEditorMode !== AnnotationEditorType.DISABLE) {
|
||||
const editorStampButton = appConfig.toolbar?.editorStampButton;
|
||||
if (
|
||||
editorStampButton &&
|
||||
AppOptions.get("enableStampEditor") &&
|
||||
AppOptions.get("isOffscreenCanvasSupported") &&
|
||||
FeatureTest.isOffscreenCanvasSupported
|
||||
) {
|
||||
editorStampButton.hidden = false;
|
||||
if (AppOptions.get("enableStampEditor") && isOffscreenCanvasSupported) {
|
||||
appConfig.toolbar?.editorStampButton?.classList.remove("hidden");
|
||||
}
|
||||
|
||||
this.annotationEditorParams = new AnnotationEditorParams(
|
||||
|
@ -330,7 +330,7 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
<div class="verticalToolbarSeparator hiddenMediumView"></div>
|
||||
|
||||
<div id="editorModeButtons" class="splitToolbarButton toggled" role="radiogroup">
|
||||
<button id="editorStamp" class="toolbarButton" hidden="true" disabled="disabled" title="Image" role="radio" aria-checked="false" tabindex="34" data-l10n-id="editor_stamp">
|
||||
<button id="editorStamp" class="toolbarButton hidden" disabled="disabled" title="Image" role="radio" aria-checked="false" tabindex="34" data-l10n-id="editor_stamp">
|
||||
<span data-l10n-id="editor_stamp_label">Image</span>
|
||||
</button>
|
||||
<button id="editorFreeText" class="toolbarButton" disabled="disabled" title="Text" role="radio" aria-checked="false" aria-controls="editorFreeTextParamsToolbar" tabindex="35" data-l10n-id="editor_free_text2">
|
||||
|
Loading…
x
Reference in New Issue
Block a user