@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,48 @@
|
|
|
1
|
+
import { ViewLayerBase } from './ViewLayerBase';
|
|
2
|
+
import { ViewerCanvasState } from '../state/store';
|
|
3
|
+
/** internal */
|
|
4
|
+
export declare class ScrollLayer extends ViewLayerBase {
|
|
5
|
+
private htmlLayerElement;
|
|
6
|
+
private horizontalScrollEnabled;
|
|
7
|
+
private horizontalScrollBar;
|
|
8
|
+
private horizontalScrollHandle;
|
|
9
|
+
private horizontalScrollBarVisible;
|
|
10
|
+
private horizontalScrollRatio;
|
|
11
|
+
private horizontalScrollBarSize;
|
|
12
|
+
private horizontalScrollHandleSize;
|
|
13
|
+
private horizontalScrollHandlePos;
|
|
14
|
+
private horizontalScrollTimer;
|
|
15
|
+
private horizontalScrollExpanded;
|
|
16
|
+
private verticalScrollEnabled;
|
|
17
|
+
private verticalScrollBar;
|
|
18
|
+
private verticalScrollHandle;
|
|
19
|
+
private verticalScrollBarVisible;
|
|
20
|
+
private verticalScrollRatio;
|
|
21
|
+
private verticalScrollBarSize;
|
|
22
|
+
private verticalScrollHandleSize;
|
|
23
|
+
private verticalScrollHandlePos;
|
|
24
|
+
private verticalScrollTimer;
|
|
25
|
+
private verticalScrollExpanded;
|
|
26
|
+
private canScrollDown;
|
|
27
|
+
private canScrollUp;
|
|
28
|
+
private canScrollRight;
|
|
29
|
+
private canScrollLeft;
|
|
30
|
+
private isTouchScrolling;
|
|
31
|
+
private recentTouchPos;
|
|
32
|
+
private touchScrollAxis;
|
|
33
|
+
private autoscrollLastTimestamp;
|
|
34
|
+
private autoscrollDist;
|
|
35
|
+
private autoscrollDistTime;
|
|
36
|
+
private autoscrollDx;
|
|
37
|
+
constructor();
|
|
38
|
+
create(): void;
|
|
39
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
40
|
+
private updateCanScrollVertical;
|
|
41
|
+
private updateCanScrollHorizontal;
|
|
42
|
+
private startVerticalScroll;
|
|
43
|
+
private verticalScroll;
|
|
44
|
+
private endVerticalScroll;
|
|
45
|
+
private startHorizontalScroll;
|
|
46
|
+
private horizontalScroll;
|
|
47
|
+
private endHorizontalScroll;
|
|
48
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { ViewLayerBase } from './ViewLayerBase';
|
|
2
|
+
import { DragMoveHandler } from '../../common/DragMoveHandler';
|
|
3
|
+
import { ViewerMode } from '../state/viewer';
|
|
4
|
+
/** internal */
|
|
5
|
+
export class ScrollLayer extends ViewLayerBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.horizontalScrollEnabled = false;
|
|
9
|
+
this.horizontalScrollBarVisible = false;
|
|
10
|
+
this.horizontalScrollRatio = 0;
|
|
11
|
+
this.horizontalScrollBarSize = 0;
|
|
12
|
+
this.horizontalScrollHandleSize = 0;
|
|
13
|
+
this.horizontalScrollHandlePos = 0;
|
|
14
|
+
this.horizontalScrollTimer = 0;
|
|
15
|
+
this.horizontalScrollExpanded = false;
|
|
16
|
+
this.verticalScrollEnabled = false;
|
|
17
|
+
this.verticalScrollBarVisible = false;
|
|
18
|
+
this.verticalScrollRatio = 0;
|
|
19
|
+
this.verticalScrollBarSize = 0;
|
|
20
|
+
this.verticalScrollHandleSize = 0;
|
|
21
|
+
this.verticalScrollHandlePos = 0;
|
|
22
|
+
this.verticalScrollTimer = 0;
|
|
23
|
+
this.verticalScrollExpanded = false;
|
|
24
|
+
this.canScrollDown = false;
|
|
25
|
+
this.canScrollUp = false;
|
|
26
|
+
this.canScrollRight = false;
|
|
27
|
+
this.canScrollLeft = false;
|
|
28
|
+
this.isTouchScrolling = false;
|
|
29
|
+
this.recentTouchPos = [];
|
|
30
|
+
this.touchScrollAxis = null;
|
|
31
|
+
this.autoscrollLastTimestamp = 0;
|
|
32
|
+
this.autoscrollDist = 0;
|
|
33
|
+
this.autoscrollDistTime = 0;
|
|
34
|
+
this.autoscrollDx = 0;
|
|
35
|
+
this.startVerticalScroll = this.startVerticalScroll.bind(this);
|
|
36
|
+
this.verticalScroll = this.verticalScroll.bind(this);
|
|
37
|
+
this.endVerticalScroll = this.endVerticalScroll.bind(this);
|
|
38
|
+
this.startHorizontalScroll = this.startHorizontalScroll.bind(this);
|
|
39
|
+
this.horizontalScroll = this.horizontalScroll.bind(this);
|
|
40
|
+
this.endHorizontalScroll = this.endHorizontalScroll.bind(this);
|
|
41
|
+
this.horizontalScrollBar = document.createElement('div');
|
|
42
|
+
this.horizontalScrollBar.style.display = 'none';
|
|
43
|
+
this.horizontalScrollBar.classList.add('pwv-horizontal-scrollbar');
|
|
44
|
+
this.horizontalScrollHandle = document.createElement('div');
|
|
45
|
+
this.horizontalScrollHandle.classList.add('pwv-scrollbar-handle');
|
|
46
|
+
this.horizontalScrollBar.appendChild(this.horizontalScrollHandle);
|
|
47
|
+
this.verticalScrollBar = document.createElement('div');
|
|
48
|
+
this.verticalScrollBar.style.display = 'none';
|
|
49
|
+
this.verticalScrollBar.classList.add('pwv-vertical-scrollbar');
|
|
50
|
+
this.verticalScrollHandle = document.createElement('div');
|
|
51
|
+
this.verticalScrollHandle.classList.add('pwv-scrollbar-handle');
|
|
52
|
+
this.verticalScrollBar.appendChild(this.verticalScrollHandle);
|
|
53
|
+
new DragMoveHandler(this.verticalScrollHandle, this.startVerticalScroll, this.verticalScroll, this.endVerticalScroll);
|
|
54
|
+
new DragMoveHandler(this.horizontalScrollHandle, this.startHorizontalScroll, this.horizontalScroll, this.endHorizontalScroll);
|
|
55
|
+
}
|
|
56
|
+
create() {
|
|
57
|
+
this.htmlLayerElement = this.createHtmlLayer();
|
|
58
|
+
this.htmlLayerElement.appendChild(this.horizontalScrollBar);
|
|
59
|
+
this.htmlLayerElement.appendChild(this.verticalScrollBar);
|
|
60
|
+
}
|
|
61
|
+
render(timestamp, state) {
|
|
62
|
+
const canvasHeight = state.canvas.height.cssPixels;
|
|
63
|
+
const documentHeight = state.document.height.cssPixels;
|
|
64
|
+
// update vertical scroll bar size & visibility
|
|
65
|
+
if (state.document.heightChanged || state.canvas.heightChanged) {
|
|
66
|
+
this.verticalScrollEnabled = documentHeight > canvasHeight;
|
|
67
|
+
if (this.verticalScrollEnabled !== this.verticalScrollBarVisible) {
|
|
68
|
+
this.verticalScrollBar.style.display = this.verticalScrollEnabled ? 'block' : 'none';
|
|
69
|
+
this.verticalScrollBarVisible = this.verticalScrollEnabled;
|
|
70
|
+
}
|
|
71
|
+
if (this.verticalScrollEnabled) {
|
|
72
|
+
this.verticalScrollBarSize = this.verticalScrollBar.clientHeight;
|
|
73
|
+
this.verticalScrollHandleSize = (this.verticalScrollBarSize * canvasHeight) / documentHeight;
|
|
74
|
+
if (this.verticalScrollHandleSize < 50) {
|
|
75
|
+
this.verticalScrollHandleSize = 50;
|
|
76
|
+
}
|
|
77
|
+
this.verticalScrollHandle.style.height = this.verticalScrollHandleSize + 'px';
|
|
78
|
+
this.verticalScrollRatio =
|
|
79
|
+
(this.verticalScrollBarSize - this.verticalScrollHandleSize) /
|
|
80
|
+
(documentHeight - canvasHeight);
|
|
81
|
+
}
|
|
82
|
+
this.updateCanScrollVertical(state);
|
|
83
|
+
}
|
|
84
|
+
// update vertical scroll handle position
|
|
85
|
+
if (state.scroll.topPositionChanged) {
|
|
86
|
+
this.verticalScrollHandlePos = state.scroll.top.cssPixels * this.verticalScrollRatio;
|
|
87
|
+
this.verticalScrollHandle.style.top = this.verticalScrollHandlePos + 'px';
|
|
88
|
+
if (this.verticalScrollTimer) {
|
|
89
|
+
clearTimeout(this.verticalScrollTimer);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.verticalScrollBar.classList.add('pwv-scrollbar-scrolling');
|
|
93
|
+
}
|
|
94
|
+
this.verticalScrollTimer = window.setTimeout(() => {
|
|
95
|
+
this.verticalScrollTimer = 0;
|
|
96
|
+
this.verticalScrollBar.classList.remove('pwv-scrollbar-scrolling');
|
|
97
|
+
}, 500);
|
|
98
|
+
this.updateCanScrollVertical(state);
|
|
99
|
+
}
|
|
100
|
+
const canvasWidth = state.canvas.width.cssPixels;
|
|
101
|
+
const documentWidth = state.document.width.cssPixels;
|
|
102
|
+
// update horizontal scroll bar size & visibility
|
|
103
|
+
if (state.document.widthChanged || state.canvas.widthChanged) {
|
|
104
|
+
this.horizontalScrollEnabled = documentWidth > canvasWidth;
|
|
105
|
+
if (this.horizontalScrollEnabled !== this.horizontalScrollBarVisible) {
|
|
106
|
+
this.horizontalScrollBar.style.display = this.horizontalScrollEnabled ? 'block' : 'none';
|
|
107
|
+
this.horizontalScrollBarVisible = this.horizontalScrollEnabled;
|
|
108
|
+
}
|
|
109
|
+
if (this.horizontalScrollEnabled) {
|
|
110
|
+
this.horizontalScrollBarSize = this.horizontalScrollBar.clientWidth;
|
|
111
|
+
this.horizontalScrollHandleSize =
|
|
112
|
+
(this.horizontalScrollBarSize * canvasWidth) / documentWidth;
|
|
113
|
+
if (this.horizontalScrollHandleSize < 50) {
|
|
114
|
+
this.horizontalScrollHandleSize = 50;
|
|
115
|
+
}
|
|
116
|
+
this.horizontalScrollHandle.style.width = this.horizontalScrollHandleSize + 'px';
|
|
117
|
+
this.horizontalScrollRatio =
|
|
118
|
+
(this.horizontalScrollBarSize - this.horizontalScrollHandleSize) /
|
|
119
|
+
(documentWidth - canvasWidth);
|
|
120
|
+
}
|
|
121
|
+
this.updateCanScrollHorizontal(state);
|
|
122
|
+
}
|
|
123
|
+
// update horizontal scroll handle position
|
|
124
|
+
if (state.scroll.leftPositionChanged) {
|
|
125
|
+
this.horizontalScrollHandlePos = state.scroll.left.cssPixels * this.horizontalScrollRatio;
|
|
126
|
+
this.horizontalScrollHandle.style.left = this.horizontalScrollHandlePos + 'px';
|
|
127
|
+
if (this.horizontalScrollTimer) {
|
|
128
|
+
clearTimeout(this.horizontalScrollTimer);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.horizontalScrollBar.classList.add('pwv-scrollbar-scrolling');
|
|
132
|
+
}
|
|
133
|
+
this.horizontalScrollTimer = window.setTimeout(() => {
|
|
134
|
+
this.horizontalScrollTimer = 0;
|
|
135
|
+
this.horizontalScrollBar.classList.remove('pwv-scrollbar-scrolling');
|
|
136
|
+
}, 500);
|
|
137
|
+
this.updateCanScrollHorizontal(state);
|
|
138
|
+
}
|
|
139
|
+
if (state.pointer.positionChanged) {
|
|
140
|
+
const pointerX = state.pointer.x.cssPixels;
|
|
141
|
+
const pointerY = state.pointer.y.cssPixels;
|
|
142
|
+
const xPos = canvasWidth - 40;
|
|
143
|
+
const yPos = canvasHeight - 40;
|
|
144
|
+
if (!this.verticalScrollExpanded && pointerX > xPos && pointerY < yPos) {
|
|
145
|
+
this.verticalScrollBar.classList.add('pwv-scrollbar-hover');
|
|
146
|
+
this.verticalScrollExpanded = true;
|
|
147
|
+
}
|
|
148
|
+
else if (this.verticalScrollExpanded && (pointerX < xPos || pointerY > yPos)) {
|
|
149
|
+
this.verticalScrollBar.classList.remove('pwv-scrollbar-hover');
|
|
150
|
+
this.verticalScrollExpanded = false;
|
|
151
|
+
}
|
|
152
|
+
if (!this.horizontalScrollExpanded && pointerY > yPos && pointerX < xPos) {
|
|
153
|
+
this.horizontalScrollBar.classList.add('pwv-scrollbar-hover');
|
|
154
|
+
this.horizontalScrollExpanded = true;
|
|
155
|
+
}
|
|
156
|
+
else if (this.horizontalScrollExpanded && (pointerY < yPos || pointerX > xPos)) {
|
|
157
|
+
this.horizontalScrollBar.classList.remove('pwv-scrollbar-hover');
|
|
158
|
+
this.horizontalScrollExpanded = false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// touchscroll
|
|
162
|
+
const pointer = state.pointer;
|
|
163
|
+
const touchScrollEnabled = pointer.type === 'touch' &&
|
|
164
|
+
(state.viewer.mode === ViewerMode.DEFAULT ||
|
|
165
|
+
state.viewer.mode === ViewerMode.ANNOTATION_SELECTED);
|
|
166
|
+
if (touchScrollEnabled && this.viewerCanvas) {
|
|
167
|
+
if (state.pointer.isDown) {
|
|
168
|
+
if (!this.isTouchScrolling) {
|
|
169
|
+
this.isTouchScrolling = true;
|
|
170
|
+
this.autoscrollDx = 0;
|
|
171
|
+
this.touchScrollAxis = null;
|
|
172
|
+
this.recentTouchPos = [];
|
|
173
|
+
this.recentTouchPos.unshift({
|
|
174
|
+
x: pointer.x.cssPixels,
|
|
175
|
+
y: pointer.y.cssPixels,
|
|
176
|
+
time: timestamp,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
else if (pointer.positionChanged) {
|
|
180
|
+
this.recentTouchPos.unshift({
|
|
181
|
+
x: pointer.x.cssPixels,
|
|
182
|
+
y: pointer.y.cssPixels,
|
|
183
|
+
time: timestamp,
|
|
184
|
+
});
|
|
185
|
+
if (this.recentTouchPos.length > 3) {
|
|
186
|
+
this.recentTouchPos.pop();
|
|
187
|
+
}
|
|
188
|
+
const diffX = this.recentTouchPos[1].x - this.recentTouchPos[0].x;
|
|
189
|
+
const diffY = this.recentTouchPos[1].y - this.recentTouchPos[0].y;
|
|
190
|
+
const diffXabs = Math.abs(diffX);
|
|
191
|
+
const diffYabs = Math.abs(diffY);
|
|
192
|
+
const scrollAxis = this.touchScrollAxis !== null
|
|
193
|
+
? this.touchScrollAxis
|
|
194
|
+
: diffYabs > diffXabs
|
|
195
|
+
? 'y'
|
|
196
|
+
: diffXabs > diffYabs
|
|
197
|
+
? 'x'
|
|
198
|
+
: null;
|
|
199
|
+
if (this.verticalScrollEnabled && scrollAxis === 'y') {
|
|
200
|
+
if ((diffY > 0 && this.canScrollDown) || (diffY < 0 && this.canScrollUp)) {
|
|
201
|
+
this.viewerCanvas.scrollDown(diffY);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else if (this.horizontalScrollEnabled && this.touchScrollAxis === 'x') {
|
|
205
|
+
if ((diffX > 0 && this.canScrollRight) || (diffX < 0 && this.canScrollLeft)) {
|
|
206
|
+
this.viewerCanvas.scrollRight(diffX);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// lock scroll axis
|
|
210
|
+
if (this.touchScrollAxis === null && this.recentTouchPos.length >= 3) {
|
|
211
|
+
this.touchScrollAxis = diffYabs > diffXabs ? 'y' : diffXabs > diffYabs ? 'x' : null;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else if (this.isTouchScrolling) {
|
|
216
|
+
this.isTouchScrolling = false;
|
|
217
|
+
if (this.touchScrollAxis === 'x') {
|
|
218
|
+
this.autoscrollDist = this.recentTouchPos[2].x - this.recentTouchPos[0].x;
|
|
219
|
+
this.autoscrollDistTime = this.recentTouchPos[0].time - this.recentTouchPos[2].time;
|
|
220
|
+
this.autoscrollDx = Math.abs(this.autoscrollDist / this.autoscrollDistTime);
|
|
221
|
+
this.autoscrollLastTimestamp = timestamp;
|
|
222
|
+
}
|
|
223
|
+
else if (this.touchScrollAxis === 'y') {
|
|
224
|
+
this.autoscrollDist = this.recentTouchPos[2].y - this.recentTouchPos[0].y;
|
|
225
|
+
this.autoscrollDistTime = this.recentTouchPos[0].time - this.recentTouchPos[2].time;
|
|
226
|
+
this.autoscrollDx = Math.abs(this.autoscrollDist / this.autoscrollDistTime);
|
|
227
|
+
this.autoscrollLastTimestamp = timestamp;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// auto scroll
|
|
232
|
+
if (this.viewerCanvas && this.autoscrollDx !== 0) {
|
|
233
|
+
const time = timestamp - this.autoscrollLastTimestamp;
|
|
234
|
+
if (time > 1000 / 70) {
|
|
235
|
+
if (this.autoscrollDx > 3) {
|
|
236
|
+
this.autoscrollDx = 3;
|
|
237
|
+
}
|
|
238
|
+
if (this.touchScrollAxis === 'y' &&
|
|
239
|
+
((this.autoscrollDist > 0 && !this.canScrollDown) ||
|
|
240
|
+
(this.autoscrollDist < 0 && !this.canScrollUp))) {
|
|
241
|
+
this.autoscrollDx = 0;
|
|
242
|
+
}
|
|
243
|
+
else if (this.touchScrollAxis === 'x' &&
|
|
244
|
+
((this.autoscrollDist > 0 && !this.canScrollRight) ||
|
|
245
|
+
(this.autoscrollDist < 0 && !this.canScrollLeft))) {
|
|
246
|
+
this.autoscrollDx = 0;
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
const direction = Math.sign(this.autoscrollDist);
|
|
250
|
+
const distance = Math.abs(this.autoscrollDist);
|
|
251
|
+
const timeFactor = time / this.autoscrollDistTime;
|
|
252
|
+
const diff = Math.min(100, distance * this.autoscrollDx) * timeFactor;
|
|
253
|
+
const scrollDiff = diff * direction;
|
|
254
|
+
if (Math.abs(scrollDiff) < 1) {
|
|
255
|
+
this.autoscrollDx = 0;
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
if (this.touchScrollAxis === 'y') {
|
|
259
|
+
this.viewerCanvas.scrollDown(scrollDiff);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
this.viewerCanvas.scrollRight(scrollDiff);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const throttleDiff = this.autoscrollDx * 0.08 * timeFactor;
|
|
266
|
+
this.autoscrollDx = this.autoscrollDx - throttleDiff;
|
|
267
|
+
this.autoscrollLastTimestamp = timestamp;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
updateCanScrollVertical(state) {
|
|
273
|
+
this.canScrollUp = state.scroll.top.cssPixels > 0;
|
|
274
|
+
this.canScrollDown =
|
|
275
|
+
state.scroll.top.cssPixels + state.canvas.height.cssPixels <
|
|
276
|
+
state.document.height.cssPixels - 1;
|
|
277
|
+
}
|
|
278
|
+
updateCanScrollHorizontal(state) {
|
|
279
|
+
this.canScrollLeft = state.scroll.left.cssPixels > 0;
|
|
280
|
+
this.canScrollRight =
|
|
281
|
+
state.scroll.left.cssPixels + state.canvas.width.cssPixels <
|
|
282
|
+
state.document.width.cssPixels - 1;
|
|
283
|
+
}
|
|
284
|
+
startVerticalScroll(e) {
|
|
285
|
+
this.verticalScrollBar.classList.add('pwv-scrollbar-dragging');
|
|
286
|
+
}
|
|
287
|
+
verticalScroll(e) {
|
|
288
|
+
if (this.viewerCanvas) {
|
|
289
|
+
const scrollDiv = e.movementY / this.verticalScrollRatio;
|
|
290
|
+
this.viewerCanvas.scrollDown(scrollDiv);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
endVerticalScroll(e) {
|
|
294
|
+
this.verticalScrollBar.classList.remove('pwv-scrollbar-dragging');
|
|
295
|
+
}
|
|
296
|
+
startHorizontalScroll(e) {
|
|
297
|
+
this.horizontalScrollBar.classList.add('pwv-scrollbar-dragging');
|
|
298
|
+
}
|
|
299
|
+
horizontalScroll(e) {
|
|
300
|
+
if (this.viewerCanvas) {
|
|
301
|
+
const scrollDiv = e.movementX / this.horizontalScrollRatio;
|
|
302
|
+
this.viewerCanvas.scrollRight(scrollDiv);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
endHorizontalScroll(e) {
|
|
306
|
+
this.horizontalScrollBar.classList.remove('pwv-scrollbar-dragging');
|
|
307
|
+
}
|
|
308
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ViewLayerBase } from './ViewLayerBase';
|
|
2
|
+
import { ViewerCanvasState } from '../state/store';
|
|
3
|
+
/** internal */
|
|
4
|
+
export declare class TextSelectionLayer extends ViewLayerBase {
|
|
5
|
+
private startPoint;
|
|
6
|
+
private selecting;
|
|
7
|
+
private contextBarElement;
|
|
8
|
+
private selectionType;
|
|
9
|
+
constructor();
|
|
10
|
+
create(): void;
|
|
11
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
12
|
+
clearSelection(): void;
|
|
13
|
+
private clearHtmlDocumentSelection;
|
|
14
|
+
private startSelection;
|
|
15
|
+
private endSelection;
|
|
16
|
+
private selectionCreated;
|
|
17
|
+
private createAnnotation;
|
|
18
|
+
private copyTextSelection;
|
|
19
|
+
}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { ViewLayerBase } from './ViewLayerBase';
|
|
2
|
+
import { PdfItemType, } from '../../pdf-viewer-api';
|
|
3
|
+
import { createTextSelectionContextBar } from './views/TextSelectionContextBar';
|
|
4
|
+
import { Color } from '../../common/Color';
|
|
5
|
+
import { ViewerMode, CursorStyle, copyTextToClipboard } from '../state/viewer';
|
|
6
|
+
import { addHistoryEntry } from '../../custom/history';
|
|
7
|
+
/** internal */
|
|
8
|
+
export class TextSelectionLayer extends ViewLayerBase {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.startPoint = null;
|
|
12
|
+
this.selecting = false;
|
|
13
|
+
this.contextBarElement = null;
|
|
14
|
+
this.selectionType = null;
|
|
15
|
+
this.createAnnotation = this.createAnnotation.bind(this);
|
|
16
|
+
this.copyTextSelection = this.copyTextSelection.bind(this);
|
|
17
|
+
}
|
|
18
|
+
create() { }
|
|
19
|
+
render(timestamp, state) {
|
|
20
|
+
var _a;
|
|
21
|
+
if (state.viewer.mode !== ViewerMode.TEXT_SELECTED) {
|
|
22
|
+
if (this.contextBarElement) {
|
|
23
|
+
this.removeHtmlElements();
|
|
24
|
+
this.contextBarElement = null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (state.viewer.mode === ViewerMode.MODULE_SELECTED) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let updateContextBarPos = true;
|
|
31
|
+
if (state.pointer.action === 'click') {
|
|
32
|
+
this.endSelection();
|
|
33
|
+
// dbl click word selection
|
|
34
|
+
}
|
|
35
|
+
else if (state.pointer.action === 'dblclick') {
|
|
36
|
+
const clickPos = this.pdfViewerApi.transformScreenPointToPdfPoint({
|
|
37
|
+
x: state.pointer.x.devicePixels,
|
|
38
|
+
y: state.pointer.y.devicePixels,
|
|
39
|
+
});
|
|
40
|
+
const wordSelection = this.pdfViewerApi.getWordOnPoint(clickPos.pdfPoint);
|
|
41
|
+
this.store.viewer.setTextSelection({ selection: wordSelection, type: 'normal' });
|
|
42
|
+
this.selectionCreated();
|
|
43
|
+
}
|
|
44
|
+
// start new selection
|
|
45
|
+
else if (state.viewer.mode === ViewerMode.DEFAULT &&
|
|
46
|
+
!this.selecting &&
|
|
47
|
+
((state.pointer.type === 'mouse' && state.pointer.action === 'startdrag') ||
|
|
48
|
+
state.pointer.action === 'longpress')) {
|
|
49
|
+
const screenPos = {
|
|
50
|
+
x: state.startPointer.x.devicePixels,
|
|
51
|
+
y: state.startPointer.y.devicePixels,
|
|
52
|
+
};
|
|
53
|
+
const startPos = this.pdfViewerApi.transformScreenPointToPdfPoint(screenPos);
|
|
54
|
+
const textOnPoint = this.pdfViewerApi.getTextFragmentOnPoint(screenPos);
|
|
55
|
+
if (this.options.viewer.general.rectangularTextSelection === 'automatic') {
|
|
56
|
+
this.selectionType = textOnPoint ? 'normal' : 'rectangular';
|
|
57
|
+
this.startSelection(startPos.pdfPoint);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (textOnPoint) {
|
|
61
|
+
this.startSelection(startPos.pdfPoint);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else if (this.selecting) {
|
|
66
|
+
if (state.pointer.isDown) {
|
|
67
|
+
if (state.pointer.positionChanged) {
|
|
68
|
+
const mousePos = this.pdfViewerApi.getClosestPointOnPdfByScreenPoint({
|
|
69
|
+
x: state.pointer.x.devicePixels,
|
|
70
|
+
y: state.pointer.y.devicePixels,
|
|
71
|
+
});
|
|
72
|
+
if (this.startPoint) {
|
|
73
|
+
const textSelection = this.selectionType === 'rectangular'
|
|
74
|
+
? this.pdfViewerApi.getRectangularTextSelection(this.startPoint, mousePos)
|
|
75
|
+
: this.pdfViewerApi.getTextSelection(this.startPoint, mousePos);
|
|
76
|
+
this.store.viewer.setTextSelection({
|
|
77
|
+
selection: textSelection,
|
|
78
|
+
type: this.selectionType,
|
|
79
|
+
});
|
|
80
|
+
this.store.viewer.setTextSelectionState('selecting');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
if ((_a = state.viewer.textSelection) === null || _a === void 0 ? void 0 : _a.quadrilaterals.length) {
|
|
86
|
+
this.selectionCreated();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.endSelection();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// auto scroll
|
|
94
|
+
if (this.selecting && state.pointer.y.devicePixels > -1) {
|
|
95
|
+
const padding = 30;
|
|
96
|
+
const dxScroll = 20;
|
|
97
|
+
if (state.pointer.y.devicePixels > state.canvas.height.devicePixels - padding) {
|
|
98
|
+
this.pdfViewerApi.setScrollPosition({
|
|
99
|
+
x: state.scroll.left.devicePixels,
|
|
100
|
+
y: state.scroll.top.devicePixels + dxScroll,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
else if (state.pointer.y.devicePixels < padding) {
|
|
104
|
+
this.pdfViewerApi.setScrollPosition({
|
|
105
|
+
x: state.scroll.left.devicePixels,
|
|
106
|
+
y: state.scroll.top.devicePixels - dxScroll,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
else if (state.pointer.x.devicePixels > state.canvas.width.devicePixels - padding) {
|
|
110
|
+
this.pdfViewerApi.setScrollPosition({
|
|
111
|
+
x: state.scroll.left.devicePixels + dxScroll,
|
|
112
|
+
y: state.scroll.top.devicePixels,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
else if (state.pointer.x.devicePixels < padding) {
|
|
116
|
+
this.pdfViewerApi.setScrollPosition({
|
|
117
|
+
x: state.scroll.left.devicePixels - dxScroll,
|
|
118
|
+
y: state.scroll.top.devicePixels,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// update contextbar position
|
|
123
|
+
if (updateContextBarPos && this.contextBarElement && state.viewer.textSelectionRects) {
|
|
124
|
+
const padding = 25;
|
|
125
|
+
let barTopPos = padding;
|
|
126
|
+
let barLeftPos = 0;
|
|
127
|
+
let isTopPos = false;
|
|
128
|
+
let isBottomPos = false;
|
|
129
|
+
let screenRect = null;
|
|
130
|
+
const { firstVisiblePage, lastVisiblePage } = state.document;
|
|
131
|
+
Object.keys(state.viewer.textSelectionRects).forEach((page) => {
|
|
132
|
+
const pageNumber = parseInt(page);
|
|
133
|
+
if (pageNumber >= firstVisiblePage && pageNumber <= lastVisiblePage) {
|
|
134
|
+
if (state.viewer.textSelectionRects) {
|
|
135
|
+
const pageScreenRect = this.pdfViewerApi.transformPdfPageRectToScreenRect(state.viewer.textSelectionRects[page]);
|
|
136
|
+
if (pageScreenRect) {
|
|
137
|
+
screenRect = {
|
|
138
|
+
x1: pageScreenRect.x / devicePixelRatio,
|
|
139
|
+
y1: pageScreenRect.y / devicePixelRatio,
|
|
140
|
+
x2: pageScreenRect.x / devicePixelRatio + pageScreenRect.w / devicePixelRatio,
|
|
141
|
+
y2: pageScreenRect.y / devicePixelRatio + pageScreenRect.h / devicePixelRatio,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
if (screenRect) {
|
|
148
|
+
const { x1, y1, x2, y2 } = screenRect;
|
|
149
|
+
if (y1 > 90) {
|
|
150
|
+
barTopPos = y1 - 65;
|
|
151
|
+
isTopPos = true;
|
|
152
|
+
}
|
|
153
|
+
else if (state.canvas.height.cssPixels / 2 > y2) {
|
|
154
|
+
barTopPos = y2 + 15;
|
|
155
|
+
isBottomPos = true;
|
|
156
|
+
}
|
|
157
|
+
const barWidth = this.contextBarElement.clientWidth;
|
|
158
|
+
barLeftPos = x1 + (x2 - x1 - barWidth) / 2;
|
|
159
|
+
if (barLeftPos < 0) {
|
|
160
|
+
barLeftPos = 0;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
barTopPos = -90;
|
|
165
|
+
}
|
|
166
|
+
this.contextBarElement.style.top = barTopPos + 'px';
|
|
167
|
+
this.contextBarElement.style.left = barLeftPos + 'px';
|
|
168
|
+
if (isTopPos) {
|
|
169
|
+
this.contextBarElement.classList.add('pwv-contextbar-top');
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
this.contextBarElement.classList.remove('pwv-contextbar-top');
|
|
173
|
+
}
|
|
174
|
+
if (isBottomPos) {
|
|
175
|
+
this.contextBarElement.classList.add('pwv-contextbar-bottom');
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
this.contextBarElement.classList.remove('pwv-contextbar-bottom');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
clearSelection() {
|
|
183
|
+
this.endSelection();
|
|
184
|
+
}
|
|
185
|
+
clearHtmlDocumentSelection() {
|
|
186
|
+
const documentSelection = document.getSelection();
|
|
187
|
+
if (documentSelection) {
|
|
188
|
+
documentSelection.empty();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
startSelection(startPoint) {
|
|
192
|
+
this.clearHtmlDocumentSelection();
|
|
193
|
+
this.removeHtmlElements();
|
|
194
|
+
this.contextBarElement = null;
|
|
195
|
+
this.selecting = true;
|
|
196
|
+
if (this.startPoint === null) {
|
|
197
|
+
this.startPoint = startPoint;
|
|
198
|
+
}
|
|
199
|
+
this.store.viewer.setCursorStyle(CursorStyle.TEXT);
|
|
200
|
+
}
|
|
201
|
+
endSelection() {
|
|
202
|
+
this.removeHtmlElements();
|
|
203
|
+
this.contextBarElement = null;
|
|
204
|
+
this.selecting = false;
|
|
205
|
+
this.startPoint = null;
|
|
206
|
+
this.clearHtmlDocumentSelection();
|
|
207
|
+
window.setTimeout(() => {
|
|
208
|
+
this.selectionType = null;
|
|
209
|
+
this.store.viewer.setTextSelection({ selection: null, type: null });
|
|
210
|
+
this.store.viewer.setTextSelectionState(null);
|
|
211
|
+
}, 50);
|
|
212
|
+
}
|
|
213
|
+
selectionCreated() {
|
|
214
|
+
var _a;
|
|
215
|
+
this.selecting = false;
|
|
216
|
+
if (this.contextBarElement) {
|
|
217
|
+
this.removeHtmlElements();
|
|
218
|
+
}
|
|
219
|
+
this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
|
|
220
|
+
this.store.viewer.setTextSelectionState('textSelected');
|
|
221
|
+
const isViewOnly = !((_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.licenseFeatures.annotate);
|
|
222
|
+
const allowCopyText = this.options.viewer.permissions.allowCopyText;
|
|
223
|
+
if (isViewOnly && !allowCopyText) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
this.contextBarElement = this.createHtmlLayer();
|
|
227
|
+
this.contextBarElement.classList.add('pwv-textselection-contextbar');
|
|
228
|
+
this.contextBarElement.classList.add('pwv-contextbar-top');
|
|
229
|
+
createTextSelectionContextBar({
|
|
230
|
+
highlightColors: this.options.annotation.colors.highlightColors,
|
|
231
|
+
onCreateAnnotation: this.createAnnotation,
|
|
232
|
+
onCopyText: this.copyTextSelection,
|
|
233
|
+
isViewOnly,
|
|
234
|
+
allowCopyText,
|
|
235
|
+
}, this.contextBarElement);
|
|
236
|
+
this.viewerCanvas.onTextSelected();
|
|
237
|
+
}
|
|
238
|
+
createAnnotation(itemType, color) {
|
|
239
|
+
if (this.pdfViewerApi && this.store) {
|
|
240
|
+
const selection = this.store.getState().viewer.textSelection;
|
|
241
|
+
if (selection) {
|
|
242
|
+
const selectionByPage = [];
|
|
243
|
+
for (let i = 0; i < selection.quadrilaterals.length; i++) {
|
|
244
|
+
const quadrilateral = selection.quadrilaterals[i];
|
|
245
|
+
if (!selectionByPage[quadrilateral.pageNumber]) {
|
|
246
|
+
selectionByPage[quadrilateral.pageNumber] = [];
|
|
247
|
+
}
|
|
248
|
+
selectionByPage[quadrilateral.pageNumber].push(quadrilateral);
|
|
249
|
+
}
|
|
250
|
+
if (itemType === PdfItemType.HIGHLIGHT) {
|
|
251
|
+
const colorObj = new Color(color);
|
|
252
|
+
colorObj.setOpacity(this.options.annotation.highlightOpacity);
|
|
253
|
+
color = colorObj.toRgba();
|
|
254
|
+
}
|
|
255
|
+
for (let i = 0; i < selectionByPage.length; i++) {
|
|
256
|
+
if (selectionByPage[i]) {
|
|
257
|
+
const quadrilaterals = selectionByPage[i];
|
|
258
|
+
const args = {
|
|
259
|
+
itemType,
|
|
260
|
+
page: i,
|
|
261
|
+
pdfRect: {
|
|
262
|
+
pdfX: 0,
|
|
263
|
+
pdfY: 0,
|
|
264
|
+
pdfW: 0,
|
|
265
|
+
pdfH: 0,
|
|
266
|
+
page: i,
|
|
267
|
+
},
|
|
268
|
+
color,
|
|
269
|
+
author: this.options.viewer.general.user,
|
|
270
|
+
quadrilaterals,
|
|
271
|
+
};
|
|
272
|
+
this.pdfViewerApi.createItem(args).then((annotation) => {
|
|
273
|
+
if (this.options.annotation.trackHistory) {
|
|
274
|
+
addHistoryEntry(annotation, 'create', this.options.viewer.general.user);
|
|
275
|
+
this.pdfViewerApi.updateItem(annotation);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
this.endSelection();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
copyTextSelection() {
|
|
285
|
+
var _a;
|
|
286
|
+
const selectedText = (_a = this.viewerCanvas) === null || _a === void 0 ? void 0 : _a.getSelectedText();
|
|
287
|
+
copyTextToClipboard(selectedText || '');
|
|
288
|
+
}
|
|
289
|
+
}
|