Taggd.Tag

new Tag(position, text, [buttonAttributes], [popupAttributes])

Create a new Tag instance

ParamTypeDefaultDescription
positionObjectThe tag’s coordinates
textString | functionThe tag’s content
[buttonAttributes]Object{}The button’s attributes
[popupAttributes]Object{}The popup’s attributes

tag.on(eventName, handler)

Subscribe to an event.

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

ParamTypeDescription
eventNameStringThe event to subscribe to.
handlerfunctionThe handler to execute.

tag.off(eventName, handler)

Unsubscribe from an event.

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

ParamTypeDescription
eventNameStringThe event to unsubscribe from.
handlerfunctionThe handler that was used to subscribe.

tag.once(eventName, handler)

Subscribe to an event and unsubscribe once triggered.

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

ParamTypeDescription
eventNameStringThe event to subscribe to.
handlerfunctionThe handler to execute.

tag.isHidden()

Test whether the tag is hidden or not

Kind: instance method of Tag
Returns: Boolean - A boolean indicating the tag’s state

tag.show()

Show the tag

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

tag.hide()

Hide the tag

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

tag.setText(text)

Set the tag’s text

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

ParamTypeDescription
textString | functionThe tag’s content

tag.setPosition(x, y)

Set the tag’s position

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

ParamTypeDescription
xNumberThe tag’s x-coordinate
yNumberThe tag’s y-coordinate

tag.setButtonAttributes(atttributes)

Set the tag button’s attributes

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

ParamTypeDescription
atttributesObject= {} - The attributes to set

tag.setPopupAttributes(atttributes)

Set the tag popup’s attributes

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

ParamTypeDescription
atttributesObject= {} - The attributes to set

tag.enableEditorMode()

Enable editor mode

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

tag.disableEditorMode()

Disable editor mode

Kind: instance method of Tag
Returns: Taggd.Tag - Current Taggd.Tag instance

tag.toJSON()

Get a Taggd.createFromObject-compatible object

Kind: instance method of Tag
Returns: Object - A object for JSON

Tag.setElementAttributes(element, [attributes])

Set element attributes

Kind: static method of Tag
Returns: DomNode - The original element

ParamTypeDefaultDescription
elementDomNodeThe element the attributes should be set to
[attributes]Object{}A map of attributes to set

Tag.getPositionStyle(x, y)

Get the position style

Kind: static method of Tag
Returns: Object - The style

ParamTypeDescription
xNumberThe tag’s x-coordinate
yNumberThe tag’s y-coordinate

Tag.createFromObject(object)

Create a tag from object

Kind: static method of Tag
Returns: Tag - The created Tag instance

ParamTypeDescription
objectObjectThe object containing all information