interface.d.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /** Two char of 't' 'b' 'c' 'l' 'r'. Example: 'lt' */
  2. export declare type AlignPoint = string;
  3. export interface AlignType {
  4. /**
  5. * move point of source node to align with point of target node.
  6. * Such as ['tr','cc'], align top right point of source node with center point of target node.
  7. * Point can be 't'(top), 'b'(bottom), 'c'(center), 'l'(left), 'r'(right) */
  8. points?: AlignPoint[];
  9. /**
  10. * offset source node by offset[0] in x and offset[1] in y.
  11. * If offset contains percentage string value, it is relative to sourceNode region.
  12. */
  13. offset?: number[];
  14. /**
  15. * offset target node by offset[0] in x and offset[1] in y.
  16. * If targetOffset contains percentage string value, it is relative to targetNode region.
  17. */
  18. targetOffset?: number[];
  19. /**
  20. * If adjustX field is true, will adjust source node in x direction if source node is invisible.
  21. * If adjustY field is true, will adjust source node in y direction if source node is invisible.
  22. */
  23. overflow?: {
  24. adjustX?: boolean | number;
  25. adjustY?: boolean | number;
  26. };
  27. /**
  28. * Whether use css right instead of left to position
  29. */
  30. useCssRight?: boolean;
  31. /**
  32. * Whether use css bottom instead of top to position
  33. */
  34. useCssBottom?: boolean;
  35. /**
  36. * Whether use css transform instead of left/top/right/bottom to position if browser supports.
  37. * Defaults to false.
  38. */
  39. useCssTransform?: boolean;
  40. }
  41. export interface AlignResult {
  42. points: AlignPoint[];
  43. offset: number[];
  44. targetOffset: number[];
  45. overflow: {
  46. adjustX: boolean | number;
  47. adjustY: boolean | number;
  48. };
  49. }
  50. export interface TargetPoint {
  51. clientX?: number;
  52. clientY?: number;
  53. pageX?: number;
  54. pageY?: number;
  55. }
  56. export declare type TargetType = (() => HTMLElement) | TargetPoint;