cordova-plugin-googlemaps icon indicating copy to clipboard operation
cordova-plugin-googlemaps copied to clipboard

Interactive Polygons

Open JeffreyJamesAttenti opened this issue 9 years ago • 6 comments

I'm submitting a ... (check one with "x") [x] question [ ] any problem or bug report [ ] feature request

If you choose 'problem or bug report', please select OS: (check one with "x") [ ] Android [ ] iOS

I know that your plugin doesn't have this feature now but is it possible to have a feature where polygons are draggable and/or resizable? I know that the Google javascript API allows dragging polygons but it appears that mobile SDKs don't allow it. Do you know?

JeffreyJamesAttenti avatar Nov 13 '17 17:11 JeffreyJamesAttenti

https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/Polyline/getPoints/README.md

wf9a5m75 avatar Nov 13 '17 17:11 wf9a5m75

https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.0.0/class/Polygon/getPoints/README.md

wf9a5m75 avatar Nov 13 '17 17:11 wf9a5m75

That is great! That's a feature I need!

Is there also a way to press the polygon and drag it to a new location?

JeffreyJamesAttenti avatar Nov 13 '17 17:11 JeffreyJamesAttenti

Is there also a way to press the polygon and drag it to a new location?

There is no feature something like that. But you can catch the POLYGON_CLICK event with latlng, then insert it to the baseArrayClass instance.

The idea is something like this.

map.addPolygon({
 ....,
 clickable: true //  <-- default: false
}, function(polygon) {

  var points = polygon.getPoints();
  points.on('added', function(latLng) {
    map.addMarker({
      position: latLng
    }, function(marker) {
        ...
    });

  });
  polygon.addEventListener(plugin.google.maps.event.POLYGON_CLICK, function(latLng) {
    points.push(latLng);
  })
});

I know you want to implement the editable property. I consider it, but I don't have enough time to implement it. So if you implement it instead of me, and send it as a pull request, I will welcome to pay some amount for you (because you save my time a lot).

wf9a5m75 avatar Nov 13 '17 18:11 wf9a5m75

Ok I will implement that if I have the time to do it. Thanks for the quick response.

JeffreyJamesAttenti avatar Nov 13 '17 18:11 JeffreyJamesAttenti

Good. I close this thread at once, but you can reply or refer from a PR anytime.

wf9a5m75 avatar Nov 13 '17 18:11 wf9a5m75