最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to make a resizable circle in google maps v3? - Stack Overflow

programmeradmin3浏览0评论

I have the following code, the circle is already moveable, now I want it to be resizeable:

  function init() {
    var mapCenter = new google.maps.LatLng(0, 0);
    var map = new google.maps.Map(document.getElementById('map'), {
      'zoom': 1,
      'center': mapCenter,
      'mapTypeId': google.maps.MapTypeId.ROADMAP
    });

    var marker = new google.maps.Marker({
      map: map,
      position: new google.maps.LatLng(55, 0),
      draggable: true,
      title: 'Drag me!'
    });

    var circle = new google.maps.Circle({
      map: map,
      radius: 3000000 // 3000 km
    });

    circle.bindTo('center', marker, 'position');
  }

  // Register an event listener to fire when the page finishes loading.
  google.maps.event.addDomListener(window, 'load', init);

Now, how can I do the resizer? I already read: .html But there isn't another way to do that?

I have the following code, the circle is already moveable, now I want it to be resizeable:

  function init() {
    var mapCenter = new google.maps.LatLng(0, 0);
    var map = new google.maps.Map(document.getElementById('map'), {
      'zoom': 1,
      'center': mapCenter,
      'mapTypeId': google.maps.MapTypeId.ROADMAP
    });

    var marker = new google.maps.Marker({
      map: map,
      position: new google.maps.LatLng(55, 0),
      draggable: true,
      title: 'Drag me!'
    });

    var circle = new google.maps.Circle({
      map: map,
      radius: 3000000 // 3000 km
    });

    circle.bindTo('center', marker, 'position');
  }

  // Register an event listener to fire when the page finishes loading.
  google.maps.event.addDomListener(window, 'load', init);

Now, how can I do the resizer? I already read: http://code.google./intl/pt-BR/apis/maps/articles/mvcfun.html But there isn't another way to do that?

Share Improve this question edited May 25, 2011 at 7:09 skaffman 404k96 gold badges824 silver badges775 bronze badges asked May 12, 2011 at 1:44 LucasLucas 811 silver badge3 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

The google.maps.Circle object has method .setEditable(true). The description from the docs says:

If set to true, the user can edit this circle by dragging the control points shown at the center and around the circumference of the circle.

发布评论

评论列表(0)

  1. 暂无评论