0

所以问题是信息框没有存储所有大小的操作按钮,如下图所示信息框的尺寸太小 其他更大的问题是我不知道如何添加允许在单击信息框的操作按钮时将航点添加到 DirectionsManager 的功能。图钉和信息框的代码如下:

`var pin =  new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(53.42450655662612, 14.560102801018639),{
    title: 'Muzeum Narodowe w Szczecinie',
    description: 'Muzeum sztuki',
    icon: 'https://cdn-icons-png.flaticon.com/512/1009/1009870.png',
    iconSize: { width: 15, height: 15 },
});
map.entities.push(pin);
//Create an infobox at the center of the map but don't show it.
infobox = new Microsoft.Maps.Infobox(Microsoft.Maps.Location(53.42450655662612, 14.560102801018639), {
    visible: false,
});
//Assign the infobox to a map instance.
infobox.setMap(map);
//Store some metadata with the pushpin.
pin.metadata = {
    title: 'Muzeum Narodowe w Szczecinie',
    description: 'Muzeum historii lokalnej',
    icon: 'https://cdn-icons-png.flaticon.com/512/1009/1009870.png',
    iconSize: { width: 15, height: 15 },
    actions: [
        { label: 'Strona muzeum', eventHandler: function () { open('https://muzeum.szczecin.pl'); } },
        { label: 'Dodaj do trasy', eventHandler: function () {} }, //here is the action button which I would like to store function to add waypoint to directions manager on map.
    ]
};
//Add a click event handler to the pushpin.
Microsoft.Maps.Events.addHandler(pin, 'click', pushpinClicked);`//Code
4

0 回答 0