Class DrawingItem
| Name | Description |
|---|---|
| drawingLayerId | Returns the id of a DrawingLayer where the DrawingItem is drawn. |
| mediaType | Returns the mediaType of the DrawingItem. |
| coordinateBase | Sets or returns the coordinateBase which determines the meaning of the coordinates of the DrawingItem. |
| drawingStyleId | Sets or returns the id of the DrawingStyle that applies to the DrawingItem. |
| getState() | Returns the state of the DrawingItem. |
| on() | Adds an event listener to the DrawingItem for the event specified by eventName. |
| off() | Removes an event listener to the DrawingItem for the event specified by eventName. |
| addNote() | Adds a Note to this DrawingItem. |
| getNote() | Returns a Note specified by its name. |
| hasNote() | Returns whether a Note with the specified name exists on this DrawingItem. |
| updateNote() | Updates the content of a Note specified by its name. |
| deleteNote() | Deletes a Note specified by its name. |
| getAllNotes() | Returns all Notes on the DrawingItem. |
| clearNotes() | Deletes all Notes on the DrawingItem. |
Child classes based on DrawingItem:
Class LineDrawingItem
| Name | Description |
|---|---|
| LineDrawingItem() | Constructor of a LineDrawingItem. |
| getLine() | Returns the LineSegment object the item is based on. |
| setLine() | Specifies a LineSegment object to be used for drawing the line. |
Class RectDrawingItem
| Name | Description |
|---|---|
| RectDrawingItem() | Constructor of a RectDrawingItem. |
| getRect() | Returns the Rect object the item is based on. |
| setRect() | Specifies a Rect object to be used for drawing the item. |
Class QuadDrawingItem
| Name | Description |
|---|---|
| QuadDrawingItem() | Constructor of a QuadDrawingItem. |
| getQuad() | Returns the Quadrilateral object the item is based on. |
| setQuad() | Specifies a Quadrilateral object to be used for drawing the item. |
Class TextDrawingItem
| Name | Description |
|---|---|
| TextDrawingItem() | Constructor of a TextDrawingItem. |
| getText() | Returns the text drawn. |
| setText() | Specifies the text to draw. |
| getTextRect() | Returns the Rect object which determines where the text is drawn. |
| setTextRect() | Specifies a Rect object in which the text is drawn. |
Class ImageDrawingItem
| Name | Description |
|---|---|
| ImageDrawingItem() | Constructor of an ImageDrawingItem. |
| getImage() | Returns the image drawn. |
| setImage() | Specifies the image to draw. |
| getImageRect() | Returns the Rect object which determines where the image is drawn. |
| setImageRect() | Specifies a Rect object in which the image is drawn. |
drawingLayerId
Returns the id of a DrawingLayer where the DrawingItem is drawn.
readonly drawingLayerId: number;
mediaType
Returns the mediaType of the DrawingItem.
readonly mediaType: EnumDrawingItemMediaType;
coordinateBase
Returns the coordinateBase which determines the meaning of the coordinates of the DrawingItem.
coordinateBase: string;
drawingStyleId
Sets or returns the id of the DrawingStyle that applies to the DrawingItem.
drawingStyleId?: number;
getState
Returns the state of the DrawingItem.
getState(): EnumDrawingItemState;
Return Value
A value of type EnumDrawingItemState.
See also
on
Adds an event listener to the DrawingItem for the event specified by eventName.
on(eventName: string, listener(event: DrawingItemEvent): void): void;
Parameters
eventName: The name of the event you want to listen to.
listener(): A function that will be called when the specified event occurs.
Allowed events are:
mousedown,mouseup,dblclick,mouseoverandmouseout.
See also
off
Removes an event listener to the DrawingItem for the event specified by eventName.
off(eventName: string, listener(event: DrawingItemEvent): void): void;
Parameters
eventName: The name of the event you want to listen to.
listener(): A function that will be called when the specified event occurs.
See also
addNote
Adds a Note to this DrawingItem.
addNote(note: Note, replace?: boolean): void;
Parameters
note: Expects an object that implements the Note interface.
replace(optional): Determines whether to replace the Note if the name of the Note already exists.
See also
getNote
Returns a Note specified by its name.
getNote(name: string): Note;
Parameters
name: The expects string representing the name of the note.
Return Value
The corresponding Note object based on the provided name.
hasNote
Returns whether a Note with the specified name exists on this DrawingItem.
hasNote(name: string): boolean;
Parameters
name: The expects string representing the name of the note.
Return Value
A value of boolean indicates whether a specific note exists with the given name.
updateNote
Updates the content of a Note specified by its name.
updateNote(name: string, content: any, mergeContent?: boolean): void;
Parameters
name: The string representing the name of the note.
content: The content of the note.
mergeContent(optional): If this parameter is set to true, then the new content is added to the Note alongside the original content.
deleteNote
Deletes a Note specified by its name.
deleteNote(name: string): void;
Parameters
name: The string representing the name of the note.
getAllNotes
Returns all Notes on the DrawingItem.
getAllNotes(): Array<Note>;
Return Value
Returns an array of all Notes on the DrawingItem.
clearNotes
Deletes all Notes on the DrawingItem.
clearNotes(): void;
LineDrawingItem
Constructor of a LineDrawingItem.
constructor(line: LineSegment, drawingStyleId?: number);
See also
getLine
Returns the LineSegment object the item is based on.
getLine(): LineSegment;
Return Value
Returns the line of type LineSegment.
setLine
Specifies a LineSegment object to be used for drawing the line.
setLine(line: LineSegment): void;
Parameters
line: A line of type LineSegment.
RectDrawingItem
Constructor of a RectDrawingItem.
constructor(rect: Rect, drawingStyleId?: number);
See also
getRect
Returns the Rect object the item is based on.
getRect(): Rect;
Return Value
Returns the rectangle of type Rect.
setRect
Specifies a Rect object to be used for drawing the item.
setRect(rect: Rect): void;
Parameters
rect: A rectangle of type Rect.
QuadDrawingItem
Constructor of a QuadDrawingItem.
constructor(quad: Quadrilateral, drawingStyleId?: number);
See also
getQuad
Returns the Quadrilateral object the item is based on.
getQuad(): Quadrilateral;
Return Value
Returns the rectangle of type Quadrilateral.
setQuad
Specifies a Quadrilateral object to be used for drawing the item.
setQuad(quad: Quadrilateral): void;
Parameters
quad: A quadrilateral of type Quadrilateral.
TextDrawingItem
Constructor of a TextDrawingItem.
constructor(text: string, rect: Rect, drawingStyleId?: number);
getText
Returns the text drawn.
getText(): string;
Return Value
Returns the text of type string.
setText
Specifies the text to draw.
setText(text: string): void;
Parameters
text: A text string.
getTextRect
Returns the Rect object which determines where the text is drawn.
getTextRect(): Rect;
Return Value
Returns the rectangle of type Rect.
setTextRect
Specifies a Rect object in which the text is drawn.
setTextRect(rect: Rect): void;
Parameters
rect: A rectangle of type Rect.
ImageDrawingItem()
Constructor of an ImageDrawingItem.
constructor(
image: DSImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement,
rect: Rect,
drawingStyleId?: number);
Parameters
image: The image data.
rect: Outer rectangle border of the image.
drawingStyleId(optional): Specifies the DrawingStyle that applies to this ImageDrawingItem.
See also
getImage
Returns the image drawn.
getImage(): DSImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
setImage
Specifies the image to draw.
setImage(image: DSImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
getImageRect
Returns the Rect object which determines where the image is drawn.
getImageRect(): Rect;
Return Value
Returns the image located rectangle of type Rect.
setImageRect
Specifies a Rect object in which the image is drawn.
setImageRect(rect: Rect): void;
Parameters
rect: A rectangle of type Rect.