The icon represents a graphical icon on the screen. Typically used in conjunction with a ALKMaps.Marker to represent markers on a screen.
An icon has a url, size and position. It also contains an offset which allows the center point to be represented correctly. This can be provided either as a fixed offset or a function provided to calculate the desired offset.
ALKMaps.Icon | The icon represents a graphical icon on the screen. |
Properties | |
url | {String} image url |
size | {<ALKMaps.Size>|Object} An ALKMaps.Size or an object with a ‘w’ and ‘h’ properties. |
offset | {<ALKMaps.Pixel>|Object} distance in pixels to offset the image when being rendered. |
calculateOffset | {Function} Function to calculate the offset (based on the size) |
imageDiv | {DOMElement} |
px | {<ALKMaps.Pixel>|Object} An ALKMaps.Pixel or an object with a ‘x’ and ‘y’ properties. |
Constructor | |
ALKMaps.Icon | Creates an icon, which is an image tag in a div. |
Functions | |
destroy | Nullify references and remove event listeners to prevent circular references and memory leaks |
clone | {ALKMaps.Icon} A fresh copy of the icon. |
setSize | |
setUrl | |
draw | Move the div to the given pixel. |
erase | Erase the underlying image element. |
setOpacity | Change the icon’s opacity |
moveTo | move icon to passed in px. |
display | Hide or show the icon |
isDrawn | {Boolean} Whether or not the icon is drawn. |
Nullify references and remove event listeners to prevent circular references and memory leaks
destroy: function()
{ALKMaps.Icon} A fresh copy of the icon.
clone: function()
setSize: function( size )
setUrl: function( url )
Move the div to the given pixel.
draw: function( px )
Erase the underlying image element.
erase: function()
Change the icon’s opacity
setOpacity: function( opacity )
move icon to passed in px.
moveTo: function ( px )
Hide or show the icon
display: function( display )
{Boolean} Whether or not the icon is drawn.
isDrawn: function()