1.4.1 • Published 13 days ago

@architrixs/ngx-annotation v1.4.1

Weekly downloads
-
License
-
Repository
-
Last release
13 days ago

NgxAnnotation

An Angular Wrapper Library for @recogito/annotorious and @recogito/annotorious-openseadragon with some extra features.

This library was generated with Angular CLI version 12.2.0.

Library Components

The library contains the following components:

  • lib-annotation (for Standard version API)
  • lib-annotation-openseadragon (for OpenSeadragon plugin API)

Input properties:

For the standard version API:

PropertyTypeDefaultDescription
imageIdstring-The id of the image to annotate.
disableEditorbooleantrueWhether to disable the editor.
drawOnSingleClickbooleantrueWhether to draw on single click.
readOnlybooleanfalseDisplay annotations in read-only mode.
allowEmptybooleanfalseWhether to allow empty annotations.
crosshairbooleantrueWhether to show the crosshair.
tagValuestring'tag'The value of the tag.
strokeColourstring#ff0000 #ff0000The colour of the stroke.
strokeWidthstring'2'The width of the stroke.
colorLabelsbooleantrueWhether to color the labels.
startArrowbooleantrueWhether to show the start/up arrow.
endArrowbooleantrueWhether to show the end/down arrow.
toolbarIdstring'toolbar'The id of the toolbar.
extraDrawingToolsstring array[]The extra drawing tools.

For the OpenSeadragon plugin API:

PropertyTypeDefaultDescription
viewerIdstring'seadragon-viewer'The dom id of the osd viewer.
toolbarIdstring-The id of the dom element where toolbar should be placed. By default it is placed on top left of the viewer.
imagePathstring-The path to the image.
OsdOptionsobject-The options for the osd viewer. Osd Provides many configuration settings. Ex:OsdOPtions = { id: this.viewerId, tileSources: { type: "image", url: this.imagePath, } maxZoomLevel: 20, minZoomLevel: 1, panHorizontal: true, panVertical: true, constrainDuringPan: false }
showNavigationControlbooleantrueWhether to show the navigation control.
disableEditorbooleantrueWhether to disable the editor.
panobject{panHorizontal:false, panVertical:false}The pan settings for the osd viewer. Ex:pan="{panHorizontal:false, panVertical:false}"
zoomobject{minZoomLevel: 0, maxZoomLevel: 20}The zoom settings for the osd viewer. Ex. For No zooming:zoom="{minZoomLevel: 1, maxZoomLevel: 1}"
drawOnSingleClickbooleantrueWhether to draw on single click.
readOnlybooleanfalseDisplay annotations in read-only mode.
allowEmptybooleanfalseWhether to allow empty annotations.
crosshairbooleanfalseWhether to show the crosshair.
clickToZoombooleanfalseWhether to click to zoom.
extraDrawingToolsstring array[]The extra drawing tools.
tagValuestring'tag'The value of the tag.
strokeColourstring#ff0000 #ff0000The colour of the stroke.
strokeWidthstring'2'The width of the stroke.
groupstring-The group annotation belongs to
colorLabelsbooleantrueWhether to color the labels.
ContinousDrawbooleanfalseWhether to draw continuously.
activeToolstring'rect'The active drawing tool. From: 'rect', 'polygon', 'line', 'polyline', etc.
startArrowbooleanfalseWhether to show the start/up arrow.
endArrowbooleanfalseWhether to show the end/down arrow.
canvasNonPrimaryPressbooleanfalseWhether to attach canvas-nonprimary-release handler for rightMouseClick event

Output callback Events:

CallbackDescription
AnnotationThe callback for getting Instance of Annotation after Initialization.
createdAnnotationThe callback that is called when an annotation is created.
clickedAnnotationThe callback that is called when an annotation is clicked.
cancelSelectedThe callback that is called when the ESC button or outside region is clicked on active selection.
mouseEnterThe callback that is called when the mouse enters the region.
mouseLeaveThe callback that is called when the mouse leaves the region.
updateAnnotationThe callback that is called when an annotation is updated.
deleteAnnotationThe callback that is called when an annotation is deleted using Delete Key
rightMouseClickThe callback that is called when right mouse click is performed on the Osd Canvas

