Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 1.34 KB

File metadata and controls

61 lines (45 loc) · 1.34 KB

⚠️ This document is aim for older versions (from 2.3.0 to 2.5.3). Document for new version is https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/README.md

polyline.setStrokeWidth()

Change the polyline stroke width.

polyline.setStrokeWidth(width);

Parameters

name type description
width number polyline width in pixel

Demo code

<div id="map_canvas"></div>
var flightPlanCoordinates = [
  {lat: 37.772, lng: -122.214},
  {lat: 21.291, lng: -157.821},
  {lat: -18.142, lng: 178.431},
  {lat: -27.467, lng: 153.027}
];

var mapDiv = document.getElementById("map_canvas");

// Create a map with specified camera bounds
var map = plugin.google.maps.Map.getMap(mapDiv, {
  camera: {
    target: flightPlanCoordinates
  }
});

// Add a polyline
var polyline = map.addPolyline({
  points: flightPlanCoordinates,
  'color' : '#AA00FF',
  'width': 10,
  'geodesic': true,
  'clickable': true // default = false
});

// Change the polyline width.
polyline.on(plugin.google.maps.event.POLYLINE_CLICK, function(latLng) {

  // Change width of the polyline.
  polyline.setStrokeWidth(20);

});