react-native-svg-desktop/elements/Ellipse.js

40 строки
876 B
JavaScript
Исходник Обычный вид История

2016-01-17 17:29:06 +03:00
import React, {
Component,
2016-01-18 05:08:06 +03:00
PropTypes,
ART
2016-01-17 17:29:06 +03:00
} from 'react-native';
import Path from './Path';
2016-01-17 17:29:06 +03:00
2016-01-22 13:41:52 +03:00
let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
2016-01-17 17:29:06 +03:00
class Ellipse extends Component{
static displayName = 'Ellipse';
2016-01-17 17:29:06 +03:00
static propTypes = {
cx: propType,
cy: propType,
rx: propType,
ry: propType
};
render() {
let {props} = this;
2016-01-17 17:29:06 +03:00
let {cx, cy, rx, ry} = this.props;
let d = `
M ${cx - rx} ${cy}
a ${rx}, ${ry} 0 1, 0 ${rx * 2}, 0
a ${rx}, ${ry} 0 1, 0 ${-rx * 2}, 0
Z
`;
return <Path
{...props}
strokeCap={null}
strokeJoin={null}
2016-01-17 17:29:06 +03:00
cx={null}
cy={null}
rx={null}
ry={null}
d={d}
/>;
}
}
export default Ellipse;