39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
"use strict";
|
|
|
|
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 default withLeaflet(Circle); |