Example:

<div id="toolbar"></div>
  <span style="display: block;"><button id="button" (click)="selectLineTool()">Line</button></span>
  <img style="height:calc(100vh - 230px);width:100%;border: 1px solid" id="hallstatt" src="../assets/1024px-Hallstatt.jpg">

  <lib-annotation [imageId]="hallstatt" 
                  [disableEditor]="isdisableEditor"
                  [drawOnSingleClick]="isdrawOnSingleClick"
                  [readOnly]="false"
                  [allowEmpty]="true"
                  [crosshair]="true"
                  [tagValue]="tagValue"
                  [strokeColour]="strokeColour"
                  [strokeWidth]="strokeWidth"
                  [colorLabels]="false"
                  (createdAnnotation)="GetCreated($event)"
                  [startArrow]="startArrow"
                  [endArrow]="endArrow"
                  (cancelSelected)="GetCancel($event)"
                  (Annotation)="GetInstance($event)"
                  (mouseEnter)="GetMouseEnter($event)"
                  (mouseLeave)="GetMouseLeave($event)"
                  (updateAnnotation)="GetUpdate($event)"
                  [toolbarId]="toolbarId"
                  [extraDrawingTools]="extraDrawingTools">
  </lib-annotation>
<div id="toolbarDiv"></div>
  <span style="display: block;"><button id="button" (click)="selectLineTool()">Line</button></span>
  <div id="seadragon-viewer" style="height:calc(100vh - 230px);width:60%;border: 1px solid"></div>
  <lib-annotation-openseadragon [viewerId]="seadragon-viewer"
                                [toolbarId]="'toolbarDiv'"
                                [imagePath]="'../assets/1024px-Hallstatt.jpg'"
                                [disableEditor]="isdisableEditor"
                                [pan]="{panHorizontal:true, panVertical:true}"
                                [drawOnSingleClick]="isdrawOnSingleClick"
                                [readOnly]="false"
                                [allowEmpty]="false"
                                [crosshair]="true"
                                [clickToZoom]="false"
                                [extraDrawingTools]="extraDrawingTools"
                                [tagValue]="tagValue"
                                [strokeColour]="strokeColour"
                                [strokeWidth]="strokeWidth"
                                [colorLabels]="colorLabels"
                                [ContinousDraw]="ContinousDraw"
                                [activeTool]="currentDrawingTool"
                                [startArrow]="startArrow"
                                [endArrow]="endArrow"
                                (createdAnnotation)="GetCreated($event)"
                                (clickedAnnotation)="GetClicked($event)"
                                (cancelSelected)="GetCancel($event)"
                                (Annotation)="GetInstance($event)"
                                (OsdViewer)="GetOsdViewer($event)"
                                (mouseEnter)="GetMouseEnter($event)"
                                (mouseLeave)="GetMouseLeave($event)"
                                (updateAnnotation)="GetUpdate($event)"
  ></lib-annotation-openseadragon>

Change Image in Viewer:

GetOsdViewer(event: any) {
    this.osdViewer = event;
}
changeImage() {
  var newImage = {
        type: 'image',
        url: this.snapshot
      }
  this.osdViewer.open(newImage);
}

For further functionality, please refer to the recogito documentation and openSeadragon documentation.

Code scaffolding

Run ng generate component component-name --project ngx-Annotation to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-Annotation.

Note: Don't forget to add --project ngx-Annotation or else it will be added to the default project in your angular.json file.

Build

Run ng build ngx-Annotation to build the project. The build artifacts will be stored in the dist/ directory.

Publishing

After building your library with ng build ngx-Annotation, go to the dist folder cd dist/ngx-annotation and run npm publish.

1.4.1

13 days ago

1.4.0

1 month ago

1.3.7

7 months ago

1.2.8

8 months ago

1.3.6

8 months ago

1.2.7

8 months ago

1.3.5

8 months ago

1.2.6

10 months ago

1.3.4

8 months ago

1.3.3

8 months ago

1.3.2

8 months ago

1.3.1

8 months ago

1.3.0

8 months ago

1.2.9

8 months ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago