CVShapeData.js 916 B

123456789101112131415161718192021222324252627282930313233
  1. import ShapePropertyFactory from '../../../utils/shapes/ShapeProperty';
  2. import SVGShapeData from './SVGShapeData';
  3. function CVShapeData(element, data, styles, transformsManager) {
  4. this.styledShapes = [];
  5. this.tr = [0, 0, 0, 0, 0, 0];
  6. var ty = 4;
  7. if (data.ty === 'rc') {
  8. ty = 5;
  9. } else if (data.ty === 'el') {
  10. ty = 6;
  11. } else if (data.ty === 'sr') {
  12. ty = 7;
  13. }
  14. this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element);
  15. var i;
  16. var len = styles.length;
  17. var styledShape;
  18. for (i = 0; i < len; i += 1) {
  19. if (!styles[i].closed) {
  20. styledShape = {
  21. transforms: transformsManager.addTransformSequence(styles[i].transforms),
  22. trNodes: [],
  23. };
  24. this.styledShapes.push(styledShape);
  25. styles[i].elements.push(styledShape);
  26. }
  27. }
  28. }
  29. CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated;
  30. export default CVShapeData;