@pdftools/four-heights-pdf-web-viewer 4.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +446 -0
- package/README.md +145 -0
- package/css/pdf-web-viewer.css +2407 -0
- package/doc/PdfWebViewer.pdf +0 -0
- package/es6/common/Checkbox.d.ts +9 -0
- package/es6/common/Checkbox.js +8 -0
- package/es6/common/Color.d.ts +23 -0
- package/es6/common/Color.js +118 -0
- package/es6/common/ColorPicker.d.ts +15 -0
- package/es6/common/ColorPicker.js +46 -0
- package/es6/common/Contextbar.d.ts +6 -0
- package/es6/common/Contextbar.js +19 -0
- package/es6/common/DragMoveHandler.d.ts +51 -0
- package/es6/common/DragMoveHandler.js +175 -0
- package/es6/common/Dropdown.d.ts +36 -0
- package/es6/common/Dropdown.js +76 -0
- package/es6/common/DropdownMenu.d.ts +9 -0
- package/es6/common/DropdownMenu.js +10 -0
- package/es6/common/DropdownSeparator.d.ts +3 -0
- package/es6/common/DropdownSeparator.js +6 -0
- package/es6/common/Icon.d.ts +13 -0
- package/es6/common/Icon.js +8 -0
- package/es6/common/Loader.d.ts +3 -0
- package/es6/common/Loader.js +6 -0
- package/es6/common/RangeSlider.d.ts +17 -0
- package/es6/common/RangeSlider.js +42 -0
- package/es6/common/StrokeStylePicker.d.ts +11 -0
- package/es6/common/StrokeStylePicker.js +20 -0
- package/es6/common/StrokeWidthPicker.d.ts +11 -0
- package/es6/common/StrokeWidthPicker.js +20 -0
- package/es6/common/Toolbar.d.ts +10 -0
- package/es6/common/Toolbar.js +6 -0
- package/es6/common/ToolbarButton.d.ts +14 -0
- package/es6/common/ToolbarButton.js +21 -0
- package/es6/common/ToolbarFileButton.d.ts +15 -0
- package/es6/common/ToolbarFileButton.js +27 -0
- package/es6/common/ToolbarItemGroup.d.ts +8 -0
- package/es6/common/ToolbarItemGroup.js +12 -0
- package/es6/common/ToolbarSeparator.d.ts +3 -0
- package/es6/common/ToolbarSeparator.js +6 -0
- package/es6/common/Tools.d.ts +10 -0
- package/es6/common/Tools.js +89 -0
- package/es6/common/TooltipManager.d.ts +12 -0
- package/es6/common/TooltipManager.js +54 -0
- package/es6/common/TranslationManager.d.ts +11 -0
- package/es6/common/TranslationManager.js +61 -0
- package/es6/common/classNames.d.ts +2 -0
- package/es6/common/classNames.js +18 -0
- package/es6/common/formatDate.d.ts +1 -0
- package/es6/common/formatDate.js +1 -0
- package/es6/common/icons.d.ts +13 -0
- package/es6/common/icons.js +412 -0
- package/es6/common/utils.d.ts +2 -0
- package/es6/common/utils.js +19 -0
- package/es6/custom/history.d.ts +2 -0
- package/es6/custom/history.js +59 -0
- package/es6/index.d.ts +5 -0
- package/es6/index.js +5 -0
- package/es6/lib/hyperapp/index.d.ts +108 -0
- package/es6/lib/hyperapp/index.js +327 -0
- package/es6/modules/CanvasLayer.d.ts +32 -0
- package/es6/modules/CanvasLayer.js +83 -0
- package/es6/modules/CanvasModule.d.ts +59 -0
- package/es6/modules/CanvasModule.js +98 -0
- package/es6/modules/eraser/EraserLayer.d.ts +13 -0
- package/es6/modules/eraser/EraserLayer.js +141 -0
- package/es6/modules/eraser/EraserModule.d.ts +19 -0
- package/es6/modules/eraser/EraserModule.js +34 -0
- package/es6/modules/eraser/EraserToolbar.d.ts +10 -0
- package/es6/modules/eraser/EraserToolbar.js +30 -0
- package/es6/modules/form-fields/CheckBoxWidget.d.ts +9 -0
- package/es6/modules/form-fields/CheckBoxWidget.js +45 -0
- package/es6/modules/form-fields/ComboBoxWidget.d.ts +22 -0
- package/es6/modules/form-fields/ComboBoxWidget.js +152 -0
- package/es6/modules/form-fields/EditFormFieldLayer.d.ts +17 -0
- package/es6/modules/form-fields/EditFormFieldLayer.js +238 -0
- package/es6/modules/form-fields/FormFieldModule.d.ts +15 -0
- package/es6/modules/form-fields/FormFieldModule.js +27 -0
- package/es6/modules/form-fields/ListBoxWidget.d.ts +9 -0
- package/es6/modules/form-fields/ListBoxWidget.js +73 -0
- package/es6/modules/form-fields/RadioButtonWidget.d.ts +9 -0
- package/es6/modules/form-fields/RadioButtonWidget.js +45 -0
- package/es6/modules/form-fields/SelectListWidget.d.ts +9 -0
- package/es6/modules/form-fields/SelectListWidget.js +45 -0
- package/es6/modules/form-fields/TextBoxWidget.d.ts +9 -0
- package/es6/modules/form-fields/TextBoxWidget.js +53 -0
- package/es6/modules/form-fields/WidgetBase.d.ts +23 -0
- package/es6/modules/form-fields/WidgetBase.js +29 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.d.ts +19 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.js +181 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.d.ts +21 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.js +37 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.d.ts +20 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.js +211 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.d.ts +50 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.js +118 -0
- package/es6/modules/freetext-annotation/FreetextAnnotationModule.d.ts +28 -0
- package/es6/modules/freetext-annotation/FreetextAnnotationModule.js +58 -0
- package/es6/modules/freetext-annotation/RichTextEditor.d.ts +31 -0
- package/es6/modules/freetext-annotation/RichTextEditor.js +223 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.d.ts +31 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.js +289 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.d.ts +20 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.js +52 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.d.ts +15 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.js +104 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.d.ts +15 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.js +28 -0
- package/es6/modules/highlight-annotation/HighlightAnnotationModule.d.ts +27 -0
- package/es6/modules/highlight-annotation/HighlightAnnotationModule.js +54 -0
- package/es6/modules/image-annotations/ImageAnnotationModule.d.ts +23 -0
- package/es6/modules/image-annotations/ImageAnnotationModule.js +169 -0
- package/es6/modules/index.d.ts +13 -0
- package/es6/modules/index.js +13 -0
- package/es6/modules/ink-annotation/AddInkAnnotationLayer.d.ts +40 -0
- package/es6/modules/ink-annotation/AddInkAnnotationLayer.js +503 -0
- package/es6/modules/ink-annotation/AddInkAnnotationToolbar.d.ts +30 -0
- package/es6/modules/ink-annotation/AddInkAnnotationToolbar.js +53 -0
- package/es6/modules/ink-annotation/EditInkAnnotationLayer.d.ts +20 -0
- package/es6/modules/ink-annotation/EditInkAnnotationLayer.js +137 -0
- package/es6/modules/ink-annotation/EditInkAnnotationToolbar.d.ts +25 -0
- package/es6/modules/ink-annotation/EditInkAnnotationToolbar.js +47 -0
- package/es6/modules/ink-annotation/InkAnnotationModule.d.ts +27 -0
- package/es6/modules/ink-annotation/InkAnnotationModule.js +50 -0
- package/es6/modules/popup/Popup.d.ts +64 -0
- package/es6/modules/popup/Popup.js +360 -0
- package/es6/modules/popup/PopupLayer.d.ts +31 -0
- package/es6/modules/popup/PopupLayer.js +509 -0
- package/es6/modules/popup/PopupModule.d.ts +16 -0
- package/es6/modules/popup/PopupModule.js +25 -0
- package/es6/modules/print-service/PrintServiceDialog.d.ts +30 -0
- package/es6/modules/print-service/PrintServiceDialog.js +134 -0
- package/es6/modules/print-service/PrintServiceLayer.d.ts +24 -0
- package/es6/modules/print-service/PrintServiceLayer.js +310 -0
- package/es6/modules/print-service/PrintServiceModule.d.ts +18 -0
- package/es6/modules/print-service/PrintServiceModule.js +30 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationLayer.d.ts +24 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationLayer.js +210 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationToolbar.d.ts +26 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationToolbar.js +69 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationLayer.d.ts +19 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationLayer.js +148 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationToolbar.d.ts +24 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationToolbar.js +57 -0
- package/es6/modules/shape-annotations/ShapeAnnotationModule.d.ts +28 -0
- package/es6/modules/shape-annotations/ShapeAnnotationModule.js +50 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationLayer.d.ts +19 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationLayer.js +257 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationToolbar.d.ts +17 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationToolbar.js +68 -0
- package/es6/modules/stamp-annotation/StampAnnotationModule.d.ts +20 -0
- package/es6/modules/stamp-annotation/StampAnnotationModule.js +35 -0
- package/es6/modules/text-annotation/AddTextAnnotationLayer.d.ts +14 -0
- package/es6/modules/text-annotation/AddTextAnnotationLayer.js +132 -0
- package/es6/modules/text-annotation/AddTextAnnotationToolbar.d.ts +15 -0
- package/es6/modules/text-annotation/AddTextAnnotationToolbar.js +27 -0
- package/es6/modules/text-annotation/TextAnnotationModule.d.ts +19 -0
- package/es6/modules/text-annotation/TextAnnotationModule.js +34 -0
- package/es6/pdf-viewer-api/ImageContainer.d.ts +10 -0
- package/es6/pdf-viewer-api/ImageContainer.js +43 -0
- package/es6/pdf-viewer-api/PdfViewerApi.d.ts +463 -0
- package/es6/pdf-viewer-api/PdfViewerApi.js +732 -0
- package/es6/pdf-viewer-api/PdfViewingWrapper.d.ts +178 -0
- package/es6/pdf-viewer-api/PdfViewingWrapper.js +2037 -0
- package/es6/pdf-viewer-api/annotationDefaultBehaviors.d.ts +3 -0
- package/es6/pdf-viewer-api/annotationDefaultBehaviors.js +30 -0
- package/es6/pdf-viewer-api/enums.d.ts +100 -0
- package/es6/pdf-viewer-api/enums.js +113 -0
- package/es6/pdf-viewer-api/index.d.ts +3 -0
- package/es6/pdf-viewer-api/index.js +3 -0
- package/es6/pdf-viewer-api/types.d.ts +284 -0
- package/es6/pdf-viewer-api/types.js +6 -0
- package/es6/pdf-viewer-canvas/CanvasEvents.d.ts +76 -0
- package/es6/pdf-viewer-canvas/CanvasEvents.js +345 -0
- package/es6/pdf-viewer-canvas/PdfViewerCanvas.d.ts +175 -0
- package/es6/pdf-viewer-canvas/PdfViewerCanvas.js +1226 -0
- package/es6/pdf-viewer-canvas/state/annotations.d.ts +36 -0
- package/es6/pdf-viewer-canvas/state/annotations.js +157 -0
- package/es6/pdf-viewer-canvas/state/appState.d.ts +10 -0
- package/es6/pdf-viewer-canvas/state/appState.js +60 -0
- package/es6/pdf-viewer-canvas/state/canvas.d.ts +31 -0
- package/es6/pdf-viewer-canvas/state/canvas.js +41 -0
- package/es6/pdf-viewer-canvas/state/document.d.ts +50 -0
- package/es6/pdf-viewer-canvas/state/document.js +99 -0
- package/es6/pdf-viewer-canvas/state/pointer.d.ts +31 -0
- package/es6/pdf-viewer-canvas/state/pointer.js +31 -0
- package/es6/pdf-viewer-canvas/state/scroll.d.ts +22 -0
- package/es6/pdf-viewer-canvas/state/scroll.js +25 -0
- package/es6/pdf-viewer-canvas/state/search.d.ts +36 -0
- package/es6/pdf-viewer-canvas/state/search.js +27 -0
- package/es6/pdf-viewer-canvas/state/store.d.ts +39 -0
- package/es6/pdf-viewer-canvas/state/store.js +52 -0
- package/es6/pdf-viewer-canvas/state/viewer.d.ts +91 -0
- package/es6/pdf-viewer-canvas/state/viewer.js +175 -0
- package/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.d.ts +28 -0
- package/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.js +452 -0
- package/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.d.ts +9 -0
- package/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.js +25 -0
- package/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.d.ts +10 -0
- package/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.js +149 -0
- package/es6/pdf-viewer-canvas/view-layers/ScrollLayer.d.ts +48 -0
- package/es6/pdf-viewer-canvas/view-layers/ScrollLayer.js +308 -0
- package/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.d.ts +19 -0
- package/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.js +289 -0
- package/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.d.ts +31 -0
- package/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.js +106 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasShapes.d.ts +11 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasShapes.js +149 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasUtlis.d.ts +3 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasUtlis.js +10 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.d.ts +52 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.js +377 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.d.ts +47 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.js +102 -0
- package/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.d.ts +14 -0
- package/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.js +36 -0
- package/es6/pdf-viewing/PdfViewing.d.ts +4865 -0
- package/es6/pdf-viewing/PdfViewing.js +9611 -0
- package/es6/pdf-web-viewer/PdfWebViewer.d.ts +372 -0
- package/es6/pdf-web-viewer/PdfWebViewer.js +1386 -0
- package/es6/pdf-web-viewer/UserSettings.d.ts +8 -0
- package/es6/pdf-web-viewer/UserSettings.js +40 -0
- package/es6/pdf-web-viewer/WebViewerOptions.d.ts +387 -0
- package/es6/pdf-web-viewer/WebViewerOptions.js +582 -0
- package/es6/pdf-web-viewer/state/index.d.ts +80 -0
- package/es6/pdf-web-viewer/state/index.js +98 -0
- package/es6/pdf-web-viewer/state/layout.d.ts +24 -0
- package/es6/pdf-web-viewer/state/layout.js +21 -0
- package/es6/pdf-web-viewer/state/mobile.d.ts +16 -0
- package/es6/pdf-web-viewer/state/mobile.js +11 -0
- package/es6/pdf-web-viewer/state/navigationPanel.d.ts +61 -0
- package/es6/pdf-web-viewer/state/navigationPanel.js +84 -0
- package/es6/pdf-web-viewer/state/passwordForm.d.ts +18 -0
- package/es6/pdf-web-viewer/state/passwordForm.js +21 -0
- package/es6/pdf-web-viewer/state/pdfDocument.d.ts +31 -0
- package/es6/pdf-web-viewer/state/pdfDocument.js +41 -0
- package/es6/pdf-web-viewer/state/search.d.ts +29 -0
- package/es6/pdf-web-viewer/state/search.js +23 -0
- package/es6/pdf-web-viewer/views/App.d.ts +4 -0
- package/es6/pdf-web-viewer/views/App.js +19 -0
- package/es6/pdf-web-viewer/views/CustomButtons.d.ts +9 -0
- package/es6/pdf-web-viewer/views/CustomButtons.js +18 -0
- package/es6/pdf-web-viewer/views/DropZone.d.ts +9 -0
- package/es6/pdf-web-viewer/views/DropZone.js +53 -0
- package/es6/pdf-web-viewer/views/Layout.d.ts +4 -0
- package/es6/pdf-web-viewer/views/Layout.js +22 -0
- package/es6/pdf-web-viewer/views/annotationbar/Annotationbar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/annotationbar/Annotationbar.js +21 -0
- package/es6/pdf-web-viewer/views/appbar/AddonsToolbar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/AddonsToolbar.js +35 -0
- package/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.js +22 -0
- package/es6/pdf-web-viewer/views/appbar/AppBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/AppBar.js +26 -0
- package/es6/pdf-web-viewer/views/appbar/DocumentBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/DocumentBar.js +36 -0
- package/es6/pdf-web-viewer/views/appbar/Menu.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/Menu.js +80 -0
- package/es6/pdf-web-viewer/views/appbar/NavigationBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/NavigationBar.js +74 -0
- package/es6/pdf-web-viewer/views/appbar/SearchBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/SearchBar.js +83 -0
- package/es6/pdf-web-viewer/views/appbar/SearchOptions.d.ts +10 -0
- package/es6/pdf-web-viewer/views/appbar/SearchOptions.js +55 -0
- package/es6/pdf-web-viewer/views/appbar/ViewBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/ViewBar.js +52 -0
- package/es6/pdf-web-viewer/views/appbar/ZoomBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/ZoomBar.js +18 -0
- package/es6/pdf-web-viewer/views/modal/ApplicationError.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/ApplicationError.js +25 -0
- package/es6/pdf-web-viewer/views/modal/LoadApplication.d.ts +3 -0
- package/es6/pdf-web-viewer/views/modal/LoadApplication.js +6 -0
- package/es6/pdf-web-viewer/views/modal/LoadFile.d.ts +3 -0
- package/es6/pdf-web-viewer/views/modal/LoadFile.js +10 -0
- package/es6/pdf-web-viewer/views/modal/Modal.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/Modal.js +39 -0
- package/es6/pdf-web-viewer/views/modal/OpenFile.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/OpenFile.js +30 -0
- package/es6/pdf-web-viewer/views/modal/OpenFileError.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/OpenFileError.js +13 -0
- package/es6/pdf-web-viewer/views/modal/PasswordForm.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/PasswordForm.js +54 -0
- package/es6/pdf-web-viewer/views/modal/SaveFile.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/SaveFile.js +10 -0
- package/es6/pdf-web-viewer/views/modal/UnsavedChanges.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/UnsavedChanges.js +32 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationList.d.ts +8 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationList.js +26 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationListItem.d.ts +8 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationListItem.js +158 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.d.ts +4 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.js +11 -0
- package/es6/pdf-web-viewer/views/navigation/NavigationPanel.d.ts +4 -0
- package/es6/pdf-web-viewer/views/navigation/NavigationPanel.js +50 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineList.d.ts +12 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineList.js +19 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineNavigation.d.ts +4 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineNavigation.js +10 -0
- package/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.d.ts +16 -0
- package/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.js +32 -0
- package/package.json +24 -0
- package/pdfwebviewer/PdfViewing.data +0 -0
- package/pdfwebviewer/PdfViewing_Main.js +1 -0
- package/pdfwebviewer/PdfViewing_Main.wasm +0 -0
- package/pdfwebviewer/PdfViewing_Worker.js +1 -0
- package/pdfwebviewer/PdfViewing_Worker.wasm +0 -0
- package/pdfwebviewer/pdf-web-viewer.css +2407 -0
- package/pdfwebviewer/pdf-web-viewer.development.js +25955 -0
- package/pdfwebviewer/pdf-web-viewer.min.js +1 -0
- package/pdfwebviewer/translations.de.json +151 -0
- package/pdfwebviewer/translations.en.json +151 -0
- package/pdfwebviewer/translations.fr.json +151 -0
- package/pdfwebviewer/translations.it.json +151 -0
- package/scss/common/_breakpoints.scss +44 -0
- package/scss/common/_buttons.scss +42 -0
- package/scss/common/_colorpicker.scss +89 -0
- package/scss/common/_common.scss +21 -0
- package/scss/common/_contextbar.scss +44 -0
- package/scss/common/_dropdown.scss +176 -0
- package/scss/common/_icon.scss +9 -0
- package/scss/common/_index.scss +19 -0
- package/scss/common/_loader.scss +30 -0
- package/scss/common/_rangeslider.scss +24 -0
- package/scss/common/_scrollbars.scss +64 -0
- package/scss/common/_stroke-style-picker.scss +64 -0
- package/scss/common/_stroke-width-picker.scss +23 -0
- package/scss/common/_toolbar.scss +117 -0
- package/scss/common/_tooltip.scss +39 -0
- package/scss/modules/_eraser.scss +28 -0
- package/scss/modules/_forms.scss +56 -0
- package/scss/modules/_highlightannotation.scss +12 -0
- package/scss/modules/_index.scss +5 -0
- package/scss/modules/_inkannotation.scss +41 -0
- package/scss/modules/_stampannotation.scss +19 -0
- package/scss/pdf-viewer-canvas/_annotationborder.scss +107 -0
- package/scss/pdf-viewer-canvas/_busy-loader.scss +53 -0
- package/scss/pdf-viewer-canvas/_freetexteditor.scss +28 -0
- package/scss/pdf-viewer-canvas/_index.scss +7 -0
- package/scss/pdf-viewer-canvas/_layout.scss +52 -0
- package/scss/pdf-viewer-canvas/_popup.scss +217 -0
- package/scss/pdf-viewer-canvas/_printservice.scss +171 -0
- package/scss/pdf-viewer-canvas/_textselection.scss +17 -0
- package/scss/pdf-web-viewer/_annotationbar.scss +47 -0
- package/scss/pdf-web-viewer/_index.scss +8 -0
- package/scss/pdf-web-viewer/_layout.scss +63 -0
- package/scss/pdf-web-viewer/_modal.scss +186 -0
- package/scss/pdf-web-viewer/_navigationpanel.scss +398 -0
- package/scss/pdf-web-viewer/_searchbar.scss +47 -0
- package/scss/pdf-web-viewer/_toolbar.scss +134 -0
- package/scss/pdf-web-viewer/_viewer.scss +54 -0
- package/scss/pdf-web-viewer.scss +1 -0
- package/scss/themes/default/_light.scss +32 -0
- package/scss/themes/default/_mixins.scss +129 -0
- package/scss/themes/default/_theme.scss +161 -0
- package/scss/themes/pdf-web-viewer.scss +1 -0
- package/umd/pdf-web-viewer.development.js +25955 -0
- package/umd/pdf-web-viewer.development.js.map +1 -0
- package/umd/pdf-web-viewer.min.js +1 -0
- package/wasm/PdfViewing.data +0 -0
- package/wasm/PdfViewing_Main.js +1 -0
- package/wasm/PdfViewing_Main.wasm +0 -0
- package/wasm/PdfViewing_Worker.js +1 -0
- package/wasm/PdfViewing_Worker.wasm +0 -0
- package/wasm/translations.de.json +151 -0
- package/wasm/translations.en.json +151 -0
- package/wasm/translations.fr.json +151 -0
- package/wasm/translations.it.json +151 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
import { PdfItemType, PdfItemCategory, PdfPageLayoutMode, } from '../../pdf-viewer-api';
|
|
2
|
+
import { ViewLayerBase } from './ViewLayerBase';
|
|
3
|
+
import { ViewerMode, copyTextToClipboard, CursorStyle } from '../state/viewer';
|
|
4
|
+
import { createAnnotationContextBar } from './views/AnnotationContextBar';
|
|
5
|
+
import { AnnotationBorder } from './views/AnnotationBorder';
|
|
6
|
+
import { addHistoryEntry } from '../../custom/history';
|
|
7
|
+
/** internal */
|
|
8
|
+
export class AnnotationSelectionLayer extends ViewLayerBase {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.context = null;
|
|
12
|
+
this.selectedAnnotation = null;
|
|
13
|
+
this.selectionElement = null;
|
|
14
|
+
this.barAtTop = true;
|
|
15
|
+
this.contextBar = null;
|
|
16
|
+
this.annotationBorder = null;
|
|
17
|
+
this.deleteAnnotation = this.deleteAnnotation.bind(this);
|
|
18
|
+
this.rotateAnnotation = this.rotateAnnotation.bind(this);
|
|
19
|
+
this.copyAnnotationText = this.copyAnnotationText.bind(this);
|
|
20
|
+
this.createPopup = this.createPopup.bind(this);
|
|
21
|
+
this.openPopup = this.openPopup.bind(this);
|
|
22
|
+
this.deletePopup = this.deletePopup.bind(this);
|
|
23
|
+
this.moveAnnotation = this.moveAnnotation.bind(this);
|
|
24
|
+
this.toggleLock = this.toggleLock.bind(this);
|
|
25
|
+
this.resizeAnnotation = this.resizeAnnotation.bind(this);
|
|
26
|
+
this.onItemSelected = this.onItemSelected.bind(this);
|
|
27
|
+
this.onItemDblClick = this.onItemDblClick.bind(this);
|
|
28
|
+
}
|
|
29
|
+
create() {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
if (this.viewerCanvas) {
|
|
32
|
+
this.viewerCanvas.addEventListener('itemSelected', this.onItemSelected);
|
|
33
|
+
}
|
|
34
|
+
this.selectAnnotation = this.selectAnnotation.bind(this);
|
|
35
|
+
this.deselectAnnotation = this.deselectAnnotation.bind(this);
|
|
36
|
+
this.deleteAnnotation = this.deleteAnnotation.bind(this);
|
|
37
|
+
this.createPopup = this.createPopup.bind(this);
|
|
38
|
+
this.deletePopup = this.deletePopup.bind(this);
|
|
39
|
+
this.openPopup = this.openPopup.bind(this);
|
|
40
|
+
this.context = this.createCanvas('pwv-annotation-selection-layers');
|
|
41
|
+
this.context.canvas.style.display = 'none';
|
|
42
|
+
this.selectionElement = this.createHtmlLayer();
|
|
43
|
+
this.selectionElement.style.display = 'none';
|
|
44
|
+
this.selectionElement.style.position = 'absolute';
|
|
45
|
+
this.selectionElement.classList.add('pwv-annotation-selection');
|
|
46
|
+
this.selectionElement.classList.add('pwv-contextbar-top');
|
|
47
|
+
this.selectionElement.addEventListener('click', (e) => {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
e.cancelBubble = true;
|
|
50
|
+
}, false);
|
|
51
|
+
if ((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) {
|
|
52
|
+
this.contextBar = createAnnotationContextBar({
|
|
53
|
+
allowCopyText: this.options.viewer.permissions.allowCopyText,
|
|
54
|
+
allowLockAnnotations: this.options.viewer.permissions.allowLockAnnotations,
|
|
55
|
+
allowEditLockedAnnotations: this.options.viewer.permissions.allowEditLockedAnnotations,
|
|
56
|
+
onDeleteAnnotation: this.deleteAnnotation,
|
|
57
|
+
onRotateAnnotation: this.rotateAnnotation,
|
|
58
|
+
onCopy: this.copyAnnotationText,
|
|
59
|
+
onCreatePopup: this.createPopup,
|
|
60
|
+
onOpenPopup: this.openPopup,
|
|
61
|
+
onDeletePopup: this.deletePopup,
|
|
62
|
+
onToggleLock: this.toggleLock,
|
|
63
|
+
}, this.selectionElement);
|
|
64
|
+
}
|
|
65
|
+
this.annotationBorder = new AnnotationBorder(this.selectionElement, this.moveAnnotation, this.resizeAnnotation, this.onItemDblClick, this.options, this.store, !((_b = this.viewerCanvas) === null || _b === void 0 ? void 0 : _b.licenseFeatures.annotate) || false);
|
|
66
|
+
}
|
|
67
|
+
render(timestamp, state) {
|
|
68
|
+
const mode = state.viewer.mode;
|
|
69
|
+
if (this.selectedAnnotation && mode !== ViewerMode.ANNOTATION_SELECTED) {
|
|
70
|
+
this.deselectAnnotation();
|
|
71
|
+
}
|
|
72
|
+
const { pageLayoutMode } = state.document;
|
|
73
|
+
if ((pageLayoutMode === PdfPageLayoutMode.SINGLE_PAGE ||
|
|
74
|
+
pageLayoutMode === PdfPageLayoutMode.TWO_PAGE_LEFT ||
|
|
75
|
+
pageLayoutMode === PdfPageLayoutMode.TWO_PAGE_RIGHT) &&
|
|
76
|
+
this.selectedAnnotation &&
|
|
77
|
+
state.document.firstVisiblePageChanged) {
|
|
78
|
+
this.deselectAnnotation();
|
|
79
|
+
this.store.canvas.setCanvasInvalidated(true);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
if ((state.pointer.action === 'click' || state.pointer.action === 'dblclick') &&
|
|
83
|
+
(mode === ViewerMode.DEFAULT ||
|
|
84
|
+
mode === ViewerMode.ANNOTATION_SELECTED ||
|
|
85
|
+
mode === ViewerMode.POPUP_SELECTED)) {
|
|
86
|
+
const annotationsOnPoint = this.pdfViewerApi.getAnnotationsOnPoint({
|
|
87
|
+
x: state.pointer.x.devicePixels,
|
|
88
|
+
y: state.pointer.y.devicePixels,
|
|
89
|
+
});
|
|
90
|
+
let breakRenderLoop = false;
|
|
91
|
+
if (annotationsOnPoint && annotationsOnPoint.length) {
|
|
92
|
+
// the most visible annotation is the last element of the returned list
|
|
93
|
+
for (let i = annotationsOnPoint.length - 1; i >= 0; i--) {
|
|
94
|
+
const annotationOnPoint = annotationsOnPoint[i];
|
|
95
|
+
if (annotationOnPoint.behaviors.selectable) {
|
|
96
|
+
if (state.pointer.action === 'click') {
|
|
97
|
+
if (annotationOnPoint.itemType === PdfItemType.WIDGET) {
|
|
98
|
+
if (this.viewerCanvas && !annotationOnPoint.widget.readOnly) {
|
|
99
|
+
this.viewerCanvas.activateModule('FormFieldModule', {
|
|
100
|
+
annotationId: annotationOnPoint.id,
|
|
101
|
+
action: 'click',
|
|
102
|
+
});
|
|
103
|
+
breakRenderLoop = true;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else if (annotationOnPoint.id !== state.viewer.selectedAnnotationId) {
|
|
108
|
+
if (state.viewer.selectedAnnotationId) {
|
|
109
|
+
this.deselectAnnotation();
|
|
110
|
+
}
|
|
111
|
+
if (!annotationOnPoint.isHidden()) {
|
|
112
|
+
this.selectAnnotation(annotationOnPoint);
|
|
113
|
+
breakRenderLoop = true;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else if (state.pointer.action === 'dblclick') {
|
|
119
|
+
this.onItemDblClick(annotationOnPoint.id);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else if (state.viewer.selectedAnnotationId) {
|
|
126
|
+
this.deselectAnnotation();
|
|
127
|
+
breakRenderLoop = true;
|
|
128
|
+
}
|
|
129
|
+
if (breakRenderLoop) {
|
|
130
|
+
this.store.canvas.setCanvasInvalidated(true);
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (mode === ViewerMode.ANNOTATION_SELECTED && state.viewer.selectedAnnotationId) {
|
|
135
|
+
const annotation = state.annotations.all[state.viewer.selectedAnnotationId];
|
|
136
|
+
if (this.selectedAnnotation === null) {
|
|
137
|
+
this.selectAnnotation(annotation);
|
|
138
|
+
}
|
|
139
|
+
if (this.annotationBorder && state.canvas.canvasInvalidated) {
|
|
140
|
+
const pageRect = state.document.pageRects[annotation.pdfRect.page];
|
|
141
|
+
if (pageRect) {
|
|
142
|
+
this.annotationBorder.updatePageRect(pageRect);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (state.viewer.selectedAnnotationChanged || state.canvas.canvasInvalidated) {
|
|
146
|
+
this.updateSelectionElementPosition(annotation);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
updateSelectionElementPosition(annotation) {
|
|
151
|
+
if (this.selectionElement) {
|
|
152
|
+
const rect = this.pdfViewerApi.transformPdfPageRectToScreenRect(annotation.pdfRect);
|
|
153
|
+
const annotationY = rect.y / devicePixelRatio;
|
|
154
|
+
const annotationX = rect.x / devicePixelRatio;
|
|
155
|
+
const annotationW = rect.w / devicePixelRatio;
|
|
156
|
+
const annotationH = rect.h / devicePixelRatio;
|
|
157
|
+
const newBarAtTop = annotationY > 80;
|
|
158
|
+
this.selectionElement.style.top = annotationY + 'px';
|
|
159
|
+
this.selectionElement.style.left = annotationX + 'px';
|
|
160
|
+
this.selectionElement.style.width = annotationW + 'px';
|
|
161
|
+
this.selectionElement.style.height = annotationH + 'px';
|
|
162
|
+
if (this.barAtTop !== newBarAtTop) {
|
|
163
|
+
this.barAtTop = newBarAtTop;
|
|
164
|
+
if (this.barAtTop) {
|
|
165
|
+
this.selectionElement.classList.remove('pwv-contextbar-bottom');
|
|
166
|
+
this.selectionElement.classList.add('pwv-contextbar-top');
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
this.selectionElement.classList.remove('pwv-contextbar-top');
|
|
170
|
+
this.selectionElement.classList.add('pwv-contextbar-bottom');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
// update contextbar left position
|
|
174
|
+
const contextbarElement = this.selectionElement.lastChild;
|
|
175
|
+
if (contextbarElement && contextbarElement.nodeType === 1) {
|
|
176
|
+
const state = this.store.getState();
|
|
177
|
+
const canvasWidth = state.canvas.width.cssPixels;
|
|
178
|
+
const barWidth = contextbarElement.offsetWidth;
|
|
179
|
+
const barCenter = barWidth / 2;
|
|
180
|
+
const padding = 4;
|
|
181
|
+
let left = 0;
|
|
182
|
+
if (barWidth > annotationW) {
|
|
183
|
+
left = (barWidth - annotationW) / -2;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
left = (annotationW - barWidth) / 2;
|
|
187
|
+
}
|
|
188
|
+
if (annotationX + left + padding < 0) {
|
|
189
|
+
left = annotationX * -1 + padding;
|
|
190
|
+
if (annotationX + annotationW < barCenter) {
|
|
191
|
+
left = annotationW - barCenter;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (annotationX + left + barWidth + padding > canvasWidth) {
|
|
195
|
+
left = canvasWidth - annotationX - barWidth - padding;
|
|
196
|
+
if (left * -1 > barCenter) {
|
|
197
|
+
left = barCenter * -1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
contextbarElement.style.left = left + 'px';
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
selectAnnotation(annotation, preventEvent) {
|
|
205
|
+
var _a, _b;
|
|
206
|
+
if (this.selectionElement && this.context && this.annotationBorder) {
|
|
207
|
+
this.selectedAnnotation = annotation;
|
|
208
|
+
const pageRect = this.store.getState().document.pageRects[annotation.pdfRect.page];
|
|
209
|
+
this.annotationBorder.deselectAnnotation();
|
|
210
|
+
this.annotationBorder.setAnnotation(annotation, pageRect);
|
|
211
|
+
const state = this.store.getState();
|
|
212
|
+
if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.contextBar) {
|
|
213
|
+
const commands = (_b = state.viewer.contextBarItems[annotation.itemType]) !== null && _b !== void 0 ? _b : [];
|
|
214
|
+
this.contextBar.setAnnotation({ annotation, commands });
|
|
215
|
+
}
|
|
216
|
+
this.context.canvas.style.display = 'none';
|
|
217
|
+
this.selectionElement.style.display = 'block';
|
|
218
|
+
this.barAtTop = true;
|
|
219
|
+
this.selectionElement.classList.remove('pwv-contextbar-bottom');
|
|
220
|
+
this.selectionElement.classList.add('pwv-contextbar-top');
|
|
221
|
+
this.updateSelectionElementPosition(annotation);
|
|
222
|
+
this.store.viewer.selectAnnotation(annotation);
|
|
223
|
+
this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
|
|
224
|
+
if (this.viewerCanvas && !preventEvent) {
|
|
225
|
+
this.dispatchEvent('itemSelected', annotation);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
deselectAnnotation() {
|
|
230
|
+
if (this.context && this.selectionElement && this.annotationBorder) {
|
|
231
|
+
const annot = this.selectedAnnotation;
|
|
232
|
+
this.selectedAnnotation = null;
|
|
233
|
+
this.context.clearRect(0, 0, this.context.canvas.width, this.context.canvas.height);
|
|
234
|
+
this.annotationBorder.deselectAnnotation();
|
|
235
|
+
this.context.canvas.style.display = 'none';
|
|
236
|
+
this.selectionElement.style.display = 'none';
|
|
237
|
+
this.store.viewer.deselectAnnotation();
|
|
238
|
+
if (this.viewerCanvas && annot !== null) {
|
|
239
|
+
this.dispatchEvent('itemDeselected', annot);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
rotateAnnotation(id) {
|
|
244
|
+
if (this.pdfViewerApi) {
|
|
245
|
+
const item = this.pdfViewerApi.getItem(id);
|
|
246
|
+
item.rotation = (item.rotation + 90) % 360;
|
|
247
|
+
this.pdfViewerApi.updateItem(item).then((item) => {
|
|
248
|
+
if (this.annotationBorder) {
|
|
249
|
+
const annotation = item;
|
|
250
|
+
const pageRect = this.store.getState().document.pageRects[annotation.pdfRect.page];
|
|
251
|
+
this.annotationBorder.setAnnotation(annotation, pageRect);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
moveAnnotation(id, point) {
|
|
257
|
+
var _a;
|
|
258
|
+
if (this.pdfViewerApi) {
|
|
259
|
+
const item = this.pdfViewerApi.getItem(id);
|
|
260
|
+
const newItemPos = this.pdfViewerApi.transformScreenPointToPdfPoint({
|
|
261
|
+
x: point.x * window.devicePixelRatio,
|
|
262
|
+
y: point.y * window.devicePixelRatio,
|
|
263
|
+
}, item.page, true);
|
|
264
|
+
if (newItemPos.pdfPoint.page === item.pdfRect.page) {
|
|
265
|
+
switch (this.pdfViewerApi.getRotation()) {
|
|
266
|
+
case 0:
|
|
267
|
+
item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX;
|
|
268
|
+
item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY;
|
|
269
|
+
break;
|
|
270
|
+
case 90:
|
|
271
|
+
item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX - item.pdfRect.pdfW;
|
|
272
|
+
item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY;
|
|
273
|
+
break;
|
|
274
|
+
case 180:
|
|
275
|
+
item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX - item.pdfRect.pdfW;
|
|
276
|
+
item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY - item.pdfRect.pdfH;
|
|
277
|
+
break;
|
|
278
|
+
case 270:
|
|
279
|
+
item.pdfRect.pdfX = newItemPos.pdfPoint.pdfX;
|
|
280
|
+
item.pdfRect.pdfY = newItemPos.pdfPoint.pdfY - item.pdfRect.pdfH;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
this.store.annotations.updateAnnotation(item);
|
|
285
|
+
this.store.canvas.setCanvasInvalidated(true);
|
|
286
|
+
if ((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) {
|
|
287
|
+
this.pdfViewerApi.updateItem(item);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
resizeAnnotation(id, rect) {
|
|
292
|
+
var _a;
|
|
293
|
+
if (this.pdfViewerApi) {
|
|
294
|
+
const item = this.pdfViewerApi.getItem(id);
|
|
295
|
+
const newItemRect = this.pdfViewerApi.transformScreenRectToPdfRect({
|
|
296
|
+
x: rect.x * window.devicePixelRatio,
|
|
297
|
+
y: rect.y * window.devicePixelRatio,
|
|
298
|
+
w: rect.w * window.devicePixelRatio,
|
|
299
|
+
h: rect.h * window.devicePixelRatio,
|
|
300
|
+
}, item.pdfRect.page);
|
|
301
|
+
if (newItemRect.page === item.pdfRect.page) {
|
|
302
|
+
item.pdfRect = newItemRect;
|
|
303
|
+
}
|
|
304
|
+
this.store.annotations.updateAnnotation(item);
|
|
305
|
+
this.store.canvas.setCanvasInvalidated(true);
|
|
306
|
+
if ((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) {
|
|
307
|
+
this.pdfViewerApi.updateItem(item);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
copyAnnotationText(id) {
|
|
312
|
+
if (this.pdfViewerApi) {
|
|
313
|
+
const item = this.pdfViewerApi.getItem(id);
|
|
314
|
+
if (item.itemType === PdfItemType.HIGHLIGHT ||
|
|
315
|
+
item.itemType === PdfItemType.UNDERLINE ||
|
|
316
|
+
item.itemType === PdfItemType.SQUIGGLY ||
|
|
317
|
+
item.itemType === PdfItemType.STRIKE_OUT) {
|
|
318
|
+
const quadPointAnnotation = item;
|
|
319
|
+
const firstRect = quadPointAnnotation.quadrilaterals[0];
|
|
320
|
+
const lastRect = quadPointAnnotation.quadrilaterals[quadPointAnnotation.quadrilaterals.length - 1];
|
|
321
|
+
const startPoint = {
|
|
322
|
+
pdfX: firstRect.topLeft.x,
|
|
323
|
+
pdfY: firstRect.topLeft.y,
|
|
324
|
+
page: firstRect.pageNumber,
|
|
325
|
+
};
|
|
326
|
+
const endPoint = {
|
|
327
|
+
pdfX: lastRect.bottomRight.x,
|
|
328
|
+
pdfY: lastRect.bottomRight.y,
|
|
329
|
+
page: lastRect.pageNumber,
|
|
330
|
+
};
|
|
331
|
+
const text = this.pdfViewerApi.getText(startPoint, endPoint);
|
|
332
|
+
copyTextToClipboard(text || '');
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
toggleLock(id) {
|
|
337
|
+
var _a;
|
|
338
|
+
if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {
|
|
339
|
+
const annot = this.pdfViewerApi.getItem(id);
|
|
340
|
+
if (this.options.annotation.trackHistory) {
|
|
341
|
+
addHistoryEntry(annot, annot.isLocked() ? 'unlock' : 'lock', this.options.viewer.general.user);
|
|
342
|
+
}
|
|
343
|
+
annot.setLock(!annot.isLocked());
|
|
344
|
+
if (this.annotationBorder) {
|
|
345
|
+
this.annotationBorder.deselectAnnotation();
|
|
346
|
+
const pageRect = this.store.getState().document.pageRects[annot.pdfRect.page];
|
|
347
|
+
this.annotationBorder.setAnnotation(annot, pageRect);
|
|
348
|
+
}
|
|
349
|
+
this.store.annotations.updateAnnotation(annot);
|
|
350
|
+
this.pdfViewerApi.updateItem(annot);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
deleteAnnotation(id) {
|
|
354
|
+
var _a;
|
|
355
|
+
if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {
|
|
356
|
+
const item = this.pdfViewerApi.getItem(id);
|
|
357
|
+
if (this.options.annotation.hideOnDelete) {
|
|
358
|
+
item.setHidden(true);
|
|
359
|
+
item.popup.isOpen = false;
|
|
360
|
+
if (this.options.annotation.trackHistory) {
|
|
361
|
+
addHistoryEntry(item, 'delete', this.options.viewer.general.user);
|
|
362
|
+
}
|
|
363
|
+
this.store.annotations.updateAnnotation(item);
|
|
364
|
+
this.pdfViewerApi.updateItem(item);
|
|
365
|
+
this.deselectAnnotation();
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
this.pdfViewerApi
|
|
369
|
+
.deleteItem(item)
|
|
370
|
+
.then(() => {
|
|
371
|
+
this.deselectAnnotation();
|
|
372
|
+
})
|
|
373
|
+
.catch((error) => {
|
|
374
|
+
console.error(error);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
deletePopup(id) {
|
|
380
|
+
var _a;
|
|
381
|
+
if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {
|
|
382
|
+
const item = this.pdfViewerApi.getItem(id);
|
|
383
|
+
item.content = null;
|
|
384
|
+
item.popup.isOpen = false;
|
|
385
|
+
this.store.annotations.updateAnnotation(item);
|
|
386
|
+
this.store.canvas.setCanvasInvalidated(true);
|
|
387
|
+
this.pdfViewerApi.updateItem(item);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
createPopup(id) {
|
|
391
|
+
var _a;
|
|
392
|
+
if (((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && this.pdfViewerApi) {
|
|
393
|
+
const item = this.pdfViewerApi.getItem(id);
|
|
394
|
+
item.content = '';
|
|
395
|
+
item.popup.isOpen = true;
|
|
396
|
+
item.popup.pdfRect.pdfX = item.pdfRect.pdfX;
|
|
397
|
+
item.popup.pdfRect.pdfY = item.pdfRect.pdfY - (item.popup.pdfRect.pdfH + 10);
|
|
398
|
+
this.store.annotations.updateAnnotation(item);
|
|
399
|
+
this.store.canvas.setCanvasInvalidated(true);
|
|
400
|
+
this.pdfViewerApi.updateItem(item).then(() => {
|
|
401
|
+
this.store.viewer.selectPopup({ id: item.id, focus: true });
|
|
402
|
+
});
|
|
403
|
+
this.deselectAnnotation();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
openPopup(id) {
|
|
407
|
+
var _a, _b;
|
|
408
|
+
if (this.pdfViewerApi) {
|
|
409
|
+
const item = this.pdfViewerApi.getItem(id);
|
|
410
|
+
if (!((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate) && (!item.content || !item.content)) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
if (!item.popup) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
item.popup.isOpen = true;
|
|
417
|
+
this.store.annotations.updateAnnotation(item);
|
|
418
|
+
this.store.canvas.setCanvasInvalidated(true);
|
|
419
|
+
if ((_b = this.viewerCanvas) === null || _b === void 0 ? void 0 : _b.licenseFeatures.annotate) {
|
|
420
|
+
this.pdfViewerApi.updateItem(item).then(() => {
|
|
421
|
+
this.store.viewer.selectPopup({ id: item.id, focus: true });
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
this.deselectAnnotation();
|
|
426
|
+
this.store.viewer.selectPopup({ id: item.id, focus: true });
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
onItemDblClick(id) {
|
|
431
|
+
if (this.pdfViewerApi) {
|
|
432
|
+
const item = this.pdfViewerApi.getItem(id);
|
|
433
|
+
const { behaviors } = item;
|
|
434
|
+
if (item.isHidden()) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
if (item.itemType === PdfItemType.FREE_TEXT && !item.isReadOnly() && !item.isLocked()) {
|
|
438
|
+
if (this.viewerCanvas) {
|
|
439
|
+
this.viewerCanvas.activateModule('FreetextAnnotationModule', item.id);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
else if (behaviors.canHavePopup && !item.isHidden()) {
|
|
443
|
+
this.openPopup(id);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
onItemSelected(item) {
|
|
448
|
+
if (item.itemCategory === PdfItemCategory.ANNOTATION) {
|
|
449
|
+
this.selectAnnotation(item, true);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ViewLayerBase } from './ViewLayerBase';
|
|
2
|
+
import { ViewerCanvasState } from '../state/store';
|
|
3
|
+
/** internal */
|
|
4
|
+
export declare class BusyStateLayer extends ViewLayerBase {
|
|
5
|
+
private busyStateView;
|
|
6
|
+
constructor();
|
|
7
|
+
create(): void;
|
|
8
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ViewLayerBase } from './ViewLayerBase';
|
|
2
|
+
/** internal */
|
|
3
|
+
export class BusyStateLayer extends ViewLayerBase {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
7
|
+
create() {
|
|
8
|
+
this.busyStateView = this.createHtmlLayer();
|
|
9
|
+
this.busyStateView.classList.add('pwv-BusyLoader');
|
|
10
|
+
this.busyStateView.style.display = 'none';
|
|
11
|
+
const ct = document.createElement('div');
|
|
12
|
+
this.busyStateView.appendChild(ct);
|
|
13
|
+
const rects = ['rect-1', 'rect-2', 'rect-3', 'rect-4', 'rect-5'];
|
|
14
|
+
rects.forEach((rect) => {
|
|
15
|
+
const rectElement = document.createElement('div');
|
|
16
|
+
rectElement.classList.add(rect);
|
|
17
|
+
ct.appendChild(rectElement);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
render(timestamp, state) {
|
|
21
|
+
if (this.busyStateView && state.document.busyStateChanged) {
|
|
22
|
+
this.busyStateView.style.display = state.document.busyState ? 'block' : 'none';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ViewLayerBase } from './ViewLayerBase';
|
|
2
|
+
import { ViewerCanvasState } from '../state/store';
|
|
3
|
+
/** internal */
|
|
4
|
+
export declare class PdfDocumentLayer extends ViewLayerBase {
|
|
5
|
+
context: CanvasRenderingContext2D | null | undefined;
|
|
6
|
+
private canvas;
|
|
7
|
+
constructor();
|
|
8
|
+
create(): void;
|
|
9
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { PdfItemType, PdfActionType, } from '../../pdf-viewer-api';
|
|
2
|
+
import { ViewLayerBase } from './ViewLayerBase';
|
|
3
|
+
import { ViewerMode, CursorStyle } from '../state/viewer';
|
|
4
|
+
import { renderTextSelection } from './canvasShapes';
|
|
5
|
+
/** internal */
|
|
6
|
+
export class PdfDocumentLayer extends ViewLayerBase {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
}
|
|
10
|
+
create() {
|
|
11
|
+
this.context = this.createCanvas();
|
|
12
|
+
this.canvas = this.context.canvas;
|
|
13
|
+
}
|
|
14
|
+
render(timestamp, state) {
|
|
15
|
+
if (this.pdfViewerApi) {
|
|
16
|
+
const draw = state.canvas.canvasInvalidated ||
|
|
17
|
+
state.canvas.widthChanged ||
|
|
18
|
+
state.canvas.heightChanged ||
|
|
19
|
+
state.viewer.modeChanged ||
|
|
20
|
+
state.viewer.textSelectionChanged ||
|
|
21
|
+
state.pointer.stateChanged ||
|
|
22
|
+
!state.search.painted;
|
|
23
|
+
const defaultState = state.viewer.mode === ViewerMode.DEFAULT;
|
|
24
|
+
// set cursor style and handle link click
|
|
25
|
+
if (defaultState && (state.pointer.positionChanged || state.pointer.stateChanged)) {
|
|
26
|
+
const pointerPos = {
|
|
27
|
+
x: state.pointer.x.devicePixels,
|
|
28
|
+
y: state.pointer.y.devicePixels,
|
|
29
|
+
};
|
|
30
|
+
const pointerPdfPos = this.pdfViewerApi.transformScreenPointToPdfPoint(pointerPos);
|
|
31
|
+
this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
|
|
32
|
+
if (pointerPdfPos.isOnPage) {
|
|
33
|
+
const annotationsOnPoint = this.pdfViewerApi.getAnnotationsOnPoint(pointerPos);
|
|
34
|
+
const annotationOnPoint = annotationsOnPoint
|
|
35
|
+
? annotationsOnPoint[annotationsOnPoint.length - 1]
|
|
36
|
+
: null;
|
|
37
|
+
if (annotationOnPoint) {
|
|
38
|
+
const itemType = annotationOnPoint.itemType;
|
|
39
|
+
if ((itemType === PdfItemType.HIGHLIGHT ||
|
|
40
|
+
itemType === PdfItemType.SQUIGGLY ||
|
|
41
|
+
itemType === PdfItemType.STRIKE_OUT) &&
|
|
42
|
+
this.pdfViewerApi.getTextFragmentOnPoint(pointerPos) !== null) {
|
|
43
|
+
this.store.viewer.setCursorStyle(CursorStyle.TEXT);
|
|
44
|
+
}
|
|
45
|
+
else if (itemType === PdfItemType.LINK) {
|
|
46
|
+
const link = annotationOnPoint;
|
|
47
|
+
if ((link.destination && link.actionType === PdfActionType.GO_TO) ||
|
|
48
|
+
(link.uri &&
|
|
49
|
+
link.actionType === PdfActionType.URI &&
|
|
50
|
+
this.options.viewer.permissions.allowExternalLinks)) {
|
|
51
|
+
this.store.viewer.setCursorStyle(CursorStyle.POINTER);
|
|
52
|
+
}
|
|
53
|
+
if (state.pointer.action === 'click') {
|
|
54
|
+
if (link.destination && link.actionType === PdfActionType.GO_TO) {
|
|
55
|
+
this.pdfViewerApi.goTo(link.destination);
|
|
56
|
+
}
|
|
57
|
+
else if (link.uri &&
|
|
58
|
+
link.actionType === PdfActionType.URI &&
|
|
59
|
+
this.options.viewer.permissions.allowExternalLinks) {
|
|
60
|
+
window.open(link.uri, undefined, 'noreferrer');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const textFragmentOnPoint = this.pdfViewerApi.getTextFragmentOnPoint(pointerPos);
|
|
67
|
+
if (textFragmentOnPoint) {
|
|
68
|
+
this.store.viewer.setCursorStyle(CursorStyle.TEXT);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (draw) {
|
|
74
|
+
const ctx = this.context;
|
|
75
|
+
ctx.save();
|
|
76
|
+
const { pageShadow, currentPageShadow } = this.options.viewer.general;
|
|
77
|
+
// draw pdf
|
|
78
|
+
if (state.viewer.mode === ViewerMode.MODULE_SELECTED) {
|
|
79
|
+
ctx.globalAlpha = 0.75;
|
|
80
|
+
this.pdfViewerApi.renderCanvas(ctx, { pageShadow, currentPageShadow });
|
|
81
|
+
ctx.globalAlpha = 1;
|
|
82
|
+
ctx.fillStyle = 'rgb(255,255,255)';
|
|
83
|
+
ctx.globalCompositeOperation = 'destination-over';
|
|
84
|
+
for (const k in state.document.pageRects) {
|
|
85
|
+
if (state.document.pageRects[k]) {
|
|
86
|
+
const pageRect = state.document.pageRects[k];
|
|
87
|
+
ctx.fillRect(pageRect.x, pageRect.y, pageRect.w, pageRect.h);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.pdfViewerApi.renderCanvas(ctx, { pageShadow, currentPageShadow });
|
|
93
|
+
}
|
|
94
|
+
ctx.restore();
|
|
95
|
+
if (state.search.match) {
|
|
96
|
+
ctx.save();
|
|
97
|
+
ctx.globalCompositeOperation = 'multiply';
|
|
98
|
+
ctx.fillStyle = this.options.viewer.general.searchMatchColor;
|
|
99
|
+
ctx.globalAlpha = 0.9;
|
|
100
|
+
ctx.beginPath();
|
|
101
|
+
state.search.match.forEach((match) => {
|
|
102
|
+
if (match.pageNumber >= state.document.firstVisiblePage &&
|
|
103
|
+
match.pageNumber <= state.document.lastVisiblePage) {
|
|
104
|
+
const path = this.pdfViewerApi.transformQuadrilateralToViewport(match);
|
|
105
|
+
for (let k = 0; k < path.length; k++) {
|
|
106
|
+
const point = path[k];
|
|
107
|
+
if (k === 0) {
|
|
108
|
+
ctx.moveTo(point.x, point.y);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
ctx.lineTo(point.x, point.y);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
ctx.closePath();
|
|
117
|
+
ctx.fill();
|
|
118
|
+
ctx.restore();
|
|
119
|
+
}
|
|
120
|
+
this.store.search.matchPainted();
|
|
121
|
+
if (state.viewer.textSelection) {
|
|
122
|
+
ctx.save();
|
|
123
|
+
const selection = state.viewer.textSelection;
|
|
124
|
+
const screenSelection = [];
|
|
125
|
+
for (let i = 0; i < selection.quadrilaterals.length; i++) {
|
|
126
|
+
const path = this.pdfViewerApi.transformQuadrilateralToViewport(selection.quadrilaterals[i]);
|
|
127
|
+
screenSelection.push(path);
|
|
128
|
+
}
|
|
129
|
+
renderTextSelection(ctx, devicePixelRatio * state.document.zoom, this.options.viewer.general.textSelectionColor, screenSelection);
|
|
130
|
+
ctx.restore();
|
|
131
|
+
if (state.pointer.isDown &&
|
|
132
|
+
state.viewer.textSelectionState === 'selecting' &&
|
|
133
|
+
state.viewer.textSelectionType === 'rectangular') {
|
|
134
|
+
const { textSelection } = state.viewer;
|
|
135
|
+
const startPoint = this.pdfViewerApi.transformPdfPointToScreenPoint(textSelection.startPoint);
|
|
136
|
+
const endPoint = this.pdfViewerApi.transformPdfPointToScreenPoint(textSelection.endPoint);
|
|
137
|
+
ctx.save();
|
|
138
|
+
const lineWidth = 2 * devicePixelRatio;
|
|
139
|
+
ctx.lineWidth = lineWidth;
|
|
140
|
+
ctx.setLineDash([lineWidth, lineWidth]);
|
|
141
|
+
ctx.strokeStyle = this.options.viewer.general.textSelectionColor;
|
|
142
|
+
ctx.strokeRect(startPoint.x, startPoint.y, endPoint.x - startPoint.x, endPoint.y - startPoint.y);
|
|
143
|
+
ctx.restore();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|