@stangres/react-leaflet
Version:
React components for Leaflet maps
40 lines (30 loc) • 1.19 kB
JavaScript
;
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
import { Circle as LeafletCircle } from 'leaflet';
import { withLeaflet } from './context';
import Path from './Path';
var Circle = /*#__PURE__*/function (_Path) {
_inheritsLoose(Circle, _Path);
function Circle() {
return _Path.apply(this, arguments) || this;
}
var _proto = Circle.prototype;
_proto.createLeafletElement = function createLeafletElement(props) {
var center = props.center,
radius = props.radius,
options = _objectWithoutPropertiesLoose(props, ["center", "radius"]);
return new LeafletCircle(center, radius, this.getOptions(options));
};
_proto.updateLeafletElement = function updateLeafletElement(fromProps, toProps) {
if (toProps.center !== fromProps.center) {
this.leafletElement.setLatLng(toProps.center);
}
if (toProps.radius !== fromProps.radius) {
this.leafletElement.setRadius(toProps.radius);
}
};
return Circle;
}(Path);
export { Circle as ExtendableCircle };
export default withLeaflet(Circle);