base.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { AbstractShape } from '@antv/g-base';
  2. import { ShapeAttrs, ChangeType, BBox } from '@antv/g-base';
  3. import { IShape } from '../interfaces';
  4. import Defs from '../defs';
  5. import * as Shape from './index';
  6. import Group from '../group';
  7. declare class ShapeBase extends AbstractShape implements IShape {
  8. type: string;
  9. canFill: boolean;
  10. canStroke: boolean;
  11. getDefaultAttrs(): {
  12. lineWidth: number;
  13. lineAppendWidth: number;
  14. strokeOpacity: number;
  15. fillOpacity: number;
  16. matrix: any;
  17. opacity: number;
  18. };
  19. afterAttrsChange(targetAttrs: ShapeAttrs): void;
  20. getShapeBase(): typeof Shape;
  21. getGroupBase(): typeof Group;
  22. /**
  23. * 一些方法调用会引起画布变化
  24. * @param {ChangeType} changeType 改变的类型
  25. */
  26. onCanvasChange(changeType: ChangeType): void;
  27. calculateBBox(): BBox;
  28. isFill(): boolean;
  29. isStroke(): boolean;
  30. draw(context: any, targetAttrs: any): void;
  31. /**
  32. * @protected
  33. * 绘制图形的路径
  34. * @param {Defs} context 上下文
  35. * @param {ShapeAttrs} targetAttrs 渲染的目标属性
  36. */
  37. createPath(context: Defs, targetAttrs?: ShapeAttrs): void;
  38. strokeAndFill(context: any, targetAttrs?: any): void;
  39. _setColor(context: any, attr: any, value: any): void;
  40. shadow(context: any, targetAttrs?: any): void;
  41. transform(targetAttrs?: any): void;
  42. isInShape(refX: number, refY: number): boolean;
  43. isPointInPath(refX: number, refY: number): boolean;
  44. /**
  45. * 获取线拾取的宽度
  46. * @returns {number} 线的拾取宽度
  47. */
  48. getHitLineWidth(): any;
  49. }
  50. export default ShapeBase;