a863006c6e4950cd178eb9a27e1c33f923f61e688818ad66e43916855eb4df40dddd1a65c283b3bc0a9a706cf7a6c84568c959aa5e2a01ef2a98d68a77b03f 800 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * 多边形
  3. * @module zrender/shape/Polygon
  4. */
  5. import Path, { PathProps } from '../Path';
  6. import * as polyHelper from '../helper/poly';
  7. import { VectorArray } from '../../core/vector';
  8. export class PolygonShape {
  9. points: VectorArray[] = null
  10. smooth?: number = 0
  11. smoothConstraint?: VectorArray[] = null
  12. }
  13. export interface PolygonProps extends PathProps {
  14. shape?: Partial<PolygonShape>
  15. }
  16. class Polygon extends Path<PolygonProps> {
  17. shape: PolygonShape
  18. constructor(opts?: PolygonProps) {
  19. super(opts);
  20. }
  21. getDefaultShape() {
  22. return new PolygonShape();
  23. }
  24. buildPath(ctx: CanvasRenderingContext2D, shape: PolygonShape) {
  25. polyHelper.buildPath(ctx, shape, true);
  26. }
  27. };
  28. Polygon.prototype.type = 'polygon';
  29. export default Polygon;