【发布时间】:2017-01-30 19:40:39
【问题描述】:
我使用 BingMaps V8 API 创建了多个infoboxes。
我在这里面临的问题是当infobox 朝向地图的角落时,infobox 的细节被修剪。
正在修剪信息框。我想自动平移:
代码:
var ParseLatLogXml = function(xml, address){
if(typeof xml.resourceSets["0"].resources === "undefined" || xml.resourceSets["0"].resources.length === 0)
{
console.log("Lat Long of Address not found: " + address);
return [];
}
return [ xml.resourceSets["0"].resources["0"].geocodePoints["0"].coordinates["0"],
xml.resourceSets["0"].resources["0"].geocodePoints["0"].coordinates["1"] ];
};
var AddStore = function( storeNumb ,storeID, storeName, city, state, addr, phone, zip, distance, lat, long){
var _loc = new Microsoft.Maps.Location(parseFloat(lat), parseFloat(long));
var _pin = new Microsoft.Maps.Pushpin(_loc, {
icon: '-/media/1044109b112b479bb98e4daf6154e817.ashx',
anchor: new Microsoft.Maps.Point(20, 20)
}
);
var adder = addr + '\r\n' + city + '\r\n' + zip + state + "\r\n" + storeName
// Create the infobox for the pushpin
var _infoBox = new Microsoft.Maps.Infobox(_pin.getLocation(),
{ width: 300,
height: 150,
title: storeName,
description: distance + " miles" +'<br>' + addr +'<br>'+ city + " "+ zip +'<br>'+ phone ,
offset: new Microsoft.Maps.Point(10,15),
showCloseButton: false,
visible: false
});
// Add handler for the pushpin click event.
// Microsoft.Maps.Events.addHandler(_pin, 'click', displayInfobox);
Microsoft.Maps.Events.addHandler(_pin, 'mouseover', function () {
_infoBox.setOptions({ autoPan:true, visible: true });
});
Microsoft.Maps.Events.addHandler(_pin, 'mouseout', function () {
_infoBox.setOptions({ autoPan:true, visible: false });
});
map.entities.push(_pin); //[locNum]
_infoBox.setMap(map);
我尝试使用自动平移,但我不确定它是否可以解决问题。 有人可以帮我解决这个问题吗?
我还尝试了重新定位 ifobox 和 dinot 的帮助。
我使用以下链接作为参考:
【问题讨论】:
标签: javascript jquery-ui maps bing-maps bing