Rotate a google.maps.Polygon
on Google Maps V3 relative to a google.maps.LatLng
- Quick start
- Documentation
- Bugs and feature requests
- Compiling
- Contributing
- Donating
- Versioning
- Authors
- License
Three quick start options are available:
- Download the latest release.
- Clone the repo:
git clone git@github.com:ahmadnassri/google-maps-polygon-rotate.git
- Install with [Bower](http://bower.io)
```bash
bower install google-maps-polygon-rotate
Within the download you'll find the following files, providing both compiled and minified variations:
google-maps-polygon-rotate/
├── dist
│ └── google.maps.Polygon.rotate.min.js
└── src
├── google.maps.LatLng.distanceTo.js
├── google.maps.Point.rotate.js
├── google.maps.Polygon.getCenter.js
└── google.maps.Polygon.rotate.js
start by creating a new log instance:
function initialize() {
var mapOptions = {
zoom: 5,
center: new google.maps.LatLng(24.886436490787712, -70.2685546875),
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var bermudaTriangle;
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
// Define the LatLng coordinates for the polygon's path.
var triangleCoords = [
new google.maps.LatLng(25.774252, -80.190262),
new google.maps.LatLng(18.466465, -66.118292),
new google.maps.LatLng(32.321384, -64.75737),
new google.maps.LatLng(25.774252, -80.190262)
];
// Construct the polygon.
bermudaTriangle = new google.maps.Polygon({
paths: triangleCoords,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35
});
bermudaTriangle.setMap(map);
google.maps.event.addListener(bermudaTriangle, 'click', function rotate () {
var origin = bermudaTriangle.getCenter();
bermudaTriangle.rotate(90, origin);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
Refer to the Wiki for detailed API documentation.
Have a bug or a feature request? Please first read the issue guidelines and search for existing and closed issues. If your problem or idea is not addressed yet, please open a new issue.
This project uses Grunt. If you haven't used Grunt before, be sure to check out the Getting Started guide.
Should you encounter problems with installing dependencies or running Grunt commands, uninstall all previous dependency versions (global and local). Then, rerun npm install
.
Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.
More over, if your pull request contains JavaScript patches or features, you must include relevant unit tests.
Editor preferences are available in the editor config for easy use in common text editors. Read more and download plugins at http://editorconfig.org.
Donate bitcoins to this project or make commits and get tips for it. If your commit is accepted by project maintainer and there are bitcoins on its balance, you will get a tip!
Donations are welcome to help support the continuous development of this project.
For transparency into our release cycle and in striving to maintain backward compatibility, this project is maintained under the Semantic Versioning guidelines. Sometimes we screw up, but we'll adhere to these rules whenever possible.
Releases will be numbered with the following format:
<major>.<minor>.<patch>
And constructed with the following guidelines:
- Breaking backward compatibility bumps the major while resetting minor and patch
- New additions without breaking backward compatibility bumps the minor while resetting the patch
- Bug fixes and misc changes bumps only the patch
For more information on SemVer, please visit http://semver.org/.
Licensed under the MIT license.