UNPKG

maplair

Version:

JavaScript library for mobile-friendly interactive maps

25 lines (24 loc) • 732 B
import { LatLngBounds } from "../../geo/LatLngBounds.js"; import { Polygon } from "./Polygon.js"; //#region src/layer/vector/Rectangle.js var Rectangle = class Rectangle extends Polygon { constructor(latLngBounds, options) { super(Rectangle._boundsToLatLngs(latLngBounds), options); this.callInitHooks(Rectangle); } setBounds(latLngBounds) { return this.setLatLngs(Rectangle._boundsToLatLngs(latLngBounds)); } static _boundsToLatLngs(latLngBounds) { latLngBounds = new LatLngBounds(latLngBounds); return [ latLngBounds.getSouthWest(), latLngBounds.getNorthWest(), latLngBounds.getNorthEast(), latLngBounds.getSouthEast() ]; } }; //#endregion export { Rectangle }; //# sourceMappingURL=Rectangle.js.map