20 lines
646 B
Plaintext
20 lines
646 B
Plaintext
JQVMap.prototype.positionPins = function(){
|
|
var map = this;
|
|
var pins = this.container.find('.jqvmap-pin');
|
|
jQuery.each(pins, function(index, pinObj){
|
|
pinObj = jQuery(pinObj);
|
|
var countryId = map.getCountryId(pinObj.attr('for').toLowerCase());
|
|
var countryObj = jQuery('#' + countryId);
|
|
|
|
var bbox = document.getElementById(countryId).getBBox();
|
|
var position = countryObj.position();
|
|
|
|
var scale = map.scale;
|
|
|
|
var left = position.left + (bbox.width / 2) * scale - pinObj.width() / 2,
|
|
top = position.top + (bbox.height / 2) * scale - pinObj.height() / 2;
|
|
|
|
pinObj.css('left', left).css('top', top);
|
|
});
|
|
};
|