@markerjs/markerjs3 3.0.0-beta.0 → 3.0.0-beta.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/markerjs3.d.ts +284 -4
- package/markerjs3.js +1 -1
- package/markerjs3.js.map +1 -1
- package/package.json +1 -1
- package/umd/markerjs3.js +1 -1
- package/umd/markerjs3.js.map +1 -1
package/markerjs3.d.ts
CHANGED
|
@@ -236,6 +236,14 @@ declare class MarkerBase {
|
|
|
236
236
|
* @param scaleY - vertical scale
|
|
237
237
|
*/
|
|
238
238
|
scale(scaleX: number, scaleY: number): void;
|
|
239
|
+
/**
|
|
240
|
+
* Returns markers bounding box.
|
|
241
|
+
*
|
|
242
|
+
* Override to return a custom bounding box.
|
|
243
|
+
*
|
|
244
|
+
* @returns rectangle fitting the marker.
|
|
245
|
+
*/
|
|
246
|
+
getBBox(): DOMRect;
|
|
239
247
|
}
|
|
240
248
|
|
|
241
249
|
/**
|
|
@@ -357,6 +365,7 @@ declare class RectangularBoxMarkerBase extends MarkerBase {
|
|
|
357
365
|
* @param scaleY - vertical scale
|
|
358
366
|
*/
|
|
359
367
|
scale(scaleX: number, scaleY: number): void;
|
|
368
|
+
getBBox(): DOMRect;
|
|
360
369
|
}
|
|
361
370
|
|
|
362
371
|
declare class ShapeOutlineMarkerBase extends RectangularBoxMarkerBase {
|
|
@@ -860,7 +869,7 @@ declare class TextMarker extends RectangularBoxMarkerBase {
|
|
|
860
869
|
/**
|
|
861
870
|
* Text padding from the bounding box.
|
|
862
871
|
*/
|
|
863
|
-
|
|
872
|
+
padding: number;
|
|
864
873
|
/**
|
|
865
874
|
* Text's bounding box where text should fit and/or be anchored to.
|
|
866
875
|
*/
|
|
@@ -878,6 +887,7 @@ declare class TextMarker extends RectangularBoxMarkerBase {
|
|
|
878
887
|
* Sets (adjusts) the stencil's size.
|
|
879
888
|
*/
|
|
880
889
|
setSize(): void;
|
|
890
|
+
protected setSizeFromTextSize(): void;
|
|
881
891
|
private textSizeChanged;
|
|
882
892
|
/**
|
|
883
893
|
* Sets the text color.
|
|
@@ -991,6 +1001,139 @@ declare class EllipseMarker extends ShapeMarkerBase {
|
|
|
991
1001
|
getState(): ShapeMarkerBaseState;
|
|
992
1002
|
}
|
|
993
1003
|
|
|
1004
|
+
type ImageType = 'svg' | 'bitmap';
|
|
1005
|
+
/**
|
|
1006
|
+
* Represents image marker's state.
|
|
1007
|
+
*/
|
|
1008
|
+
interface ImageMarkerBaseState extends RectangularBoxMarkerBaseState {
|
|
1009
|
+
imageType?: ImageType;
|
|
1010
|
+
svgString?: string;
|
|
1011
|
+
imageSrc?: string;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
declare class ImageMarkerBase extends RectangularBoxMarkerBase {
|
|
1015
|
+
static title: string;
|
|
1016
|
+
/**
|
|
1017
|
+
* Main SVG or image element of the stencil.
|
|
1018
|
+
*/
|
|
1019
|
+
protected SVGImage?: SVGSVGElement | SVGImageElement;
|
|
1020
|
+
protected imageType: ImageType;
|
|
1021
|
+
protected _svgString?: string;
|
|
1022
|
+
get svgString(): string | undefined;
|
|
1023
|
+
set svgString(value: string | undefined);
|
|
1024
|
+
protected _imageSrc?: string;
|
|
1025
|
+
get imageSrc(): string | undefined;
|
|
1026
|
+
set imageSrc(value: string | undefined);
|
|
1027
|
+
/**
|
|
1028
|
+
* Natural (real) width of the image.
|
|
1029
|
+
*/
|
|
1030
|
+
protected naturalWidth: number;
|
|
1031
|
+
/**
|
|
1032
|
+
* Natural (real) height of the image.
|
|
1033
|
+
*/
|
|
1034
|
+
protected naturalHeight: number;
|
|
1035
|
+
constructor(container: SVGGElement);
|
|
1036
|
+
protected createImage(): void;
|
|
1037
|
+
createVisual(): void;
|
|
1038
|
+
adjustImage(): void;
|
|
1039
|
+
private isDescendant;
|
|
1040
|
+
ownsTarget(el: EventTarget): boolean;
|
|
1041
|
+
setSize(): void;
|
|
1042
|
+
getState(): ImageMarkerBaseState;
|
|
1043
|
+
protected applyStrokeColor(): void;
|
|
1044
|
+
restoreState(state: ImageMarkerBaseState): void;
|
|
1045
|
+
/**
|
|
1046
|
+
* Scales marker. Used after the image resize.
|
|
1047
|
+
*
|
|
1048
|
+
* @param scaleX - horizontal scale
|
|
1049
|
+
* @param scaleY - vertical scale
|
|
1050
|
+
*/
|
|
1051
|
+
scale(scaleX: number, scaleY: number): void;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Used to represent user-set images.
|
|
1056
|
+
*/
|
|
1057
|
+
declare class CustomImageMarker extends ImageMarkerBase {
|
|
1058
|
+
/**
|
|
1059
|
+
* String type name of the marker type.
|
|
1060
|
+
*/
|
|
1061
|
+
static typeName: string;
|
|
1062
|
+
/**
|
|
1063
|
+
* Marker type title (display name) used for accessibility and other attributes.
|
|
1064
|
+
*/
|
|
1065
|
+
static title: string;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Check mark marker.
|
|
1070
|
+
*/
|
|
1071
|
+
declare class CheckImageMarker extends ImageMarkerBase {
|
|
1072
|
+
/**
|
|
1073
|
+
* String type name of the marker type.
|
|
1074
|
+
*/
|
|
1075
|
+
static typeName: string;
|
|
1076
|
+
/**
|
|
1077
|
+
* Marker type title (display name) used for accessibility and other attributes.
|
|
1078
|
+
*/
|
|
1079
|
+
static title: string;
|
|
1080
|
+
constructor(container: SVGGElement);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* X mark marker.
|
|
1085
|
+
*/
|
|
1086
|
+
declare class XImageMarker extends ImageMarkerBase {
|
|
1087
|
+
/**
|
|
1088
|
+
* String type name of the marker type.
|
|
1089
|
+
*/
|
|
1090
|
+
static typeName: string;
|
|
1091
|
+
/**
|
|
1092
|
+
* Marker type title (display name) used for accessibility and other attributes.
|
|
1093
|
+
*/
|
|
1094
|
+
static title: string;
|
|
1095
|
+
constructor(container: SVGGElement);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
interface CaptionFrameMarkerState extends TextMarkerState, ShapeMarkerBaseState {
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
declare class CaptionFrameMarker extends TextMarker {
|
|
1102
|
+
static typeName: string;
|
|
1103
|
+
static title: string;
|
|
1104
|
+
private _outerFrameVisual;
|
|
1105
|
+
private _captionFrameVisual;
|
|
1106
|
+
private _frameVisual;
|
|
1107
|
+
constructor(container: SVGGElement);
|
|
1108
|
+
protected applyStrokeColor(): void;
|
|
1109
|
+
protected applyStrokeWidth(): void;
|
|
1110
|
+
protected applyStrokeDasharray(): void;
|
|
1111
|
+
protected applyOpacity(): void;
|
|
1112
|
+
protected applyFillColor(): void;
|
|
1113
|
+
protected getPaths(width?: number, height?: number): {
|
|
1114
|
+
frame: string;
|
|
1115
|
+
caption: string;
|
|
1116
|
+
};
|
|
1117
|
+
createVisual(): void;
|
|
1118
|
+
adjustVisual(): void;
|
|
1119
|
+
protected adjustTextPosition(): void;
|
|
1120
|
+
protected adjustFrameVisual(): void;
|
|
1121
|
+
ownsTarget(el: EventTarget): boolean;
|
|
1122
|
+
setSize(): void;
|
|
1123
|
+
protected setSizeFromTextSize(): void;
|
|
1124
|
+
hideVisual(): void;
|
|
1125
|
+
showVisual(): void;
|
|
1126
|
+
getState(): CaptionFrameMarkerState;
|
|
1127
|
+
restoreState(state: MarkerBaseState): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* Scales marker. Used after the image resize.
|
|
1130
|
+
*
|
|
1131
|
+
* @param scaleX - horizontal scale
|
|
1132
|
+
* @param scaleY - vertical scale
|
|
1133
|
+
*/
|
|
1134
|
+
scale(scaleX: number, scaleY: number): void;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
994
1137
|
interface MarkerEditorProperties<TMarkerType extends MarkerBase = MarkerBase> {
|
|
995
1138
|
/**
|
|
996
1139
|
* SVG container for the marker and editor elements.
|
|
@@ -1256,6 +1399,8 @@ declare class MarkerArea extends HTMLElement {
|
|
|
1256
1399
|
private hideOutline;
|
|
1257
1400
|
private onPointerUp;
|
|
1258
1401
|
private finishMarqueeSelection;
|
|
1402
|
+
private adjustMarqueeSelectOutline;
|
|
1403
|
+
private hideMarqueeSelectOutline;
|
|
1259
1404
|
private onPointerOut;
|
|
1260
1405
|
private onKeyUp;
|
|
1261
1406
|
private attachEvents;
|
|
@@ -1731,9 +1876,121 @@ declare class FreehandMarkerEditor<TMarkerType extends FreehandMarker = Freehand
|
|
|
1731
1876
|
deselect(): void;
|
|
1732
1877
|
}
|
|
1733
1878
|
|
|
1879
|
+
/**
|
|
1880
|
+
* Text changed event handler type.
|
|
1881
|
+
*/
|
|
1882
|
+
type TextChangedHandler = (text: string) => void;
|
|
1883
|
+
type BlurHandler = () => void;
|
|
1884
|
+
/**
|
|
1885
|
+
* Represents a text block editor element.
|
|
1886
|
+
*/
|
|
1887
|
+
declare class TextBlockEditor {
|
|
1888
|
+
private textEditor;
|
|
1889
|
+
private isInFocus;
|
|
1890
|
+
private _width;
|
|
1891
|
+
/**
|
|
1892
|
+
* Returns editor width in pixels.
|
|
1893
|
+
*/
|
|
1894
|
+
get width(): number;
|
|
1895
|
+
/**
|
|
1896
|
+
* Sets editor width in pixels.
|
|
1897
|
+
*/
|
|
1898
|
+
set width(value: number);
|
|
1899
|
+
private _height;
|
|
1900
|
+
/**
|
|
1901
|
+
* Returns editor height in pixels.
|
|
1902
|
+
*/
|
|
1903
|
+
get height(): number;
|
|
1904
|
+
/**
|
|
1905
|
+
* Sets editor height in pixels.
|
|
1906
|
+
*/
|
|
1907
|
+
set height(value: number);
|
|
1908
|
+
private _left;
|
|
1909
|
+
/**
|
|
1910
|
+
* Returns the horizontal (X) location of the editor's left corner (in pixels).
|
|
1911
|
+
*/
|
|
1912
|
+
get left(): number;
|
|
1913
|
+
/**
|
|
1914
|
+
* Sets the horizontal (X) location of the editor's left corner (in pixels).
|
|
1915
|
+
*/
|
|
1916
|
+
set left(value: number);
|
|
1917
|
+
private _top;
|
|
1918
|
+
/**
|
|
1919
|
+
* Returns the vertical (Y) location of the editor's top left corner (in pixels).
|
|
1920
|
+
*/
|
|
1921
|
+
get top(): number;
|
|
1922
|
+
/**
|
|
1923
|
+
* Sets the vertical (Y) location of the editor's top left corner (in pixels).
|
|
1924
|
+
*/
|
|
1925
|
+
set top(value: number);
|
|
1926
|
+
private _text;
|
|
1927
|
+
/**
|
|
1928
|
+
* Returns the text block text.
|
|
1929
|
+
*/
|
|
1930
|
+
get text(): string;
|
|
1931
|
+
/**
|
|
1932
|
+
* Sets the text block text.
|
|
1933
|
+
*/
|
|
1934
|
+
set text(value: string);
|
|
1935
|
+
private _fontFamily;
|
|
1936
|
+
/**
|
|
1937
|
+
* Returns text block's font family.
|
|
1938
|
+
*/
|
|
1939
|
+
get fontFamily(): string;
|
|
1940
|
+
/**
|
|
1941
|
+
* Sets the text block's font family.
|
|
1942
|
+
*/
|
|
1943
|
+
set fontFamily(value: string);
|
|
1944
|
+
private _fontSize;
|
|
1945
|
+
/**
|
|
1946
|
+
* Returns text block's font size.
|
|
1947
|
+
*/
|
|
1948
|
+
get fontSize(): string;
|
|
1949
|
+
/**
|
|
1950
|
+
* Sets text block's font size.
|
|
1951
|
+
*/
|
|
1952
|
+
set fontSize(value: string);
|
|
1953
|
+
private _textColor;
|
|
1954
|
+
/**
|
|
1955
|
+
* Returns text block's font color.
|
|
1956
|
+
*/
|
|
1957
|
+
get textColor(): string;
|
|
1958
|
+
/**
|
|
1959
|
+
* Returns text block's font color.
|
|
1960
|
+
*/
|
|
1961
|
+
set textColor(value: string);
|
|
1962
|
+
private _bgColor;
|
|
1963
|
+
get bgColor(): string;
|
|
1964
|
+
set bgColor(value: string);
|
|
1965
|
+
/**
|
|
1966
|
+
* Text changed event handler.
|
|
1967
|
+
*/
|
|
1968
|
+
onTextChanged?: TextChangedHandler;
|
|
1969
|
+
onBlur?: BlurHandler;
|
|
1970
|
+
/**
|
|
1971
|
+
* Creates a new text block editor instance.
|
|
1972
|
+
*/
|
|
1973
|
+
constructor();
|
|
1974
|
+
private isSetupCompleted;
|
|
1975
|
+
private setup;
|
|
1976
|
+
/**
|
|
1977
|
+
* Returns editor's UI,
|
|
1978
|
+
* @returns UI in a div element.
|
|
1979
|
+
*/
|
|
1980
|
+
getEditorUi(): HTMLDivElement;
|
|
1981
|
+
/**
|
|
1982
|
+
* Focuses text editing in the editor.
|
|
1983
|
+
*/
|
|
1984
|
+
focus(): void;
|
|
1985
|
+
/**
|
|
1986
|
+
* Unfocuses the editor.
|
|
1987
|
+
*/
|
|
1988
|
+
blur(): void;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1734
1991
|
declare class TextMarkerEditor<TMarkerType extends TextMarker = TextMarker> extends RectangularBoxMarkerBaseEditor<TMarkerType> {
|
|
1735
|
-
|
|
1736
|
-
|
|
1992
|
+
protected textBlockEditorContainer: SVGForeignObjectElement;
|
|
1993
|
+
protected textBlockEditor: TextBlockEditor;
|
|
1737
1994
|
set color(color: string);
|
|
1738
1995
|
get color(): string;
|
|
1739
1996
|
set fontFamily(font: string);
|
|
@@ -1787,6 +2044,29 @@ declare class CalloutMarkerEditor<TMarkerType extends CalloutMarker = CalloutMar
|
|
|
1787
2044
|
protected resize(point: IPoint): void;
|
|
1788
2045
|
}
|
|
1789
2046
|
|
|
2047
|
+
declare class ImageMarkerEditor<TMarkerType extends ImageMarkerBase = ImageMarkerBase> extends RectangularBoxMarkerBaseEditor<TMarkerType> {
|
|
2048
|
+
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
2049
|
+
/**
|
|
2050
|
+
* Handles pointer (mouse, touch, stylus, etc.) down event.
|
|
2051
|
+
*
|
|
2052
|
+
* @param point - event coordinates.
|
|
2053
|
+
* @param target - direct event target element.
|
|
2054
|
+
*/
|
|
2055
|
+
pointerDown(point: IPoint, target?: EventTarget): void;
|
|
2056
|
+
/**
|
|
2057
|
+
* Handles pointer (mouse, touch, stylus, etc.) up event.
|
|
2058
|
+
*
|
|
2059
|
+
* @param point - event coordinates.
|
|
2060
|
+
* @param target - direct event target element.
|
|
2061
|
+
*/
|
|
2062
|
+
pointerUp(point: IPoint): void;
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
declare class CaptionFrameMarkerEditor<TMarkerType extends CaptionFrameMarker = CaptionFrameMarker> extends TextMarkerEditor<TMarkerType> {
|
|
2066
|
+
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
2067
|
+
protected setSize(): void;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
1790
2070
|
interface MarkerViewEventMap {
|
|
1791
2071
|
/**
|
|
1792
2072
|
* Viewer initialized.
|
|
@@ -1927,4 +2207,4 @@ declare class Renderer {
|
|
|
1927
2207
|
rasterize(state: AnnotationState, targetCanvas?: HTMLCanvasElement): Promise<string>;
|
|
1928
2208
|
}
|
|
1929
2209
|
|
|
1930
|
-
export { type AnnotationState, ArrowMarker, ArrowMarkerEditor, type ArrowMarkerState, type ArrowType, CalloutMarker, CalloutMarkerEditor, type CalloutMarkerState, type ColorType, CoverMarker, EllipseFrameMarker, EllipseMarker, type FontSize, FrameMarker, FreehandMarker, FreehandMarkerEditor, type FreehandMarkerState, Grip, HighlightMarker, type IPoint, LineMarker, LinearMarkerBase, type LinearMarkerBaseState, LinearMarkerEditor, MarkerArea, type MarkerAreaEventData, type MarkerAreaEventMap, MarkerBase, MarkerBaseEditor, type MarkerBaseState, type MarkerEditorProperties, type MarkerEditorState, MarkerView, type MarkerViewEventData, type MarkerViewEventMap, MeasurementMarker, PolygonMarker, PolygonMarkerEditor, type PolygonMarkerState, RectangularBoxMarkerBase, type RectangularBoxMarkerBaseState, Renderer, ResizeGrip, RotateGrip, ShapeMarkerBase, type ShapeMarkerBaseState, ShapeMarkerEditor, ShapeOutlineMarkerBase, type ShapeOutlineMarkerBaseState, ShapeOutlineMarkerEditor, SvgHelper, TextMarker, TextMarkerEditor, type TextMarkerState };
|
|
2210
|
+
export { type AnnotationState, ArrowMarker, ArrowMarkerEditor, type ArrowMarkerState, type ArrowType, CalloutMarker, CalloutMarkerEditor, type CalloutMarkerState, CaptionFrameMarker, CaptionFrameMarkerEditor, type CaptionFrameMarkerState, CheckImageMarker, type ColorType, CoverMarker, CustomImageMarker, EllipseFrameMarker, EllipseMarker, type FontSize, FrameMarker, FreehandMarker, FreehandMarkerEditor, type FreehandMarkerState, Grip, HighlightMarker, type IPoint, ImageMarkerBase, type ImageMarkerBaseState, ImageMarkerEditor, type ImageType, LineMarker, LinearMarkerBase, type LinearMarkerBaseState, LinearMarkerEditor, MarkerArea, type MarkerAreaEventData, type MarkerAreaEventMap, MarkerBase, MarkerBaseEditor, type MarkerBaseState, type MarkerEditorProperties, type MarkerEditorState, MarkerView, type MarkerViewEventData, type MarkerViewEventMap, MeasurementMarker, PolygonMarker, PolygonMarkerEditor, type PolygonMarkerState, RectangularBoxMarkerBase, type RectangularBoxMarkerBaseState, Renderer, ResizeGrip, RotateGrip, ShapeMarkerBase, type ShapeMarkerBaseState, ShapeMarkerEditor, ShapeOutlineMarkerBase, type ShapeOutlineMarkerBaseState, ShapeOutlineMarkerEditor, SvgHelper, TextMarker, TextMarkerEditor, type TextMarkerState, XImageMarker };
|