我想将事件添加到按钮图片,以便将我的地图的左下方向下移动缩放工作正常,但不要移动。感谢帮助。我在API v3中,所以如果你有任何想法我如何创建新的按钮图像来导航地图,它将有助于:
var panUp = document.createElement("div");
this.setButtonStyle_(panUp);
control2.appendChild(panUp);
panUp.appendChild(document.createTextNode("panUp"));
panUp.innerHTML = '<img src="./icons/map_arrow_up.png">';
g.event.addDomListener(panUp, "click", function() {
map.setpanBy(new Point(-100, 0));
});
var panDown = document.createElement("div");
this.setButtonStyle_(panDown);
control3.appendChild(panDown);
panDown.appendChild(document.createTextNode("panDown"));
panDown.innerHTML = '<img src="./icons/map_arrow_down.png">';
g.event.addDomListener(panDown, "click", function() {
map.panDirection(0,-1);
});
var panLeft = document.createElement("div");
this.setButtonStyle_(panLeft);
control4.appendChild(panLeft);
panLeft.appendChild(document.createTextNode("panLeft"));
panLeft.innerHTML = '<img src="./icons/map_arrow_left.png">';
g.event.addDomListener(panLeft, "click", function() {
map.panDirection(1,0);
});
var panRight = document.createElement("div");
this.setButtonStyle_(panRight);
control5.appendChild(panRight);
panRight.appendChild(document.createTextNode("panRight"));
panRight.innerHTML = '<img src="./icons/map_arrow_right.png">';
g.event.addDomListener(panRight, "click", function() {
map.panDirection(-1,0);
});
答案 0 :(得分:0)
V3中没有方法 setpanBy 或 panDirection ,您可以使用 panBy()或 panTo()
http://code.google.com/intl/en/apis/maps/documentation/javascript/reference.html#Map