forked from 0x2620/oxjs
hide marker tooltip when map center changes; when hiding a tooltip, don't remove but detach it, so that when it is shown again, its oxid is still present on its dom element
This commit is contained in:
parent
bf9f14cf03
commit
9a33041ac4
3 changed files with 22 additions and 13 deletions
|
|
@ -187,7 +187,10 @@ Ox.MapMarker = function(options) {
|
|||
var offset = that.map.offset(),
|
||||
xy = that.map.overlayView.getProjection()
|
||||
.fromLatLngToContainerPixel(e.latLng);
|
||||
that.tooltip.show(offset.left + xy.x - 4, offset.top + xy.y + 20);
|
||||
that.tooltip.show(
|
||||
offset.left + Math.round(xy.x) - 4,
|
||||
offset.top + Math.round(xy.y) + 20
|
||||
);
|
||||
}
|
||||
|
||||
function mouseout() {
|
||||
|
|
@ -234,15 +237,17 @@ Ox.MapMarker = function(options) {
|
|||
|
||||
function setTooltip() {
|
||||
var country = Ox.getCountryByGeoname(that.place.geoname);
|
||||
that.tooltip && that.tooltip.remove();
|
||||
that.tooltip = Ox.Tooltip({
|
||||
title: '<img src="'
|
||||
+ Ox.getImageByGeoname('icon', 16, that.place.geoname)
|
||||
+ '" style="float: left; margin: 1px 0 1px -1px; border-radius: 4px"/>'
|
||||
+ '<div style="float: left; margin: 4px -1px 0 4px; font-size: 9px;">'
|
||||
+ that.place.name
|
||||
+ (country && country.name != that.place.name ? ', ' + country.name : '')
|
||||
+ '</div>'
|
||||
});
|
||||
title: '<img src="'
|
||||
+ Ox.getImageByGeoname('icon', 16, that.place.geoname)
|
||||
+ '" style="float: left; margin: 1px 0 1px -1px; border-radius: 4px"/>'
|
||||
+ '<div style="float: left; margin: 4px -1px 0 4px; font-size: 9px;">'
|
||||
+ that.place.name
|
||||
+ (country && country.name != that.place.name ? ', ' + country.name : '')
|
||||
+ '</div>'
|
||||
})
|
||||
.addClass('OxMapMarkerTooltip');
|
||||
}
|
||||
|
||||
/*@
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue