如何在google map api v3中绘制Draggable和Resizable矩形 [英] How to Draw Draggable and Resizable rectangle in google map api v3
本文介绍了如何在google map api v3中绘制Draggable和Resizable矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想绘制一个自定义的矩形,它可以通过关闭按钮和
来调整大小和可拖动的大小,这个矩形由数据库中的查询返回的边界组成。
I want to draw a custom rectangle which is resizable and draggable with a close button and which is formed with the bounds returned by the query in the database.
感谢
Thanks
推荐答案
这是一个矩形可调整大小和拖动。
This is a rectangle resizable and dragabble. A little search and some trying would give you what you need.
function initialize() {
var myOptions = {
center: new google.maps.LatLng(44.5452, -78.5389),
zoom: 9,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map_canvas'),
myOptions);
var bounds = new google.maps.LatLngBounds(
new google.maps.LatLng(44.490, -78.649),
new google.maps.LatLng(44.599, -78.443)
);
var rectangle = new google.maps.Rectangle({
bounds: bounds,
editable: true
});
rectangle.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);
希望这有助于您!
这篇关于如何在google map api v3中绘制Draggable和Resizable矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文