@markerjs/markerjs3 3.0.0-rc.4 → 3.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 CHANGED
@@ -1,9 +1,5 @@
1
1
  # marker.js 3 — Add image annotation to your web apps
2
2
 
3
- > **Note**: marker.js 3 is in the pre-release stage of its lifecycle and will have many additions and, potentially, breaking changes before the official 3.0 release.
4
- >
5
- > If you need a stable image annotation library, consider using [marker.js 2](https://markerjs.com) for now.
6
-
7
3
  marker.js 3 is a JavaScript browser library to enable image annotation in your web applications. Add marker.js 3 to your web app and enable users to annotate and mark up images. You can save, share or otherwise process the results.
8
4
 
9
5
  ## Installation
@@ -12,15 +8,11 @@ marker.js 3 is a JavaScript browser library to enable image annotation in your w
12
8
  npm install @markerjs/markerjs3
13
9
  ```
14
10
 
15
- or
16
-
17
- ```
18
- yarn add @markerjs/markerjs3
19
- ```
11
+ The library includes TypeScript type definitions out of the box.
20
12
 
21
13
  ## Usage
22
14
 
23
- Unlike the previous version, marker.js 3 is a "headless" (sort of) library. In this case "headless" means that it doesn't come with any toolbars, property editors, and placement preconceptions. This way the library focuses on the core features you need, and you can make it feel totally native in the application you are building without resorting to any tricks or hacks.
15
+ marker.js 3 is a "headless" library. In this case "headless" means that it doesn't come with any toolbars, property editors, and placement preconceptions. This way the library focuses on the core features you need, and you can make it feel totally native in the application you are building without resorting to any tricks or hacks.
24
16
 
25
17
  With that out of the way, here are the simplest usage scenarios...
26
18
 
@@ -50,15 +42,15 @@ editorContainerDiv.appendChild(markerArea);
50
42
  To initiate creation of a marker you just call `createMarker()` and pass it the name (or type) of the marker you want to create. So, if you have a button with id `addFrameButton` you can make it create a new `FrameMarker` with something like this:
51
43
 
52
44
  ```js
53
- document.querySelector("#addButton")!.addEventListener("click", () => {
54
- markerArea.createMarker("FrameMarker");
45
+ document.querySelector('#addButton')?.addEventListener('click', () => {
46
+ markerArea.createMarker('FrameMarker');
55
47
  });
56
48
  ```
57
49
 
58
50
  And whenever you want to save state (current annotation) you just call `getState()`:
59
51
 
60
52
  ```js
61
- document.querySelector("#saveStateButton")!.addEventListener("click", () => {
53
+ document.querySelector('#saveStateButton')?.addEventListener('click', () => {
62
54
  const state = markerArea.getState();
63
55
  console.log(state);
64
56
  });
@@ -101,15 +93,11 @@ markerView.show(savedState);
101
93
 
102
94
  ## Demos
103
95
 
104
- Check out the "work-in-progress" demo [here](https://github.com/ailon/markerjs3-wip-demo). It covers most of the available features with no extra bells or whistles.
105
-
106
- While it's made with React it is purposefully light on React-specific stuff and "best practices" to just focus on marker.js 3 related things.
107
-
108
- _more demos coming soon..._
96
+ Check out the [demos on markerjs.com](https://markerjs.com/demos).
109
97
 
110
98
  ## More docs and tutorials
111
99
 
112
- _coming soon..._
100
+ You can find marker.js 3 reference and tutorials [here](https://markerjs.com/docs-v3/).
113
101
 
114
102
  ## License
115
103
 
package/markerjs3.d.ts CHANGED
@@ -703,6 +703,18 @@ declare class LinearMarkerBase extends MarkerBase {
703
703
  * Visible visual of the marker.
704
704
  */
705
705
  protected visibleVisual: SVGGraphicsElement | undefined;
706
+ /**
707
+ * Line visual of the marker.
708
+ */
709
+ protected lineVisual: SVGGraphicsElement | undefined;
710
+ /**
711
+ * Start terminator (ending) visual of the marker.
712
+ */
713
+ protected startTerminatorVisual: SVGGraphicsElement | undefined;
714
+ /**
715
+ * End terminator (ending) visual of the marker.
716
+ */
717
+ protected endTerminatorVisual: SVGGraphicsElement | undefined;
706
718
  protected applyStrokeColor(): void;
707
719
  protected applyStrokeWidth(): void;
708
720
  protected applyStrokeDasharray(): void;
@@ -710,13 +722,23 @@ declare class LinearMarkerBase extends MarkerBase {
710
722
  constructor(container: SVGGElement);
711
723
  ownsTarget(el: EventTarget): boolean;
712
724
  /**
713
- * The path representing the marker visual.
725
+ * The path representing the line part of the marker visual.
714
726
  *
715
727
  * When implemented in derived class should return SVG path for the marker.
716
728
  *
717
729
  * @returns SVG path for the marker.
718
730
  */
719
731
  protected getPath(): string;
732
+ /**
733
+ * The path representing the start terminator (ending) part of the marker visual.
734
+ * @returns SVG path
735
+ */
736
+ protected getStartTerminatorPath(): string;
737
+ /**
738
+ * The path representing the end terminator (ending) part of the marker visual.
739
+ * @returns SVG path
740
+ */
741
+ protected getEndTerminatorPath(): string;
720
742
  /**
721
743
  * Creates marker's visual.
722
744
  */
@@ -775,7 +797,9 @@ declare class ArrowMarker extends LineMarker {
775
797
  get arrowType(): ArrowType;
776
798
  set arrowType(value: ArrowType);
777
799
  constructor(container: SVGGElement);
778
- protected getPath(): string;
800
+ private getArrowProperties;
801
+ protected getStartTerminatorPath(): string;
802
+ protected getEndTerminatorPath(): string;
779
803
  protected applyStrokeWidth(): void;
780
804
  getState(): ArrowMarkerState;
781
805
  restoreState(state: MarkerBaseState): void;
@@ -793,7 +817,9 @@ declare class MeasurementMarker extends LineMarker {
793
817
  static typeName: string;
794
818
  static title: string;
795
819
  constructor(container: SVGGElement);
796
- protected getPath(): string;
820
+ protected getStartTerminatorPath(): string;
821
+ protected getEndTerminatorPath(): string;
822
+ private getTerminatorProperties;
797
823
  protected applyStrokeWidth(): void;
798
824
  }
799
825
 
@@ -1706,6 +1732,14 @@ declare class MarkerBaseEditor<TMarkerType extends MarkerBase = MarkerBase> {
1706
1732
  * Gets marker's opacity.
1707
1733
  */
1708
1734
  get opacity(): number;
1735
+ /**
1736
+ * Sets marker's notes.
1737
+ */
1738
+ set notes(value: string | undefined);
1739
+ /**
1740
+ * Gets marker's notes.
1741
+ */
1742
+ get notes(): string | undefined;
1709
1743
  /**
1710
1744
  * Creates a new instance of marker editor.
1711
1745
  *
@@ -3048,4 +3082,4 @@ declare class Renderer {
3048
3082
  rasterize(state: AnnotationState, targetCanvas?: HTMLCanvasElement): Promise<string>;
3049
3083
  }
3050
3084
 
3051
- export { Activator, type AnnotationState, ArrowMarker, ArrowMarkerEditor, type ArrowMarkerState, type ArrowType, type BlurHandler, CalloutMarker, CalloutMarkerEditor, type CalloutMarkerState, CaptionFrameMarker, CaptionFrameMarkerEditor, type CaptionFrameMarkerState, CheckImageMarker, CoverMarker, CustomImageMarker, EllipseFrameMarker, EllipseMarker, type FontSize, FrameMarker, FreehandMarker, FreehandMarkerEditor, type FreehandMarkerState, Grip, type GripLocation, HighlightMarker, type IPoint, type ISize, type ITransformMatrix, ImageMarkerBase, type ImageMarkerBaseState, ImageMarkerEditor, type ImageType, LineMarker, LinearMarkerBase, type LinearMarkerBaseState, LinearMarkerEditor, MarkerArea, type MarkerAreaEventData, type MarkerAreaEventMap, type MarkerAreaMode, MarkerBase, MarkerBaseEditor, type MarkerBaseState, type MarkerCreationStyle, type MarkerEditorEventData, type MarkerEditorProperties, type MarkerEditorState, type MarkerStage, 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, TextBlock, TextBlockEditor, type TextChangedHandler, TextMarker, TextMarkerEditor, type TextMarkerState, XImageMarker };
3085
+ export { Activator, type AnnotationState, ArrowMarker, ArrowMarkerEditor, type ArrowMarkerState, type ArrowType, type BlurHandler, CalloutMarker, CalloutMarkerEditor, type CalloutMarkerState, CaptionFrameMarker, CaptionFrameMarkerEditor, type CaptionFrameMarkerState, CheckImageMarker, CoverMarker, CustomImageMarker, EllipseFrameMarker, EllipseMarker, type FontSize, FrameMarker, FreehandMarker, FreehandMarkerEditor, type FreehandMarkerState, Grip, type GripLocation, HighlightMarker, type IPoint, type ISize, type ITransformMatrix, ImageMarkerBase, type ImageMarkerBaseState, ImageMarkerEditor, type ImageType, LineMarker, LinearMarkerBase, type LinearMarkerBaseState, LinearMarkerEditor, MarkerArea, type MarkerAreaEventData, type MarkerAreaEventMap, type MarkerAreaMode, MarkerBase, MarkerBaseEditor, type MarkerBaseState, type MarkerCreationStyle, type MarkerEditorEventData, type MarkerEditorProperties, type MarkerEditorState, type MarkerEventData, type MarkerStage, 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, TextBlock, TextBlockEditor, type TextChangedHandler, TextMarker, TextMarkerEditor, type TextMarkerState, XImageMarker };