Class GSBadge
A numerical overlay for point features.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
GSBadge(feature, count, options)
Creates a new
GSBadge instance. |
| Method Attributes | Method Name and Description |
|---|---|
|
addEventListener(eventType, func, scope)
Registers the given function as a handler for DOM events of the specified
type occurring on the component's target element.
|
|
|
removeEventListener(token)
Removes the event listener function represented by the
token parameter
from this feature |
|
|
Removes all registered event listeners from the component's target element
|
|
|
setCount(count, options)
Sets the badge count
|
|
|
setVisible(value)
Sets the visibility of this badge
|
|
|
setZIndex(zIndex)
Sets the z-index property of this badge
|
Class Detail
GSBadge(feature, count, options)
Creates a new
GSBadge instance.
- Parameters:
- {GSPointFeature} feature
- the owning feature for this badge
- {int} count
- the count to be displayed as the badge text
- {Object} options Optional
- an object literal specifying the badge options to set:
- {String} options.color
- the color to use for the badge background. This can be one of
red,green,blue(default) - {int} options.offsetTop
- the distance in pixels that the bottom edge of the badge should be offset from top of the feature icon, defaults to -15
- {int} options.offsetRight
- the distance in pixels that the left edge of the badge should be offset from the right of the feature icon, defaults to -10
- {String} options.cursor
- the cursor type to use for the badge
- Throws:
- {Error}
- if
countis a non-numerical value
Method Detail
{Object}
addEventListener(eventType, func, scope)
Registers the given function as a handler for DOM events of the specified
type occurring on the component's target element. This function returns a token
that can be passed to the #removeEventListener to remove the event
listener. If the
scope argument is not passed the function will execute in the context
of this object
- Parameters:
- {String} eventType
- the event type to add the listener for. Can be one of:
click, mousedown, mouseup, mouseover, mouseout - {Function} func
- The function to invoke when the event is triggered
- {Object} scope Optional
- the scope (
thisreference) in which the function is executed
- Throws:
- {Error}
- if this component does not define a reference to its DOM element
- Returns:
- {Object} a token that can be passed to the GSEventManager#removeEventListener to remove the event listener.
removeEventListener(token)
Removes the event listener function represented by the
token parameter
from this feature
- Parameters:
- {Object} token
- a token identifying the event handler to be removed
removeEventListeners()
Removes all registered event listeners from the component's target element
setCount(count, options)
Sets the badge count
- Parameters:
- {int} count
- the new count to display in the badge
- {Object} options Optional
- an object literal specifying the badge options to set:
- {String} options.color
- the color to use for the badge background. This can be one of 'red', 'green', 'blue' (default)
- {int} options.offsetTop
- the distance in pixels that the bottom edge of the badge should be offset from top of the feature icon, defaults to -15
- {int} options.offsetRight
- the distance in pixels that the left edge of the badge should be offset from the right of the feature icon, defaults to -10
- {String} options.cursor
- the cursor type to use for the badge
setVisible(value)
Sets the visibility of this badge
- Parameters:
- {boolean} value
trueif this badge should be visible on the map
setZIndex(zIndex)
Sets the z-index property of this badge
- Parameters:
- {int} zIndex
- the zIndex to use for this feature