add Use element and add example for it

add Use element and add example for it
This commit is contained in:
Horcrux
2016-01-23 19:25:12 +08:00
parent af0995022d
commit 11c211a9a9
12 changed files with 166 additions and 29 deletions

View File

@@ -7,6 +7,7 @@ import React, {
let {
Text:ARTText
} = ART;
import Defs from './Defs';
import fillFilter from '../lib/fillFilter';
import strokeFilter from '../lib/strokeFilter';
@@ -33,7 +34,7 @@ class Text extends Component{
y = props.dy ? +props.y + (+props.dy) : +props.y;
}
return <ARTText
let element = <ARTText
{...props}
{...transformFilter(props)}
{...strokeFilter(props)}
@@ -47,7 +48,12 @@ class Text extends Component{
alignment={props.textAnchor || props.alignment}
x={x}
y={y}
id={null}
/>;
if (this.props.id) {
Defs.set(this.props.id + ':' + this.props.svgId, <Text {...this.props} id={null} />);
}
return element;
}
}