Circle.js 730 B

1234567891011121314151617181920212223242526272829303132
  1. var Path = require("../Path");
  2. /**
  3. * 圆形
  4. * @module zrender/shape/Circle
  5. */
  6. var _default = Path.extend({
  7. type: 'circle',
  8. shape: {
  9. cx: 0,
  10. cy: 0,
  11. r: 0
  12. },
  13. buildPath: function (ctx, shape, inBundle) {
  14. // Better stroking in ShapeBundle
  15. // Always do it may have performence issue ( fill may be 2x more cost)
  16. if (inBundle) {
  17. ctx.moveTo(shape.cx + shape.r, shape.cy);
  18. } // else {
  19. // if (ctx.allocate && !ctx.data.length) {
  20. // ctx.allocate(ctx.CMD_MEM_SIZE.A);
  21. // }
  22. // }
  23. // Better stroking in ShapeBundle
  24. // ctx.moveTo(shape.cx + shape.r, shape.cy);
  25. ctx.arc(shape.cx, shape.cy, shape.r, 0, Math.PI * 2, true);
  26. }
  27. });
  28. module.exports = _default;