Sha256: 2df9c65d62f11f5880e2464a710bbb670186357be4c70f294393a8412780d333
Contents?: true
Size: 744 Bytes
Versions: 9
Compression:
Stored size: 744 Bytes
Contents
/* * L.Rectangle extends Polygon and creates a rectangle when passed a LatLngBounds object. */ L.Rectangle = L.Polygon.extend({ initialize: function (latLngBounds, options) { L.Polygon.prototype.initialize.call(this, this._boundsToLatLngs(latLngBounds), options); }, setBounds: function (latLngBounds) { this.setLatLngs(this._boundsToLatLngs(latLngBounds)); }, _boundsToLatLngs: function (latLngBounds) { latLngBounds = L.latLngBounds(latLngBounds); return [ latLngBounds.getSouthWest(), latLngBounds.getNorthWest(), latLngBounds.getNorthEast(), latLngBounds.getSouthEast() ]; } }); L.rectangle = function (latLngBounds, options) { return new L.Rectangle(latLngBounds, options); };
Version data entries
9 entries across 9 versions & 1 rubygems