dom.d.ts 828 B

123456789101112131415161718192021222324
  1. import { IShape, IElement } from '../interfaces';
  2. /**
  3. * 创建并返回图形的 svg 元素
  4. * @param type svg类型
  5. */
  6. export declare function createSVGElement(type: string): SVGElement;
  7. /**
  8. * 创建并返回图形的 dom 元素
  9. * @param {IShape} shape 图形
  10. * @return {SVGElement}
  11. */
  12. export declare function createDom(shape: IShape): SVGElement;
  13. /**
  14. * 对 dom 元素进行排序
  15. * @param {IElement} element 元素
  16. * @param {sorter} function 排序函数
  17. */
  18. export declare function sortDom(element: IElement, sorter: (a: IElement, b: IElement) => number): void;
  19. /**
  20. * 将 dom 元素移动到父元素下的指定位置
  21. * @param {SVGElement} element dom 元素
  22. * @param {number} targetIndex 目标位置(从 0 开始)
  23. */
  24. export declare function moveTo(element: SVGElement, targetIndex: number): void;