add ClipPath element support

This commit is contained in:
Horcrux
2016-04-21 17:55:18 +08:00
parent 7859813eac
commit 7d3ef84163
14 changed files with 197 additions and 60 deletions
+9 -8
View File
@@ -12,21 +12,22 @@ class Ellipse extends Component{
rx: propType,
ry: propType
};
render() {
let {props} = this;
let {cx, cy, rx, ry} = this.props;
let d = `
static getPath = props => {
let {cx, cy, rx, ry} = props;
return `
M ${cx - rx} ${cy}
a ${rx}, ${ry} 0 1, 0 ${rx * 2}, 0
a ${rx}, ${ry} 0 1, 0 ${-rx * 2}, 0
Z
`;
};
render() {
let {props} = this;
let d = Ellipse.getPath(this.props);
return <Path
{...props}
cx={null}
cy={null}
rx={null}
ry={null}
d={d}
/>;
}