@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,210 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { PdfItemType, AnnotationBorderStyle, } from '../../pdf-viewer-api';
|
|
3
|
+
import { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';
|
|
4
|
+
import { getRectFromSelection } from '../../pdf-viewer-canvas/state/document';
|
|
5
|
+
import { createAddShapeAnnotationToolbar, } from './AddShapeAnnotationToolbar';
|
|
6
|
+
import { Color } from '../../common/Color';
|
|
7
|
+
const moduleLayerName = 'AddShapeAnnotation';
|
|
8
|
+
export class AddShapeAnnotationLayer extends CanvasLayer {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.context = null;
|
|
12
|
+
this.toolbar = null;
|
|
13
|
+
this.page = 0;
|
|
14
|
+
this.pointerDown = false;
|
|
15
|
+
this.startPoint = null;
|
|
16
|
+
this.itemType = null;
|
|
17
|
+
this.strokeColors = [];
|
|
18
|
+
this.fillColors = [];
|
|
19
|
+
}
|
|
20
|
+
onCreate(itemType) {
|
|
21
|
+
this.setStrokeColor = this.setStrokeColor.bind(this);
|
|
22
|
+
this.setStrokeWidth = this.setStrokeWidth.bind(this);
|
|
23
|
+
this.setStrokeStyle = this.setStrokeStyle.bind(this);
|
|
24
|
+
this.setFillColor = this.setFillColor.bind(this);
|
|
25
|
+
this.setShape = this.setShape.bind(this);
|
|
26
|
+
this.cancel = this.cancel.bind(this);
|
|
27
|
+
this.context = this.createCanvas();
|
|
28
|
+
this.itemType = itemType;
|
|
29
|
+
const annotationOptions = this.options.annotation;
|
|
30
|
+
this.strokeColors = annotationOptions.colors.foregroundColors;
|
|
31
|
+
this.fillColors = annotationOptions.colors.backgroundColors;
|
|
32
|
+
this.store.viewer.beginModule(moduleLayerName);
|
|
33
|
+
/* tslint:disable-next-line:align */
|
|
34
|
+
const toolbarElement = this.module.toolbarElement;
|
|
35
|
+
this.toolbar = createAddShapeAnnotationToolbar({
|
|
36
|
+
strokeColors: this.strokeColors,
|
|
37
|
+
strokeWidths: annotationOptions.strokeWidths,
|
|
38
|
+
fillColors: this.fillColors,
|
|
39
|
+
selectedStrokeColor: annotationOptions.colors.shapeColor,
|
|
40
|
+
selectedStrokeWidth: annotationOptions.shapeStrokeWidth,
|
|
41
|
+
selectedStrokeStyle: annotationOptions.shapeStrokeStyle,
|
|
42
|
+
selectedFillColor: annotationOptions.colors.shapeFillColor,
|
|
43
|
+
selectedShape: this.itemType,
|
|
44
|
+
onStrokeColorChanged: this.setStrokeColor,
|
|
45
|
+
onStrokeWidthChanged: this.setStrokeWidth,
|
|
46
|
+
onStrokeStyleChanged: this.setStrokeStyle,
|
|
47
|
+
onFillColorChanged: this.setFillColor,
|
|
48
|
+
onShapeChanged: this.setShape,
|
|
49
|
+
onCancel: this.cancel,
|
|
50
|
+
}, toolbarElement);
|
|
51
|
+
}
|
|
52
|
+
cancel() {
|
|
53
|
+
this.remove();
|
|
54
|
+
}
|
|
55
|
+
onSave() {
|
|
56
|
+
const promise = new Promise((resolve, reject) => {
|
|
57
|
+
resolve();
|
|
58
|
+
});
|
|
59
|
+
return promise;
|
|
60
|
+
}
|
|
61
|
+
onRemove() {
|
|
62
|
+
this.removeCanvasElements();
|
|
63
|
+
this.context = null;
|
|
64
|
+
/* tslint:disable-next-line:align */
|
|
65
|
+
const toolbarElement = this.module.toolbarElement;
|
|
66
|
+
toolbarElement.innerHTML = '';
|
|
67
|
+
this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
|
|
68
|
+
this.store.viewer.endModule(moduleLayerName);
|
|
69
|
+
}
|
|
70
|
+
render(timestamp, state) {
|
|
71
|
+
if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {
|
|
72
|
+
this.remove();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (this.context) {
|
|
76
|
+
const update = state.viewer.modeChanged ||
|
|
77
|
+
state.pointer.positionChanged ||
|
|
78
|
+
state.pointer.action ||
|
|
79
|
+
state.document.zoomChanged;
|
|
80
|
+
if (update) {
|
|
81
|
+
const ctx = this.context;
|
|
82
|
+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
83
|
+
const pointerPos = {
|
|
84
|
+
x: state.pointer.x.devicePixels,
|
|
85
|
+
y: state.pointer.y.devicePixels,
|
|
86
|
+
};
|
|
87
|
+
const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);
|
|
88
|
+
if (pointerPdfPos.isOnPage) {
|
|
89
|
+
this.store.viewer.setCursorStyle(CursorStyle.CROSSHAIR);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);
|
|
93
|
+
}
|
|
94
|
+
if (state.pointer.isDown) {
|
|
95
|
+
if (!this.pointerDown) {
|
|
96
|
+
this.startPoint = pointerPos;
|
|
97
|
+
this.pointerDown = true;
|
|
98
|
+
if (this.page === 0 && pointerPdfPos.isOnPage) {
|
|
99
|
+
this.page = pointerPdfPos.pdfPoint.page;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (this.startPoint) {
|
|
103
|
+
const rect = getRectFromSelection(state.document, {
|
|
104
|
+
x: this.startPoint.x,
|
|
105
|
+
y: this.startPoint.y,
|
|
106
|
+
}, {
|
|
107
|
+
x: pointerPos.x,
|
|
108
|
+
y: pointerPos.y,
|
|
109
|
+
}, this.page);
|
|
110
|
+
const annotationOptions = this.options.annotation;
|
|
111
|
+
if (rect) {
|
|
112
|
+
ctx.save();
|
|
113
|
+
const strokeColor = new Color(annotationOptions.colors.shapeColor);
|
|
114
|
+
ctx.strokeStyle = strokeColor.toRgb();
|
|
115
|
+
const fillColor = new Color(annotationOptions.colors.shapeFillColor);
|
|
116
|
+
ctx.fillStyle = fillColor.toRgb();
|
|
117
|
+
const lineWidth = annotationOptions.shapeStrokeWidth * devicePixelRatio * state.document.zoom;
|
|
118
|
+
ctx.lineWidth = lineWidth;
|
|
119
|
+
if (lineWidth) {
|
|
120
|
+
ctx.globalAlpha = strokeColor.a;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
ctx.globalAlpha = fillColor.a;
|
|
124
|
+
}
|
|
125
|
+
if (this.options.annotation.shapeStrokeStyle === AnnotationBorderStyle.DASHED) {
|
|
126
|
+
ctx.setLineDash([ctx.lineWidth]);
|
|
127
|
+
}
|
|
128
|
+
if (this.itemType === PdfItemType.CIRCLE) {
|
|
129
|
+
const cX = rect.x + rect.w / 2;
|
|
130
|
+
const cY = rect.y + rect.h / 2;
|
|
131
|
+
ctx.beginPath();
|
|
132
|
+
ctx.ellipse(cX, cY, Math.max(rect.w / 2 - ctx.lineWidth / 2, 0), Math.max(rect.h / 2 - ctx.lineWidth / 2, 0), 0, 0, Math.PI * 2);
|
|
133
|
+
if (fillColor.a) {
|
|
134
|
+
ctx.fill();
|
|
135
|
+
}
|
|
136
|
+
if (annotationOptions.shapeStrokeWidth) {
|
|
137
|
+
ctx.stroke();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
if (fillColor.a) {
|
|
142
|
+
ctx.fillRect(rect.x, rect.y, rect.w, rect.h);
|
|
143
|
+
}
|
|
144
|
+
if (annotationOptions.shapeStrokeWidth) {
|
|
145
|
+
ctx.strokeRect(rect.x + ctx.lineWidth / 2, rect.y + ctx.lineWidth / 2, rect.w - ctx.lineWidth, rect.h - ctx.lineWidth);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
ctx.restore();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else if (this.pointerDown && this.startPoint) {
|
|
153
|
+
const rect = getRectFromSelection(state.document, {
|
|
154
|
+
x: this.startPoint.x,
|
|
155
|
+
y: this.startPoint.y,
|
|
156
|
+
}, {
|
|
157
|
+
x: pointerPos.x,
|
|
158
|
+
y: pointerPos.y,
|
|
159
|
+
}, this.page);
|
|
160
|
+
if (rect) {
|
|
161
|
+
this.pointerDown = false;
|
|
162
|
+
this.startPoint = null;
|
|
163
|
+
this.createRectangleAnnotation(rect);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
setStrokeColor(color) {
|
|
170
|
+
this.options.annotation.colors.shapeColor = color;
|
|
171
|
+
}
|
|
172
|
+
setShape(shape) {
|
|
173
|
+
this.itemType = shape;
|
|
174
|
+
}
|
|
175
|
+
setStrokeWidth(width) {
|
|
176
|
+
this.options.annotation.shapeStrokeWidth = width;
|
|
177
|
+
}
|
|
178
|
+
setStrokeStyle(style) {
|
|
179
|
+
this.options.annotation.shapeStrokeStyle = style;
|
|
180
|
+
}
|
|
181
|
+
setFillColor(color) {
|
|
182
|
+
this.options.annotation.colors.shapeFillColor = color;
|
|
183
|
+
}
|
|
184
|
+
createRectangleAnnotation(rect) {
|
|
185
|
+
const pdfRect = this.pdfApi.transformScreenRectToPdfRect(rect, this.page);
|
|
186
|
+
const annotationOptions = this.options.annotation;
|
|
187
|
+
const annotation = {
|
|
188
|
+
itemType: this.itemType,
|
|
189
|
+
color: annotationOptions.colors.shapeColor,
|
|
190
|
+
pdfRect,
|
|
191
|
+
page: this.page,
|
|
192
|
+
author: this.options.viewer.general.user,
|
|
193
|
+
fillColor: annotationOptions.colors.shapeFillColor === 'transparent'
|
|
194
|
+
? null
|
|
195
|
+
: annotationOptions.colors.shapeFillColor,
|
|
196
|
+
border: {
|
|
197
|
+
width: annotationOptions.shapeStrokeWidth,
|
|
198
|
+
style: this.options.annotation.shapeStrokeStyle,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
this.pdfApi
|
|
202
|
+
.createItem(annotation)
|
|
203
|
+
.then(() => {
|
|
204
|
+
this.remove();
|
|
205
|
+
})
|
|
206
|
+
.catch((err) => {
|
|
207
|
+
console.error(err);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AnnotationBorderStyle, PdfItemType } from '../../pdf-viewer-api';
|
|
2
|
+
export interface AddShapeAnnotationToolbarProps {
|
|
3
|
+
strokeColors: string[];
|
|
4
|
+
strokeWidths: number[];
|
|
5
|
+
fillColors: string[];
|
|
6
|
+
selectedShape: PdfItemType;
|
|
7
|
+
selectedStrokeColor: string;
|
|
8
|
+
selectedStrokeWidth: number;
|
|
9
|
+
selectedStrokeStyle: AnnotationBorderStyle;
|
|
10
|
+
selectedFillColor: string;
|
|
11
|
+
onShapeChanged(shape: PdfItemType): void;
|
|
12
|
+
onStrokeColorChanged(color: string): void;
|
|
13
|
+
onStrokeWidthChanged(width: number): void;
|
|
14
|
+
onStrokeStyleChanged(style: AnnotationBorderStyle): void;
|
|
15
|
+
onFillColorChanged(color: string): void;
|
|
16
|
+
onCancel(): void;
|
|
17
|
+
}
|
|
18
|
+
export interface AddShapeAnnotationToolbarActions {
|
|
19
|
+
setStrokeColor(color: string): void;
|
|
20
|
+
setStrokeWidth(width: number): void;
|
|
21
|
+
setStrokeStyle(style: AnnotationBorderStyle): void;
|
|
22
|
+
setFillColor(width: string): void;
|
|
23
|
+
setShape(shape: PdfItemType): void;
|
|
24
|
+
setCancel(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare const createAddShapeAnnotationToolbar: (props: AddShapeAnnotationToolbarProps, element: HTMLElement) => AddShapeAnnotationToolbarActions;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { app, h } from '../../lib/hyperapp';
|
|
2
|
+
import { PdfItemType } from '../../pdf-viewer-api';
|
|
3
|
+
import { translationManager } from '../../common/TranslationManager';
|
|
4
|
+
import { Toolbar } from '../../common/Toolbar';
|
|
5
|
+
import { ToolbarItemGroup } from '../../common/ToolbarItemGroup';
|
|
6
|
+
import { ToolbarButton } from '../../common/ToolbarButton';
|
|
7
|
+
import { icons } from '../../common/icons';
|
|
8
|
+
import { ToolbarSeparator } from '../../common/ToolbarSeparator';
|
|
9
|
+
import { StrokeWidthPicker } from '../../common/StrokeWidthPicker';
|
|
10
|
+
import { StrokeStylePicker } from '../../common/StrokeStylePicker';
|
|
11
|
+
import { ColorPicker } from '../../common/ColorPicker';
|
|
12
|
+
export const createAddShapeAnnotationToolbar = (props, element) => {
|
|
13
|
+
const state = {
|
|
14
|
+
strokeColors: props.strokeColors,
|
|
15
|
+
strokeWidths: props.strokeWidths,
|
|
16
|
+
fillColors: props.fillColors,
|
|
17
|
+
selectedShape: props.selectedShape,
|
|
18
|
+
selectedStrokeColor: props.selectedStrokeColor,
|
|
19
|
+
selectedStrokeWidth: props.selectedStrokeWidth,
|
|
20
|
+
selectedStrokeStyle: props.selectedStrokeStyle,
|
|
21
|
+
selectedFillColor: props.selectedFillColor,
|
|
22
|
+
};
|
|
23
|
+
const actions = {
|
|
24
|
+
setShape: (shape) => ($state) => {
|
|
25
|
+
props.onShapeChanged(shape);
|
|
26
|
+
return Object.assign(Object.assign({}, $state), { selectedShape: shape });
|
|
27
|
+
},
|
|
28
|
+
setStrokeColor: (color) => ($state) => {
|
|
29
|
+
props.onStrokeColorChanged(color);
|
|
30
|
+
return Object.assign(Object.assign({}, $state), { selectedStrokeColor: color });
|
|
31
|
+
},
|
|
32
|
+
setStrokeWidth: (width) => ($state) => {
|
|
33
|
+
props.onStrokeWidthChanged(width);
|
|
34
|
+
return Object.assign(Object.assign({}, $state), { selectedStrokeWidth: width });
|
|
35
|
+
},
|
|
36
|
+
setStrokeStyle: (style) => ($state) => {
|
|
37
|
+
props.onStrokeStyleChanged(style);
|
|
38
|
+
return Object.assign(Object.assign({}, $state), { selectedStrokeStyle: style });
|
|
39
|
+
},
|
|
40
|
+
setFillColor: (color) => ($state) => {
|
|
41
|
+
props.onFillColorChanged(color);
|
|
42
|
+
return Object.assign(Object.assign({}, $state), { selectedFillColor: color });
|
|
43
|
+
},
|
|
44
|
+
setCancel: () => ($state) => {
|
|
45
|
+
return Object.assign({}, $state);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const App = () => h(AddShapeAnnotationToolbar, null);
|
|
49
|
+
const AddShapeAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },
|
|
50
|
+
h(ToolbarItemGroup, null,
|
|
51
|
+
h(ToolbarButton, { tooltip: translationManager.getText('annotShape.addRectangle'), icon: icons.rectangle, active: $state.selectedShape === PdfItemType.SQUARE, onClick: () => {
|
|
52
|
+
$actions.setShape(PdfItemType.SQUARE);
|
|
53
|
+
} }),
|
|
54
|
+
h(ToolbarButton, { tooltip: translationManager.getText('annotShape.addEllipse'), icon: icons.circle, active: $state.selectedShape === PdfItemType.CIRCLE, onClick: () => {
|
|
55
|
+
$actions.setShape(PdfItemType.CIRCLE);
|
|
56
|
+
} }),
|
|
57
|
+
h(ToolbarSeparator, null)),
|
|
58
|
+
h(ToolbarItemGroup, null,
|
|
59
|
+
h(StrokeWidthPicker, { tooltip: translationManager.getText('annotShape.strokeWidth'), noneStrokeText: translationManager.getText('border.none'), strokeWidths: $state.strokeWidths, value: $state.selectedStrokeWidth, onChange: $actions.setStrokeWidth }),
|
|
60
|
+
h(StrokeStylePicker, { tooltip: translationManager.getText('annotShape.strokeStyle'), value: $state.selectedStrokeStyle, disabled: $state.selectedStrokeWidth === 0, onChange: $actions.setStrokeStyle, shapeType: $state.selectedShape === PdfItemType.CIRCLE ? 'circle' : 'rectangle' }),
|
|
61
|
+
h(ColorPicker, { tooltip: translationManager.getText('annotShape.strokeColor'), colors: $state.strokeColors, color: $state.selectedStrokeColor, disabled: $state.selectedStrokeWidth === 0, icon: icons.pencil, onChange: $actions.setStrokeColor })),
|
|
62
|
+
h(ToolbarItemGroup, null,
|
|
63
|
+
h(ToolbarSeparator, null),
|
|
64
|
+
h(ColorPicker, { tooltip: translationManager.getText('annotShape.bgColor'), colors: $state.fillColors, color: $state.selectedFillColor, icon: icons.fillColor, onChange: $actions.setFillColor })),
|
|
65
|
+
h(ToolbarItemGroup, { pushRight: true },
|
|
66
|
+
h(ToolbarSeparator, null),
|
|
67
|
+
h(ToolbarButton, { icon: icons.close, onClick: props.onCancel }))));
|
|
68
|
+
return app(state, actions, App, element);
|
|
69
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { ViewerCanvasState } from '../../pdf-viewer-canvas/state/store';
|
|
3
|
+
export declare class EditShapeAnnotationLayer extends CanvasLayer {
|
|
4
|
+
private shapeAnnotation;
|
|
5
|
+
private context;
|
|
6
|
+
private toolbar;
|
|
7
|
+
private strokeColors;
|
|
8
|
+
private fillColors;
|
|
9
|
+
onCreate(annotationId: number): void;
|
|
10
|
+
close(): void;
|
|
11
|
+
onSave(): Promise<void>;
|
|
12
|
+
onRemove(): void;
|
|
13
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
14
|
+
private setStrokeColor;
|
|
15
|
+
private setStrokeWidth;
|
|
16
|
+
private setStrokeStyle;
|
|
17
|
+
private setFillColor;
|
|
18
|
+
private updateShapeAnnotation;
|
|
19
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';
|
|
3
|
+
import { createEditShapeAnnotationToolbar, } from './EditShapeAnnotationToolbar';
|
|
4
|
+
import { Color } from '../../common/Color';
|
|
5
|
+
const moduleLayerName = 'EditShapeAnnotation';
|
|
6
|
+
export class EditShapeAnnotationLayer extends CanvasLayer {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.shapeAnnotation = null;
|
|
10
|
+
this.context = null;
|
|
11
|
+
this.toolbar = null;
|
|
12
|
+
this.strokeColors = [];
|
|
13
|
+
this.fillColors = [];
|
|
14
|
+
}
|
|
15
|
+
onCreate(annotationId) {
|
|
16
|
+
this.shapeAnnotation = this.pdfApi.getItem(annotationId);
|
|
17
|
+
this.setStrokeColor = this.setStrokeColor.bind(this);
|
|
18
|
+
this.setStrokeWidth = this.setStrokeWidth.bind(this);
|
|
19
|
+
this.setStrokeStyle = this.setStrokeStyle.bind(this);
|
|
20
|
+
this.setFillColor = this.setFillColor.bind(this);
|
|
21
|
+
this.close = this.close.bind(this);
|
|
22
|
+
const annotOptions = this.options.annotation;
|
|
23
|
+
this.strokeColors = annotOptions.colors.foregroundColors;
|
|
24
|
+
this.fillColors = annotOptions.colors.backgroundColors;
|
|
25
|
+
this.context = this.createCanvas();
|
|
26
|
+
/* tslint:disable-next-line:align */
|
|
27
|
+
const toolbarElement = this.module.toolbarElement;
|
|
28
|
+
this.toolbar = createEditShapeAnnotationToolbar({
|
|
29
|
+
strokeColors: this.strokeColors,
|
|
30
|
+
strokeWidths: annotOptions.strokeWidths,
|
|
31
|
+
fillColors: this.fillColors,
|
|
32
|
+
selectedStrokeColor: this.shapeAnnotation.color
|
|
33
|
+
? this.shapeAnnotation.color
|
|
34
|
+
: annotOptions.colors.shapeColor,
|
|
35
|
+
selectedStrokeWidth: this.shapeAnnotation.border.width,
|
|
36
|
+
selectedStrokeStyle: this.shapeAnnotation.border.style,
|
|
37
|
+
selectedFillColor: this.shapeAnnotation.fillColor
|
|
38
|
+
? this.shapeAnnotation.fillColor
|
|
39
|
+
: annotOptions.colors.shapeFillColor,
|
|
40
|
+
itemType: this.shapeAnnotation.itemType,
|
|
41
|
+
onStrokeColorChanged: this.setStrokeColor,
|
|
42
|
+
onStrokeWidthChanged: this.setStrokeWidth,
|
|
43
|
+
onStrokeStyleChanged: this.setStrokeStyle,
|
|
44
|
+
onFillColorChanged: this.setFillColor,
|
|
45
|
+
onCancel: this.close,
|
|
46
|
+
}, toolbarElement);
|
|
47
|
+
this.store.viewer.beginModule(moduleLayerName);
|
|
48
|
+
}
|
|
49
|
+
close() {
|
|
50
|
+
this.remove();
|
|
51
|
+
}
|
|
52
|
+
onSave() {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
resolve();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
onRemove() {
|
|
58
|
+
this.removeCanvasElements();
|
|
59
|
+
this.context = null;
|
|
60
|
+
/* tslint:disable-next-line:align */
|
|
61
|
+
const toolbarElement = this.module.toolbarElement;
|
|
62
|
+
toolbarElement.innerHTML = '';
|
|
63
|
+
this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
|
|
64
|
+
this.store.viewer.endModule(moduleLayerName);
|
|
65
|
+
}
|
|
66
|
+
render(timestamp, state) {
|
|
67
|
+
var _a;
|
|
68
|
+
if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {
|
|
69
|
+
this.remove();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (state.pointer.action === 'click' || state.pointer.action === 'dblclick') {
|
|
73
|
+
const shapeAnnotation = (_a = this.pdfApi
|
|
74
|
+
.getAnnotationsOnPoint({
|
|
75
|
+
x: state.pointer.x.devicePixels,
|
|
76
|
+
y: state.pointer.y.devicePixels,
|
|
77
|
+
})) === null || _a === void 0 ? void 0 : _a.find((a) => this.shapeAnnotation && a.id === this.shapeAnnotation.id);
|
|
78
|
+
if (!shapeAnnotation) {
|
|
79
|
+
this.close();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (this.context && this.shapeAnnotation) {
|
|
84
|
+
const ctx = this.context;
|
|
85
|
+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
86
|
+
const rect = this.pdfApi.transformPdfPageRectToScreenRect(this.shapeAnnotation.pdfRect);
|
|
87
|
+
const lineWidth = 2 * devicePixelRatio;
|
|
88
|
+
ctx.save();
|
|
89
|
+
ctx.strokeStyle = this.options.viewer.general.textSelectionColor;
|
|
90
|
+
ctx.lineWidth = lineWidth;
|
|
91
|
+
ctx.setLineDash([lineWidth, lineWidth]);
|
|
92
|
+
ctx.strokeRect(rect.x - lineWidth, rect.y - lineWidth, rect.w + 2 * lineWidth, rect.h + 2 * lineWidth);
|
|
93
|
+
ctx.restore();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
setStrokeColor(color) {
|
|
97
|
+
if (this.shapeAnnotation && this.shapeAnnotation.color) {
|
|
98
|
+
const newColor = new Color(color);
|
|
99
|
+
const currentColor = new Color(this.shapeAnnotation.color);
|
|
100
|
+
newColor.setOpacity(currentColor.a);
|
|
101
|
+
this.shapeAnnotation.color = newColor.toRgba();
|
|
102
|
+
this.updateShapeAnnotation();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
setStrokeWidth(width) {
|
|
106
|
+
if (this.shapeAnnotation) {
|
|
107
|
+
this.shapeAnnotation.border = {
|
|
108
|
+
style: this.shapeAnnotation.border.style,
|
|
109
|
+
width: width,
|
|
110
|
+
};
|
|
111
|
+
this.updateShapeAnnotation();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
setStrokeStyle(style) {
|
|
115
|
+
if (this.shapeAnnotation) {
|
|
116
|
+
this.shapeAnnotation.border = {
|
|
117
|
+
style: style,
|
|
118
|
+
width: this.shapeAnnotation.border.width,
|
|
119
|
+
};
|
|
120
|
+
this.updateShapeAnnotation();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
setFillColor(color) {
|
|
124
|
+
if (this.shapeAnnotation) {
|
|
125
|
+
const newColor = new Color(color);
|
|
126
|
+
this.shapeAnnotation.fillColor = newColor.toRgba();
|
|
127
|
+
this.updateShapeAnnotation();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
updateShapeAnnotation() {
|
|
131
|
+
const promise = new Promise((resolve, reject) => {
|
|
132
|
+
if (this.pdfApi && this.shapeAnnotation) {
|
|
133
|
+
this.pdfApi
|
|
134
|
+
.updateItem(this.shapeAnnotation)
|
|
135
|
+
.then((item) => {
|
|
136
|
+
resolve();
|
|
137
|
+
})
|
|
138
|
+
.catch((error) => {
|
|
139
|
+
console.warn(error);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
reject();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return promise;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AnnotationBorderStyle, PdfItemType } from '../../pdf-viewer-api';
|
|
2
|
+
export interface EditShapeAnnotationToolbarProps {
|
|
3
|
+
strokeColors: string[];
|
|
4
|
+
strokeWidths: number[];
|
|
5
|
+
fillColors: string[];
|
|
6
|
+
selectedStrokeColor: string;
|
|
7
|
+
selectedStrokeWidth: number;
|
|
8
|
+
selectedStrokeStyle: AnnotationBorderStyle;
|
|
9
|
+
itemType: PdfItemType;
|
|
10
|
+
selectedFillColor: string;
|
|
11
|
+
onStrokeColorChanged(color: string): void;
|
|
12
|
+
onStrokeWidthChanged(width: number): void;
|
|
13
|
+
onStrokeStyleChanged(style: AnnotationBorderStyle): void;
|
|
14
|
+
onFillColorChanged(color: string): void;
|
|
15
|
+
onCancel(): void;
|
|
16
|
+
}
|
|
17
|
+
export interface EditShapeAnnotationToolbarActions {
|
|
18
|
+
setStrokeColor(color: string): void;
|
|
19
|
+
setStrokeWidth(width: number): void;
|
|
20
|
+
setStrokeStyle(style: AnnotationBorderStyle): void;
|
|
21
|
+
setFillColor(width: string): void;
|
|
22
|
+
setCancel(): void;
|
|
23
|
+
}
|
|
24
|
+
export declare const createEditShapeAnnotationToolbar: (props: EditShapeAnnotationToolbarProps, element: HTMLElement) => EditShapeAnnotationToolbarActions;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { app, h } from '../../lib/hyperapp';
|
|
2
|
+
import { PdfItemType } from '../../pdf-viewer-api';
|
|
3
|
+
import { translationManager } from '../../common/TranslationManager';
|
|
4
|
+
import { Toolbar } from '../../common/Toolbar';
|
|
5
|
+
import { ToolbarItemGroup } from '../../common/ToolbarItemGroup';
|
|
6
|
+
import { ToolbarButton } from '../../common/ToolbarButton';
|
|
7
|
+
import { icons } from '../../common/icons';
|
|
8
|
+
import { ToolbarSeparator } from '../../common/ToolbarSeparator';
|
|
9
|
+
import { StrokeWidthPicker } from '../../common/StrokeWidthPicker';
|
|
10
|
+
import { StrokeStylePicker } from '../../common/StrokeStylePicker';
|
|
11
|
+
import { ColorPicker } from '../../common/ColorPicker';
|
|
12
|
+
export const createEditShapeAnnotationToolbar = (props, element) => {
|
|
13
|
+
const state = {
|
|
14
|
+
strokeColors: props.strokeColors,
|
|
15
|
+
strokeWidths: props.strokeWidths,
|
|
16
|
+
fillColors: props.fillColors,
|
|
17
|
+
selectedStrokeColor: props.selectedStrokeColor,
|
|
18
|
+
selectedStrokeWidth: props.selectedStrokeWidth,
|
|
19
|
+
selectedStrokeStyle: props.selectedStrokeStyle,
|
|
20
|
+
selectedFillColor: props.selectedFillColor,
|
|
21
|
+
itemType: props.itemType,
|
|
22
|
+
};
|
|
23
|
+
const actions = {
|
|
24
|
+
setStrokeColor: (color) => ($state) => {
|
|
25
|
+
props.onStrokeColorChanged(color);
|
|
26
|
+
return Object.assign(Object.assign({}, $state), { selectedStrokeColor: color });
|
|
27
|
+
},
|
|
28
|
+
setStrokeWidth: (width) => ($state) => {
|
|
29
|
+
props.onStrokeWidthChanged(width);
|
|
30
|
+
return Object.assign(Object.assign({}, $state), { selectedStrokeWidth: width });
|
|
31
|
+
},
|
|
32
|
+
setStrokeStyle: (style) => ($state) => {
|
|
33
|
+
props.onStrokeStyleChanged(style);
|
|
34
|
+
return Object.assign(Object.assign({}, $state), { selectedStrokeStyle: style });
|
|
35
|
+
},
|
|
36
|
+
setFillColor: (color) => ($state) => {
|
|
37
|
+
props.onFillColorChanged(color);
|
|
38
|
+
return Object.assign(Object.assign({}, $state), { selectedFillColor: color });
|
|
39
|
+
},
|
|
40
|
+
setCancel: () => ($state) => {
|
|
41
|
+
return Object.assign({}, $state);
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const App = () => h(EditShapeAnnotationToolbar, null);
|
|
45
|
+
const EditShapeAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },
|
|
46
|
+
h(ToolbarItemGroup, null,
|
|
47
|
+
h(StrokeWidthPicker, { tooltip: translationManager.getText('annotShape.strokeWidth'), noneStrokeText: translationManager.getText('border.none'), strokeWidths: $state.strokeWidths, value: $state.selectedStrokeWidth, onChange: $actions.setStrokeWidth }),
|
|
48
|
+
h(StrokeStylePicker, { tooltip: translationManager.getText('annotShape.strokeStyle'), value: $state.selectedStrokeStyle, disabled: $state.selectedStrokeWidth === 0, onChange: $actions.setStrokeStyle, shapeType: $state.itemType === PdfItemType.CIRCLE ? 'circle' : 'rectangle' }),
|
|
49
|
+
h(ColorPicker, { tooltip: translationManager.getText('annotShape.strokeColor'), colors: $state.strokeColors, color: $state.selectedStrokeColor, disabled: $state.selectedStrokeWidth === 0, icon: icons.pencil, onChange: $actions.setStrokeColor })),
|
|
50
|
+
h(ToolbarItemGroup, null,
|
|
51
|
+
h(ToolbarSeparator, null),
|
|
52
|
+
h(ColorPicker, { tooltip: translationManager.getText('annotShape.bgColor'), colors: $state.fillColors, color: $state.selectedFillColor, icon: icons.fillColor, onChange: $actions.setFillColor })),
|
|
53
|
+
h(ToolbarItemGroup, { pushRight: true },
|
|
54
|
+
h(ToolbarSeparator, null),
|
|
55
|
+
h(ToolbarButton, { icon: icons.close, onClick: props.onCancel }))));
|
|
56
|
+
return app(state, actions, App, element);
|
|
57
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CanvasModule, CanvasModuleType } from '../CanvasModule';
|
|
2
|
+
import { PdfItemType } from '../../pdf-viewer-api';
|
|
3
|
+
export declare class ShapeAnnotationModule extends CanvasModule {
|
|
4
|
+
annotationbarElement: HTMLElement | null;
|
|
5
|
+
toolbarElement: HTMLElement | null;
|
|
6
|
+
static moduleInfo: {
|
|
7
|
+
name: string;
|
|
8
|
+
moduleType: CanvasModuleType;
|
|
9
|
+
requiredFeatures: {
|
|
10
|
+
annotate: boolean;
|
|
11
|
+
fillFormFields: boolean;
|
|
12
|
+
};
|
|
13
|
+
translationKey: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
};
|
|
16
|
+
constructor();
|
|
17
|
+
onRegister(): {
|
|
18
|
+
toolbar: HTMLElement;
|
|
19
|
+
contextbar: {
|
|
20
|
+
itemTypes: PdfItemType[];
|
|
21
|
+
icon: import("../../common/icons").IconDefinition;
|
|
22
|
+
tooltip: string;
|
|
23
|
+
onCmd: (annotationId: number) => void;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
activate(): void;
|
|
27
|
+
onEdit(annotationId: number): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CanvasModule, CanvasModuleType } from '../CanvasModule';
|
|
2
|
+
import { AddShapeAnnotationLayer } from './AddShapeAnnotationLayer';
|
|
3
|
+
import { EditShapeAnnotationLayer } from './EditShapeAnnotationLayer';
|
|
4
|
+
import { PdfItemType } from '../../pdf-viewer-api';
|
|
5
|
+
import { icons } from '../../common/Icon';
|
|
6
|
+
import { translationManager } from '../../common/TranslationManager';
|
|
7
|
+
export class ShapeAnnotationModule extends CanvasModule {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.annotationbarElement = null;
|
|
11
|
+
this.toolbarElement = null;
|
|
12
|
+
this.name = ShapeAnnotationModule.moduleInfo.name;
|
|
13
|
+
this.onEdit = this.onEdit.bind(this);
|
|
14
|
+
}
|
|
15
|
+
onRegister() {
|
|
16
|
+
this.toolbarElement = document.createElement('div');
|
|
17
|
+
return {
|
|
18
|
+
toolbar: this.toolbarElement,
|
|
19
|
+
contextbar: {
|
|
20
|
+
itemTypes: [PdfItemType.SQUARE, PdfItemType.CIRCLE],
|
|
21
|
+
icon: icons.edit,
|
|
22
|
+
tooltip: translationManager.getText('annotShape.edit'),
|
|
23
|
+
onCmd: (annotationId) => {
|
|
24
|
+
this.onEdit(annotationId);
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
activate() {
|
|
30
|
+
if (!this.canvasLayers['add']) {
|
|
31
|
+
this.createCanvasLayer('add', AddShapeAnnotationLayer, PdfItemType.SQUARE);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.removeCanvasLayer('add');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
onEdit(annotationId) {
|
|
38
|
+
this.createCanvasLayer('edit', EditShapeAnnotationLayer, annotationId);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
ShapeAnnotationModule.moduleInfo = {
|
|
42
|
+
name: 'ShapeAnnotationModule',
|
|
43
|
+
moduleType: CanvasModuleType.Tool,
|
|
44
|
+
requiredFeatures: {
|
|
45
|
+
annotate: true,
|
|
46
|
+
fillFormFields: false,
|
|
47
|
+
},
|
|
48
|
+
translationKey: 'annotShape.add',
|
|
49
|
+
icon: 'shapes',
|
|
50
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { ViewerCanvasState } from '../../pdf-viewer-canvas/state/store';
|
|
3
|
+
export declare class AddStampAnnotationLayer extends CanvasLayer {
|
|
4
|
+
private context;
|
|
5
|
+
private pointerDown;
|
|
6
|
+
private startPoint;
|
|
7
|
+
private stampRect;
|
|
8
|
+
private page;
|
|
9
|
+
private screenPageRect;
|
|
10
|
+
private aspectRatio;
|
|
11
|
+
private stamps;
|
|
12
|
+
onCreate(): void;
|
|
13
|
+
onSave(): Promise<void>;
|
|
14
|
+
onRemove(): void;
|
|
15
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
16
|
+
private close;
|
|
17
|
+
private setStamp;
|
|
18
|
+
private createStampAnnotation;
|
|
19
|
+
}
|