kviewer 0.0.1
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/README.md +134 -0
- package/dist/module.d.mts +15 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +26 -0
- package/dist/runtime/annotation/engine/config.d.ts +52 -0
- package/dist/runtime/annotation/engine/config.js +283 -0
- package/dist/runtime/annotation/engine/const.d.ts +6 -0
- package/dist/runtime/annotation/engine/const.js +7 -0
- package/dist/runtime/annotation/engine/cursor-preview.d.ts +2 -0
- package/dist/runtime/annotation/engine/cursor-preview.js +88 -0
- package/dist/runtime/annotation/engine/editor/editor.d.ts +69 -0
- package/dist/runtime/annotation/engine/editor/editor.js +233 -0
- package/dist/runtime/annotation/engine/editor/selector.d.ts +74 -0
- package/dist/runtime/annotation/engine/editor/selector.js +594 -0
- package/dist/runtime/annotation/engine/import-normalize.d.ts +5 -0
- package/dist/runtime/annotation/engine/import-normalize.js +99 -0
- package/dist/runtime/annotation/engine/input-device.d.ts +53 -0
- package/dist/runtime/annotation/engine/input-device.js +64 -0
- package/dist/runtime/annotation/engine/painter.d.ts +97 -0
- package/dist/runtime/annotation/engine/painter.js +591 -0
- package/dist/runtime/annotation/engine/store.d.ts +11 -0
- package/dist/runtime/annotation/engine/store.js +47 -0
- package/dist/runtime/annotation/engine/tools/arrow.d.ts +22 -0
- package/dist/runtime/annotation/engine/tools/arrow.js +126 -0
- package/dist/runtime/annotation/engine/tools/circle.d.ts +45 -0
- package/dist/runtime/annotation/engine/tools/circle.js +148 -0
- package/dist/runtime/annotation/engine/tools/cloud.d.ts +50 -0
- package/dist/runtime/annotation/engine/tools/cloud.js +244 -0
- package/dist/runtime/annotation/engine/tools/free-highlight.d.ts +43 -0
- package/dist/runtime/annotation/engine/tools/free-highlight.js +165 -0
- package/dist/runtime/annotation/engine/tools/free-text.d.ts +27 -0
- package/dist/runtime/annotation/engine/tools/free-text.js +114 -0
- package/dist/runtime/annotation/engine/tools/freehand.d.ts +44 -0
- package/dist/runtime/annotation/engine/tools/freehand.js +151 -0
- package/dist/runtime/annotation/engine/tools/highlight.d.ts +87 -0
- package/dist/runtime/annotation/engine/tools/highlight.js +215 -0
- package/dist/runtime/annotation/engine/tools/note.d.ts +9 -0
- package/dist/runtime/annotation/engine/tools/note.js +34 -0
- package/dist/runtime/annotation/engine/tools/rectangle.d.ts +45 -0
- package/dist/runtime/annotation/engine/tools/rectangle.js +142 -0
- package/dist/runtime/annotation/engine/tools/signature.d.ts +16 -0
- package/dist/runtime/annotation/engine/tools/signature.js +74 -0
- package/dist/runtime/annotation/engine/tools/stamp.d.ts +18 -0
- package/dist/runtime/annotation/engine/tools/stamp.js +94 -0
- package/dist/runtime/annotation/engine/types.d.ts +170 -0
- package/dist/runtime/annotation/engine/types.js +67 -0
- package/dist/runtime/annotation/engine/utils.d.ts +40 -0
- package/dist/runtime/annotation/engine/utils.js +257 -0
- package/dist/runtime/annotation/parsers/parseFormFields.d.ts +9 -0
- package/dist/runtime/annotation/parsers/parseFormFields.js +101 -0
- package/dist/runtime/annotation/pdf-export/download.d.ts +1 -0
- package/dist/runtime/annotation/pdf-export/download.js +10 -0
- package/dist/runtime/annotation/pdf-export/export-form-fields.d.ts +9 -0
- package/dist/runtime/annotation/pdf-export/export-form-fields.js +90 -0
- package/dist/runtime/annotation/pdf-export/export.d.ts +15 -0
- package/dist/runtime/annotation/pdf-export/export.js +145 -0
- package/dist/runtime/annotation/pdf-export/parse.d.ts +10 -0
- package/dist/runtime/annotation/pdf-export/parse.js +19 -0
- package/dist/runtime/annotation/pdf-export/parse_circle.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_circle.js +41 -0
- package/dist/runtime/annotation/pdf-export/parse_freetext.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_freetext.js +54 -0
- package/dist/runtime/annotation/pdf-export/parse_highlight.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_highlight.js +134 -0
- package/dist/runtime/annotation/pdf-export/parse_ink.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_ink.js +124 -0
- package/dist/runtime/annotation/pdf-export/parse_line.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_line.js +71 -0
- package/dist/runtime/annotation/pdf-export/parse_polyline.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_polyline.js +93 -0
- package/dist/runtime/annotation/pdf-export/parse_square.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_square.js +41 -0
- package/dist/runtime/annotation/pdf-export/parse_stamp.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_stamp.js +195 -0
- package/dist/runtime/annotation/pdf-export/parse_strikeout.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_strikeout.js +59 -0
- package/dist/runtime/annotation/pdf-export/parse_text.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_text.js +42 -0
- package/dist/runtime/annotation/pdf-export/parse_underline.d.ts +4 -0
- package/dist/runtime/annotation/pdf-export/parse_underline.js +59 -0
- package/dist/runtime/assets/kviewer.css +1 -0
- package/dist/runtime/components/AnnotationToolbar.d.vue.ts +3 -0
- package/dist/runtime/components/AnnotationToolbar.vue +125 -0
- package/dist/runtime/components/AnnotationToolbar.vue.d.ts +3 -0
- package/dist/runtime/components/FloatingPageIndicator.d.vue.ts +6 -0
- package/dist/runtime/components/FloatingPageIndicator.vue +93 -0
- package/dist/runtime/components/FloatingPageIndicator.vue.d.ts +6 -0
- package/dist/runtime/components/FormFieldLayer.d.vue.ts +11 -0
- package/dist/runtime/components/FormFieldLayer.vue +40 -0
- package/dist/runtime/components/FormFieldLayer.vue.d.ts +11 -0
- package/dist/runtime/components/PdfPage.d.vue.ts +9 -0
- package/dist/runtime/components/PdfPage.vue +199 -0
- package/dist/runtime/components/PdfPage.vue.d.ts +9 -0
- package/dist/runtime/components/ToolButton.d.vue.ts +13 -0
- package/dist/runtime/components/ToolButton.vue +26 -0
- package/dist/runtime/components/ToolButton.vue.d.ts +13 -0
- package/dist/runtime/components/Toolbar.d.vue.ts +3 -0
- package/dist/runtime/components/Toolbar.vue +11 -0
- package/dist/runtime/components/Toolbar.vue.d.ts +3 -0
- package/dist/runtime/components/Viewer.d.vue.ts +45 -0
- package/dist/runtime/components/Viewer.vue +617 -0
- package/dist/runtime/components/Viewer.vue.d.ts +45 -0
- package/dist/runtime/components/ViewerBar.d.vue.ts +3 -0
- package/dist/runtime/components/ViewerBar.vue +91 -0
- package/dist/runtime/components/ViewerBar.vue.d.ts +3 -0
- package/dist/runtime/components/ViewerTabs.d.vue.ts +381 -0
- package/dist/runtime/components/ViewerTabs.vue +171 -0
- package/dist/runtime/components/ViewerTabs.vue.d.ts +381 -0
- package/dist/runtime/components/form-fields/FormButton.d.vue.ts +7 -0
- package/dist/runtime/components/form-fields/FormButton.vue +39 -0
- package/dist/runtime/components/form-fields/FormButton.vue.d.ts +7 -0
- package/dist/runtime/components/form-fields/FormCheckbox.d.vue.ts +7 -0
- package/dist/runtime/components/form-fields/FormCheckbox.vue +28 -0
- package/dist/runtime/components/form-fields/FormCheckbox.vue.d.ts +7 -0
- package/dist/runtime/components/form-fields/FormDropdown.d.vue.ts +7 -0
- package/dist/runtime/components/form-fields/FormDropdown.vue +112 -0
- package/dist/runtime/components/form-fields/FormDropdown.vue.d.ts +7 -0
- package/dist/runtime/components/form-fields/FormFieldWrapper.d.vue.ts +8 -0
- package/dist/runtime/components/form-fields/FormFieldWrapper.vue +41 -0
- package/dist/runtime/components/form-fields/FormFieldWrapper.vue.d.ts +8 -0
- package/dist/runtime/components/form-fields/FormRadioButton.d.vue.ts +7 -0
- package/dist/runtime/components/form-fields/FormRadioButton.vue +30 -0
- package/dist/runtime/components/form-fields/FormRadioButton.vue.d.ts +7 -0
- package/dist/runtime/components/form-fields/FormSignatureField.d.vue.ts +7 -0
- package/dist/runtime/components/form-fields/FormSignatureField.vue +54 -0
- package/dist/runtime/components/form-fields/FormSignatureField.vue.d.ts +7 -0
- package/dist/runtime/components/form-fields/FormTextField.d.vue.ts +7 -0
- package/dist/runtime/components/form-fields/FormTextField.vue +66 -0
- package/dist/runtime/components/form-fields/FormTextField.vue.d.ts +7 -0
- package/dist/runtime/components/modals/FreeTextModal.d.vue.ts +25 -0
- package/dist/runtime/components/modals/FreeTextModal.vue +89 -0
- package/dist/runtime/components/modals/FreeTextModal.vue.d.ts +25 -0
- package/dist/runtime/components/modals/SignatureDrawModal.d.vue.ts +14 -0
- package/dist/runtime/components/modals/SignatureDrawModal.vue +120 -0
- package/dist/runtime/components/modals/SignatureDrawModal.vue.d.ts +14 -0
- package/dist/runtime/components/panels/SignaturePicker.d.vue.ts +3 -0
- package/dist/runtime/components/panels/SignaturePicker.vue +85 -0
- package/dist/runtime/components/panels/SignaturePicker.vue.d.ts +3 -0
- package/dist/runtime/components/panels/StampPicker.d.vue.ts +3 -0
- package/dist/runtime/components/panels/StampPicker.vue +46 -0
- package/dist/runtime/components/panels/StampPicker.vue.d.ts +3 -0
- package/dist/runtime/components/tools/ActionTools.d.vue.ts +3 -0
- package/dist/runtime/components/tools/ActionTools.vue +32 -0
- package/dist/runtime/components/tools/ActionTools.vue.d.ts +3 -0
- package/dist/runtime/components/tools/DrawingTools.d.vue.ts +6 -0
- package/dist/runtime/components/tools/DrawingTools.vue +57 -0
- package/dist/runtime/components/tools/DrawingTools.vue.d.ts +6 -0
- package/dist/runtime/components/tools/HandTool.d.vue.ts +3 -0
- package/dist/runtime/components/tools/HandTool.vue +14 -0
- package/dist/runtime/components/tools/HandTool.vue.d.ts +3 -0
- package/dist/runtime/components/tools/MarqueeTool.d.vue.ts +3 -0
- package/dist/runtime/components/tools/MarqueeTool.vue +15 -0
- package/dist/runtime/components/tools/MarqueeTool.vue.d.ts +3 -0
- package/dist/runtime/components/tools/PageInfo.d.vue.ts +3 -0
- package/dist/runtime/components/tools/PageInfo.vue +10 -0
- package/dist/runtime/components/tools/PageInfo.vue.d.ts +3 -0
- package/dist/runtime/components/tools/PageSettings.d.vue.ts +3 -0
- package/dist/runtime/components/tools/PageSettings.vue +92 -0
- package/dist/runtime/components/tools/PageSettings.vue.d.ts +3 -0
- package/dist/runtime/components/tools/SearchTool.d.vue.ts +3 -0
- package/dist/runtime/components/tools/SearchTool.vue +149 -0
- package/dist/runtime/components/tools/SearchTool.vue.d.ts +3 -0
- package/dist/runtime/components/tools/ToolProperties.d.vue.ts +7 -0
- package/dist/runtime/components/tools/ToolProperties.vue +174 -0
- package/dist/runtime/components/tools/ToolProperties.vue.d.ts +7 -0
- package/dist/runtime/components/tools/ZoomControls.d.vue.ts +3 -0
- package/dist/runtime/components/tools/ZoomControls.vue +59 -0
- package/dist/runtime/components/tools/ZoomControls.vue.d.ts +3 -0
- package/dist/runtime/composables/search-utils.d.ts +20 -0
- package/dist/runtime/composables/search-utils.js +55 -0
- package/dist/runtime/composables/useAnnotationEngine.d.ts +7 -0
- package/dist/runtime/composables/useAnnotationEngine.js +70 -0
- package/dist/runtime/composables/useAnnotationHistory.d.ts +12 -0
- package/dist/runtime/composables/useAnnotationHistory.js +69 -0
- package/dist/runtime/composables/useFormFields.d.ts +26 -0
- package/dist/runtime/composables/useFormFields.js +112 -0
- package/dist/runtime/composables/usePageProxyCache.d.ts +8 -0
- package/dist/runtime/composables/usePageProxyCache.js +73 -0
- package/dist/runtime/composables/usePageSettings.d.ts +16 -0
- package/dist/runtime/composables/usePageSettings.js +66 -0
- package/dist/runtime/composables/usePageVirtualization.d.ts +19 -0
- package/dist/runtime/composables/usePageVirtualization.js +203 -0
- package/dist/runtime/composables/useSearchIndex.d.ts +11 -0
- package/dist/runtime/composables/useSearchIndex.js +71 -0
- package/dist/runtime/composables/useViewerSearch.d.ts +32 -0
- package/dist/runtime/composables/useViewerSearch.js +418 -0
- package/dist/runtime/composables/useViewerState.d.ts +62 -0
- package/dist/runtime/composables/useViewerState.js +189 -0
- package/dist/runtime/composables/viewMode.d.ts +11 -0
- package/dist/runtime/composables/viewMode.js +19 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.js +3 -0
- package/dist/runtime/public-types.d.ts +2 -0
- package/dist/runtime/public-types.js +0 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/types.d.mts +5 -0
- package/package.json +64 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input device classification for stylus mode.
|
|
3
|
+
* Single source of truth for determining input type from native events.
|
|
4
|
+
*/
|
|
5
|
+
export type InputDeviceType = 'pen' | 'touch' | 'mouse' | 'unknown';
|
|
6
|
+
/**
|
|
7
|
+
* Classify a native event into an input device type.
|
|
8
|
+
*
|
|
9
|
+
* Priority:
|
|
10
|
+
* 1. PointerEvent.pointerType (most reliable, available on modern iPadOS)
|
|
11
|
+
* 2. Touch.touchType (Safari/WebKit fallback: 'stylus' vs 'direct')
|
|
12
|
+
* 3. Event constructor heuristic
|
|
13
|
+
*/
|
|
14
|
+
export declare function classifyInputDevice(event: Event): InputDeviceType;
|
|
15
|
+
/**
|
|
16
|
+
* Returns true if the input should be allowed to create/modify annotations.
|
|
17
|
+
* In stylus mode: only pen and mouse inputs can annotate.
|
|
18
|
+
* When stylus mode is off: all inputs can annotate.
|
|
19
|
+
*/
|
|
20
|
+
export declare function shouldAllowAnnotation(event: Event, stylusModeEnabled: boolean): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Returns true if the event originated from a finger touch.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isFingerTouch(event: Event): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Returns true if a TouchEvent came from Apple Pencil / stylus.
|
|
27
|
+
* Uses Safari's Touch.touchType API ('stylus' vs 'direct').
|
|
28
|
+
*/
|
|
29
|
+
export declare function isStylusTouch(event: TouchEvent): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Detect if the current device is an iPad.
|
|
32
|
+
* iPadOS 13+ reports as 'MacIntel' in navigator.platform,
|
|
33
|
+
* so we also check for multi-touch support.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isIPad(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Compute the Euclidean distance between two touch points.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getTouchDistance(touch1: Touch, touch2: Touch): number;
|
|
40
|
+
/**
|
|
41
|
+
* Compute the midpoint between two touch points in client coordinates.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getTouchCenter(touch1: Touch, touch2: Touch): {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
};
|
|
47
|
+
/** Minimum and maximum scale values for pinch zoom. */
|
|
48
|
+
export declare const PINCH_SCALE_MIN = 0.25;
|
|
49
|
+
export declare const PINCH_SCALE_MAX = 4;
|
|
50
|
+
/**
|
|
51
|
+
* Clamp a scale value to safe bounds.
|
|
52
|
+
*/
|
|
53
|
+
export declare function clampScale(scale: number): number;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export function classifyInputDevice(event) {
|
|
2
|
+
if (event instanceof PointerEvent) {
|
|
3
|
+
switch (event.pointerType) {
|
|
4
|
+
case "pen":
|
|
5
|
+
return "pen";
|
|
6
|
+
case "touch":
|
|
7
|
+
return "touch";
|
|
8
|
+
case "mouse":
|
|
9
|
+
return "mouse";
|
|
10
|
+
default:
|
|
11
|
+
return "unknown";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (typeof TouchEvent !== "undefined" && event instanceof TouchEvent) {
|
|
15
|
+
const touch = event.touches && event.touches[0] || event.changedTouches && event.changedTouches[0];
|
|
16
|
+
if (touch && "touchType" in touch) {
|
|
17
|
+
return touch.touchType === "stylus" ? "pen" : "touch";
|
|
18
|
+
}
|
|
19
|
+
return "touch";
|
|
20
|
+
}
|
|
21
|
+
if (event instanceof MouseEvent) {
|
|
22
|
+
return "mouse";
|
|
23
|
+
}
|
|
24
|
+
return "unknown";
|
|
25
|
+
}
|
|
26
|
+
export function shouldAllowAnnotation(event, stylusModeEnabled) {
|
|
27
|
+
if (!stylusModeEnabled) return true;
|
|
28
|
+
const device = classifyInputDevice(event);
|
|
29
|
+
return device === "pen" || device === "mouse";
|
|
30
|
+
}
|
|
31
|
+
export function isFingerTouch(event) {
|
|
32
|
+
return classifyInputDevice(event) === "touch";
|
|
33
|
+
}
|
|
34
|
+
export function isStylusTouch(event) {
|
|
35
|
+
const touch = event.touches && event.touches[0] || event.changedTouches && event.changedTouches[0];
|
|
36
|
+
if (touch && "touchType" in touch) {
|
|
37
|
+
return touch.touchType === "stylus";
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
export function isIPad() {
|
|
42
|
+
if (typeof navigator === "undefined") return false;
|
|
43
|
+
if (/iPad/.test(navigator.userAgent)) return true;
|
|
44
|
+
if (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
export function getTouchDistance(touch1, touch2) {
|
|
50
|
+
const dx = touch1.clientX - touch2.clientX;
|
|
51
|
+
const dy = touch1.clientY - touch2.clientY;
|
|
52
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
53
|
+
}
|
|
54
|
+
export function getTouchCenter(touch1, touch2) {
|
|
55
|
+
return {
|
|
56
|
+
x: (touch1.clientX + touch2.clientX) / 2,
|
|
57
|
+
y: (touch1.clientY + touch2.clientY) / 2
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export const PINCH_SCALE_MIN = 0.25;
|
|
61
|
+
export const PINCH_SCALE_MAX = 4;
|
|
62
|
+
export function clampScale(scale) {
|
|
63
|
+
return Math.min(PINCH_SCALE_MAX, Math.max(PINCH_SCALE_MIN, scale));
|
|
64
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import Konva from 'konva';
|
|
2
|
+
import type { IRect } from 'konva/lib/types';
|
|
3
|
+
import { type IAnnotationStore, type IAnnotationStyle, type IAnnotationType } from './types.js';
|
|
4
|
+
import { type IEditorFreeTextOptions } from './tools/free-text.js';
|
|
5
|
+
export interface KonvaCanvas {
|
|
6
|
+
pageNumber: number;
|
|
7
|
+
konvaStage: Konva.Stage;
|
|
8
|
+
wrapper: HTMLDivElement;
|
|
9
|
+
isActive: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface PainterCallbacks {
|
|
12
|
+
setDefaultMode: () => void;
|
|
13
|
+
forceReset: () => void;
|
|
14
|
+
onStoreAdd: (annotationStore: IAnnotationStore, isOriginal: boolean, currentAnnotation: IAnnotationType) => void;
|
|
15
|
+
onStoreDelete: (id: string) => void;
|
|
16
|
+
onAnnotationSelected: (annotationStore: IAnnotationStore, isClick: boolean, selectorRect: IRect) => void;
|
|
17
|
+
onMultiSelected: (annotationStores: IAnnotationStore[], combinedRect: IRect) => void;
|
|
18
|
+
onAnnotationChange: (annotationStore: IAnnotationStore) => void;
|
|
19
|
+
onAnnotationChanging: () => void;
|
|
20
|
+
onAnnotationChanged: (annotationStore: IAnnotationStore, selectorRect: IRect) => void;
|
|
21
|
+
onRequestTextInput: IEditorFreeTextOptions['onRequestTextInput'];
|
|
22
|
+
onRequestDeleteConfirm?: (id: string) => Promise<boolean>;
|
|
23
|
+
}
|
|
24
|
+
export declare class Painter {
|
|
25
|
+
private userName;
|
|
26
|
+
private konvaCanvasStore;
|
|
27
|
+
private editorStore;
|
|
28
|
+
private currentAnnotation;
|
|
29
|
+
private store;
|
|
30
|
+
private selector;
|
|
31
|
+
private tempDataTransfer;
|
|
32
|
+
private callbacks;
|
|
33
|
+
private getStylusModeEnabled?;
|
|
34
|
+
constructor({ userName, callbacks, getStylusModeEnabled, }: {
|
|
35
|
+
userName: string;
|
|
36
|
+
callbacks: PainterCallbacks;
|
|
37
|
+
getStylusModeEnabled?: () => boolean;
|
|
38
|
+
});
|
|
39
|
+
private editFreeText;
|
|
40
|
+
private bindGlobalEvents;
|
|
41
|
+
private globalKeyUpHandler;
|
|
42
|
+
private createKonvaStage;
|
|
43
|
+
private applyStylusTouchAction;
|
|
44
|
+
private removeStylusTouchAction;
|
|
45
|
+
private saveToStore;
|
|
46
|
+
private updateStore;
|
|
47
|
+
/**
|
|
48
|
+
* Convert a Konva stage-relative rect to viewport-relative coordinates
|
|
49
|
+
* by combining with the stage container's DOM position.
|
|
50
|
+
*/
|
|
51
|
+
private toViewportRect;
|
|
52
|
+
private parseStampData;
|
|
53
|
+
private findEditorForGroupId;
|
|
54
|
+
private findEditor;
|
|
55
|
+
private enableEditor;
|
|
56
|
+
private enablePainting;
|
|
57
|
+
private reDrawAnnotation;
|
|
58
|
+
private drawAnnotation;
|
|
59
|
+
private deleteAnnotation;
|
|
60
|
+
private setMode;
|
|
61
|
+
private disablePainting;
|
|
62
|
+
/**
|
|
63
|
+
* Toggle hit detection on annotation layers.
|
|
64
|
+
* When a drawing tool is active, disable listening on the entire layer
|
|
65
|
+
* so Konva skips the expensive hit canvas redraw on every touchmove.
|
|
66
|
+
* Re-enable when switching to select/hand mode where clicks need to work.
|
|
67
|
+
*/
|
|
68
|
+
private setShapeGroupsListening;
|
|
69
|
+
private saveTempDataTransfer;
|
|
70
|
+
private clearTempDataTransfer;
|
|
71
|
+
/**
|
|
72
|
+
* Programmatic imports/additions (replace/merge/redo) add Konva groups
|
|
73
|
+
* directly, so selector handlers need to be rebound when hand/select mode
|
|
74
|
+
* is currently active.
|
|
75
|
+
*/
|
|
76
|
+
private refreshSelectorForPages;
|
|
77
|
+
refreshStylusMode(): void;
|
|
78
|
+
initCanvasForPage(pageNumber: number, container: HTMLDivElement, width: number, height: number, scale: number): void;
|
|
79
|
+
destroyCanvasForPage(pageNumber: number): void;
|
|
80
|
+
activate(annotation: IAnnotationType | null, dataTransfer: string | null): void;
|
|
81
|
+
activateMarquee(): void;
|
|
82
|
+
activateEraser(): void;
|
|
83
|
+
highlightRange(range: Range, annotation: IAnnotationType): void;
|
|
84
|
+
selectAnnotation(id: string): void;
|
|
85
|
+
initAnnotations(annotations: IAnnotationStore[]): Promise<void>;
|
|
86
|
+
update(id: string, updates: Partial<IAnnotationStore>): void;
|
|
87
|
+
delete(id: string, emit?: boolean): void;
|
|
88
|
+
updateAnnotationStyle(annotationStore: IAnnotationStore, style: IAnnotationStyle): void;
|
|
89
|
+
reAddAnnotation(annotation: IAnnotationStore): void;
|
|
90
|
+
getData(): IAnnotationStore[];
|
|
91
|
+
getAnnotation(id: string): IAnnotationStore | undefined;
|
|
92
|
+
clearAllAnnotations(emit?: boolean): void;
|
|
93
|
+
replaceAnnotations(annotations: IAnnotationStore[]): void;
|
|
94
|
+
mergeAnnotations(annotations: IAnnotationStore[]): void;
|
|
95
|
+
getCanvasState(): Record<number, string>;
|
|
96
|
+
destroy(): void;
|
|
97
|
+
}
|