diff --git a/lib/OpenLayers/Layer/Text.js b/lib/OpenLayers/Layer/Text.js index 35239ff033..fada5b4883 100644 --- a/lib/OpenLayers/Layer/Text.js +++ b/lib/OpenLayers/Layer/Text.js @@ -73,10 +73,23 @@ OpenLayers.Layer.Text.prototype = } } if (set) { - var data = {}; - data['iconURL'] = url; - data['iconSize'] = iconSize; - data['iconOffset'] = iconOffset; + var data = new Object(); + + if (url != null) { + data.icon = new OpenLayers.Icon(url, + iconSize, + iconOffset); + } else { + data.icon = OpenLayers.Marker.defaultIcon(); + + //allows for the case where the image url is not + // specified but the size is. use a default icon + // but change the size + if (iconSize != null) { + data.icon.setSize(iconSize); + } + + } data['popupContentHTML'] = '
'+description+'
'; var feature = new OpenLayers.Feature(this, location, data); var marker = feature.createMarker();