Make icon size optional
This commit is contained in:
+14
-3
@@ -5,12 +5,23 @@ goog.require('ol.style.Image');
|
||||
|
||||
/**
|
||||
* @param {string} src Image source URI.
|
||||
* @param {ol.Size} size Image size.
|
||||
* @param {ol.Size=} opt_size Image size.
|
||||
* @return {ol.style.Image} Image.
|
||||
*/
|
||||
ol.icon.renderIcon = function(src, size) {
|
||||
ol.icon.renderIcon = function(src, opt_size) {
|
||||
|
||||
/**
|
||||
* @type {ol.Size}
|
||||
*/
|
||||
var size = goog.isDef(opt_size) ? opt_size : null;
|
||||
|
||||
/**
|
||||
* @type {ol.Pixel}
|
||||
*/
|
||||
var anchor = !goog.isNull(size) ? [size[0] / 2, size[1] / 2] : null;
|
||||
|
||||
return new ol.style.Image({
|
||||
anchor: [size[0] / 2, size[1] / 2],
|
||||
anchor: anchor,
|
||||
size: size,
|
||||
src: src,
|
||||
rotation: 0,
|
||||
|
||||
Reference in New Issue
Block a user