refactor all components and isolated from ART dependency

This commit is contained in:
Horcrux
2016-04-20 00:52:59 +08:00
parent c8a04c3d28
commit d700ca5493
81 changed files with 2993 additions and 1437 deletions

28
lib/extractProps.js Normal file
View File

@@ -0,0 +1,28 @@
import extractFill from './extractFill';
import extractStroke from './extractStroke';
import extractTransform from './extractTransform';
export default function(props, options = {stroke: true, join: true, transform: true, fill: true}) {
if (props.visible === false) {
return {
opacity: 0
}
}
let extractedProps = {
opacity: +props.opacity || 1
};
if (options.stroke) {
Object.assign(extractedProps, extractStroke(props));
}
if (options.fill) {
extractedProps.fill = extractFill.call(this, props);
}
if (options.transform) {
extractedProps.transform = extractTransform(props);
}
return extractedProps;
}