@markerjs/markerjs3 3.0.0-alpha.2 → 3.0.0-alpha.3

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 CHANGED
@@ -393,6 +393,32 @@ declare class ShapeOutlineMarkerBase extends RectangularBoxMarkerBase {
393
393
  interface ShapeOutlineMarkerBaseState extends RectangularBoxMarkerBaseState {
394
394
  }
395
395
 
396
+ /**
397
+ * Represents shape's state.
398
+ */
399
+ interface ShapeMarkerBaseState extends ShapeOutlineMarkerBaseState {
400
+ fillColor: string;
401
+ }
402
+
403
+ declare abstract class ShapeMarkerBase extends ShapeOutlineMarkerBase {
404
+ static title: string;
405
+ protected _fillColor: string;
406
+ get fillColor(): string;
407
+ set fillColor(value: string);
408
+ constructor(container: SVGGElement);
409
+ createVisual(): void;
410
+ /**
411
+ * Returns current marker state that can be restored in the future.
412
+ */
413
+ getState(): ShapeMarkerBaseState;
414
+ /**
415
+ * Restores previously saved marker state.
416
+ *
417
+ * @param state - previously saved state.
418
+ */
419
+ restoreState(state: MarkerBaseState): void;
420
+ }
421
+
396
422
  declare class FrameMarker extends ShapeOutlineMarkerBase {
397
423
  /**
398
424
  * String type name of the marker type.
@@ -487,6 +513,54 @@ declare class LinearMarkerBase extends MarkerBase {
487
513
  scale(scaleX: number, scaleY: number): void;
488
514
  }
489
515
 
516
+ declare class LineMarker extends LinearMarkerBase {
517
+ static typeName: string;
518
+ static title: string;
519
+ constructor(container: SVGGElement);
520
+ protected getPath(): string;
521
+ /**
522
+ * Returns current marker state that can be restored in the future.
523
+ */
524
+ getState(): LinearMarkerBaseState;
525
+ }
526
+
527
+ type ArrowType = 'both' | 'start' | 'end' | 'none';
528
+ interface ArrowMarkerState extends LinearMarkerBaseState {
529
+ arrowType: ArrowType;
530
+ }
531
+
532
+ declare class ArrowMarker extends LineMarker {
533
+ static typeName: string;
534
+ static title: string;
535
+ private _arrowType;
536
+ get arrowType(): ArrowType;
537
+ set arrowType(value: ArrowType);
538
+ constructor(container: SVGGElement);
539
+ protected getPath(): string;
540
+ protected applyStrokeWidth(): void;
541
+ /**
542
+ * Returns marker's state.
543
+ */
544
+ getState(): ArrowMarkerState;
545
+ /**
546
+ * Restores marker's state to the previously saved one.
547
+ * @param state - previously saved state.
548
+ */
549
+ restoreState(state: MarkerBaseState): void;
550
+ }
551
+
552
+ declare class MeasurementMarker extends LineMarker {
553
+ static typeName: string;
554
+ static title: string;
555
+ constructor(container: SVGGElement);
556
+ protected getPath(): string;
557
+ protected applyStrokeWidth(): void;
558
+ /**
559
+ * Returns marker's state.
560
+ */
561
+ getState(): LinearMarkerBaseState;
562
+ }
563
+
490
564
  interface PolygonMarkerState extends MarkerBaseState {
491
565
  /**
492
566
  * Polygon points.
@@ -798,6 +872,7 @@ declare class TextMarker extends RectangularBoxMarkerBase {
798
872
  textBlock: TextBlock;
799
873
  constructor(container: SVGGElement);
800
874
  createVisual(): void;
875
+ adjustVisual(): void;
801
876
  ownsTarget(el: EventTarget): boolean;
802
877
  protected setTextBoundingBox(): void;
803
878
  /**
@@ -832,6 +907,58 @@ declare class TextMarker extends RectangularBoxMarkerBase {
832
907
  scale(scaleX: number, scaleY: number): void;
833
908
  }
834
909
 
910
+ declare class CoverMarker extends ShapeMarkerBase {
911
+ /**
912
+ * String type name of the marker type.
913
+ */
914
+ static typeName: string;
915
+ /**
916
+ * Marker type title (display name) used for accessibility and other attributes.
917
+ */
918
+ static title: string;
919
+ constructor(container: SVGGElement);
920
+ protected getPath(width?: number, height?: number): string;
921
+ getState(): ShapeMarkerBaseState;
922
+ }
923
+
924
+ declare class HighlightMarker extends ShapeMarkerBase {
925
+ /**
926
+ * String type name of the marker type.
927
+ */
928
+ static typeName: string;
929
+ /**
930
+ * Marker type title (display name) used for accessibility and other attributes.
931
+ */
932
+ static title: string;
933
+ constructor(container: SVGGElement);
934
+ protected getPath(width?: number, height?: number): string;
935
+ getState(): ShapeMarkerBaseState;
936
+ }
937
+
938
+ interface CalloutMarkerState extends TextMarkerState {
939
+ tipPosition: IPoint;
940
+ }
941
+
942
+ declare class CalloutMarker extends TextMarker {
943
+ static typeName: string;
944
+ static title: string;
945
+ private _tipPosition;
946
+ get tipPosition(): IPoint;
947
+ set tipPosition(value: IPoint);
948
+ private tipBase1Position;
949
+ private tipBase2Position;
950
+ private _calloutVisual;
951
+ constructor(container: SVGGElement);
952
+ protected getPath(): string;
953
+ private setTipPoints;
954
+ createVisual(): void;
955
+ adjustVisual(): void;
956
+ ownsTarget(el: EventTarget): boolean;
957
+ getState(): CalloutMarkerState;
958
+ restoreState(state: MarkerBaseState): void;
959
+ scale(scaleX: number, scaleY: number): void;
960
+ }
961
+
835
962
  interface MarkerEditorProperties<TMarkerType extends MarkerBase = MarkerBase> {
836
963
  /**
837
964
  * SVG container for the marker and editor elements.
@@ -943,10 +1070,11 @@ declare class MarkerBaseEditor<TMarkerType extends MarkerBase = MarkerBase> {
943
1070
  get opacity(): number;
944
1071
  constructor(properties: MarkerEditorProperties<TMarkerType>);
945
1072
  ownsTarget(el: EventTarget | null): boolean;
1073
+ protected isMultiSelected: boolean;
946
1074
  /**
947
1075
  * Selects this marker and displays appropriate selected marker UI.
948
1076
  */
949
- select(): void;
1077
+ select(multi?: boolean): void;
950
1078
  /**
951
1079
  * Deselects this marker and hides selected marker UI.
952
1080
  */
@@ -1045,6 +1173,7 @@ declare class MarkerArea extends HTMLElement {
1045
1173
  private _isInitialized;
1046
1174
  private _currentMarkerEditor?;
1047
1175
  get currentMarkerEditor(): MarkerBaseEditor | undefined;
1176
+ private _selectedMarkerEditors;
1048
1177
  private _newMarkerOutline;
1049
1178
  private _targetImage;
1050
1179
  get targetImage(): HTMLImageElement | undefined;
@@ -1076,15 +1205,25 @@ declare class MarkerArea extends HTMLElement {
1076
1205
  private addNewMarker;
1077
1206
  private markerCreated;
1078
1207
  private markerStateChanged;
1208
+ deleteMarker(markerEditor: MarkerBaseEditor): void;
1209
+ deleteSelectedMarkers(): void;
1079
1210
  setCurrentEditor(editor?: MarkerBaseEditor): void;
1211
+ selectEditor(editor: MarkerBaseEditor): void;
1212
+ deselectEditor(editor?: MarkerBaseEditor): void;
1080
1213
  private touchPoints;
1081
1214
  private isDragging;
1215
+ private isSelecting;
1216
+ private _marqueeSelectOutline;
1217
+ private _marqueeSelectRect;
1218
+ private _manipulationStartX;
1219
+ private _manipulationStartY;
1082
1220
  private onCanvasPointerDown;
1083
1221
  private onCanvasDblClick;
1084
1222
  private onPointerMove;
1085
1223
  private showOutline;
1086
1224
  private hideOutline;
1087
1225
  private onPointerUp;
1226
+ private finishMarqueeSelection;
1088
1227
  private onPointerOut;
1089
1228
  private onKeyUp;
1090
1229
  private attachEvents;
@@ -1211,13 +1350,14 @@ declare class RectangularBoxMarkerBaseEditor<TMarkerType extends RectangularBoxM
1211
1350
  * Container for the marker's editing controls.
1212
1351
  */
1213
1352
  protected controlBox: SVGGElement;
1353
+ protected manipulationBox: SVGGElement;
1214
1354
  private readonly CB_DISTANCE;
1215
1355
  private controlRect?;
1216
1356
  private rotatorGripLine?;
1217
1357
  private controlGrips;
1218
1358
  protected disabledResizeGrips: GripLocation[];
1219
1359
  private rotatorGrip?;
1220
- private activeGrip?;
1360
+ protected activeGrip?: Grip;
1221
1361
  private disableRotation;
1222
1362
  constructor(properties: MarkerEditorProperties<TMarkerType>);
1223
1363
  /**
@@ -1259,17 +1399,17 @@ declare class RectangularBoxMarkerBaseEditor<TMarkerType extends RectangularBoxM
1259
1399
  /**
1260
1400
  * Displays marker's controls.
1261
1401
  */
1262
- select(): void;
1402
+ select(multi?: boolean): void;
1263
1403
  /**
1264
1404
  * Hides marker's controls.
1265
1405
  */
1266
1406
  deselect(): void;
1267
1407
  private setupControlBox;
1268
1408
  protected adjustControlBox(): void;
1269
- private addControlGrips;
1409
+ protected addControlGrips(): void;
1270
1410
  private createRotateGrip;
1271
- private positionGrips;
1272
- private positionGrip;
1411
+ protected positionGrips(): void;
1412
+ protected positionGrip(grip: SVGGraphicsElement | undefined, x: number, y: number): void;
1273
1413
  /**
1274
1414
  * Hides marker's editing controls.
1275
1415
  */
@@ -1311,6 +1451,9 @@ declare class ShapeOutlineMarkerEditor<TMarkerType extends ShapeOutlineMarkerBas
1311
1451
  pointerUp(point: IPoint): void;
1312
1452
  }
1313
1453
 
1454
+ declare class ShapeMarkerEditor<TMarkerType extends ShapeMarkerBase = ShapeMarkerBase> extends ShapeOutlineMarkerEditor<TMarkerType> {
1455
+ }
1456
+
1314
1457
  declare class LinearMarkerEditor<TMarkerType extends LinearMarkerBase = LinearMarkerBase> extends MarkerBaseEditor<TMarkerType> {
1315
1458
  /**
1316
1459
  * Default line length when marker is created with a simple click (without dragging).
@@ -1329,6 +1472,7 @@ declare class LinearMarkerEditor<TMarkerType extends LinearMarkerBase = LinearMa
1329
1472
  * Container for control elements.
1330
1473
  */
1331
1474
  protected controlBox: SVGGElement;
1475
+ protected manipulationBox: SVGGElement;
1332
1476
  /**
1333
1477
  * First manipulation grip
1334
1478
  */
@@ -1401,7 +1545,7 @@ declare class LinearMarkerEditor<TMarkerType extends LinearMarkerBase = LinearMa
1401
1545
  /**
1402
1546
  * Displays marker's controls.
1403
1547
  */
1404
- select(): void;
1548
+ select(multi?: boolean): void;
1405
1549
  /**
1406
1550
  * Hides marker's controls.
1407
1551
  */
@@ -1422,6 +1566,7 @@ declare class PolygonMarkerEditor<TMarkerType extends PolygonMarker = PolygonMar
1422
1566
  * Container for control elements.
1423
1567
  */
1424
1568
  protected controlBox: SVGGElement;
1569
+ protected manipulationBox: SVGGElement;
1425
1570
  protected grips: ResizeGrip[];
1426
1571
  /**
1427
1572
  * Active manipulation grip.
@@ -1491,7 +1636,7 @@ declare class PolygonMarkerEditor<TMarkerType extends PolygonMarker = PolygonMar
1491
1636
  /**
1492
1637
  * Displays marker's controls.
1493
1638
  */
1494
- select(): void;
1639
+ select(multi?: boolean): void;
1495
1640
  /**
1496
1641
  * Hides marker's controls.
1497
1642
  */
@@ -1586,6 +1731,24 @@ declare class TextMarkerEditor<TMarkerType extends TextMarker = TextMarker> exte
1586
1731
  private markerSizeChanged;
1587
1732
  }
1588
1733
 
1734
+ declare class ArrowMarkerEditor<TMarkerType extends ArrowMarker = ArrowMarker> extends LinearMarkerEditor<TMarkerType> {
1735
+ set arrowType(value: ArrowType);
1736
+ get arrowType(): ArrowType;
1737
+ }
1738
+
1739
+ declare class CalloutMarkerEditor<TMarkerType extends CalloutMarker = CalloutMarker> extends TextMarkerEditor<TMarkerType> {
1740
+ private tipGrip?;
1741
+ private manipulationStartTipPositionX;
1742
+ private manipulationStartTipPositionY;
1743
+ constructor(properties: MarkerEditorProperties<TMarkerType>);
1744
+ protected addControlGrips(): void;
1745
+ private createTipGrip;
1746
+ protected positionGrips(): void;
1747
+ ownsTarget(el: EventTarget): boolean;
1748
+ pointerDown(point: IPoint, target?: EventTarget): void;
1749
+ protected resize(point: IPoint): void;
1750
+ }
1751
+
1589
1752
  interface MarkerViewEventMap {
1590
1753
  /**
1591
1754
  * Viewer initialized.
@@ -1725,4 +1888,4 @@ declare class Renderer {
1725
1888
  rasterize(state: AnnotationState, targetCanvas?: HTMLCanvasElement): Promise<string>;
1726
1889
  }
1727
1890
 
1728
- export { type AnnotationState, type ColorType, FrameMarker, FreehandMarker, FreehandMarkerEditor, type FreehandMarkerState, Grip, type IPoint, LinearMarkerBase, type LinearMarkerBaseState, LinearMarkerEditor, MarkerArea, type MarkerAreaEventData, type MarkerAreaEventMap, MarkerBase, MarkerBaseEditor, type MarkerBaseState, type MarkerEditorProperties, type MarkerEditorState, MarkerView, type MarkerViewEventData, type MarkerViewEventMap, PolygonMarker, PolygonMarkerEditor, type PolygonMarkerState, RectangularBoxMarkerBase, type RectangularBoxMarkerBaseState, Renderer, ResizeGrip, RotateGrip, ShapeOutlineMarkerBase, type ShapeOutlineMarkerBaseState, ShapeOutlineMarkerEditor, SvgHelper, TextMarker, TextMarkerEditor, type TextMarkerState };
1891
+ export { type AnnotationState, ArrowMarker, ArrowMarkerEditor, type ArrowMarkerState, type ArrowType, CalloutMarker, CalloutMarkerEditor, type CalloutMarkerState, type ColorType, CoverMarker, 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 };