git-svn-id: http://svn.openlayers.org/trunk/openlayers@129 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
48 lines
1010 B
JavaScript
48 lines
1010 B
JavaScript
/**
|
|
* @class
|
|
*/
|
|
OpenLayers.Icon = Class.create();
|
|
OpenLayers.Icon.prototype = {
|
|
|
|
/** image url
|
|
* @type String */
|
|
url: null,
|
|
|
|
/** @type OpenLayers.Size */
|
|
size:null,
|
|
|
|
/** distance in pixels to offset the image when being rendered
|
|
* @type OpenLayers.Pixel */
|
|
offset: null,
|
|
|
|
/**
|
|
* @constructor
|
|
*
|
|
* @param {String} url
|
|
* @param {OpenLayers.Size} size
|
|
* @param {OpenLayers.Pixel} offset
|
|
*/
|
|
initialize: function(url, size, offset) {
|
|
this.size = size;
|
|
this.url = url;
|
|
|
|
this.offset = offset;
|
|
if (offset == null) {
|
|
// default offset
|
|
this.offset = new OpenLayers.Pixel(-(size.w / 2), -size.h);
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
* @returns A fresh copy of the icon.
|
|
* @type OpenLayers.Icon
|
|
*/
|
|
clone: function() {
|
|
return new OpenLayers.Icon(this.size, this.url, this.offset);
|
|
},
|
|
|
|
/** @final @type String */
|
|
CLASS_NAME: "OpenLayers.Icon"
|
|
}
|