Files
react-native-svg/lib/extract/extractClipping.js
Horcrux 0434cddc8b Fix memory issue with ClipPath
Fix memory issue with ClipPath.
2016-11-11 13:25:16 +08:00

25 lines
499 B
JavaScript

import SerializablePath from '../SerializablePath';
import clipReg from './patternReg';
const clipRules = {
evenodd: 0,
nonzero: 1
};
export default function (props) {
let {clipPath, clipRule} = props;
let clippingProps = {};
if (clipPath) {
clippingProps.clipRule = clipRules[clipRule] === 0 ? 0 : 1;
let matched = clipPath.match(clipReg);
if (matched) {
clippingProps.clipPath = matched[1];
}
}
return clippingProps;
}