angular-resizable.directive.d.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import { ElementRef, Renderer2, OnInit, EventEmitter, OnChanges, SimpleChanges, OnDestroy, AfterViewInit } from '@angular/core';
  2. import { ResizeHandle } from './widgets/resize-handle';
  3. import { ResizeHandleType } from './models/resize-handle-type';
  4. import { IResizeEvent } from './models/resize-event';
  5. export declare class AngularResizableDirective implements OnInit, OnChanges, OnDestroy, AfterViewInit {
  6. private el;
  7. private renderer;
  8. private _resizable;
  9. private _handles;
  10. private _handleType;
  11. private _handleResizing;
  12. private _direction;
  13. private _directionChanged;
  14. private _aspectRatio;
  15. private _containment;
  16. private _origMousePos;
  17. /** Original Size and Position */
  18. private _origSize;
  19. private _origPos;
  20. /** Current Size and Position */
  21. private _currSize;
  22. private _currPos;
  23. /** Initial Size and Position */
  24. private _initSize;
  25. private _initPos;
  26. /** Snap to gird */
  27. private _gridSize;
  28. private _bounding;
  29. /**
  30. * Bugfix: iFrames, and context unrelated elements block all events, and are unusable
  31. * https://github.com/xieziyu/angular2-draggable/issues/84
  32. */
  33. private _helperBlock;
  34. private draggingSub;
  35. private _adjusted;
  36. /** Disables the resizable if set to false. */
  37. ngResizable: any;
  38. /**
  39. * Which handles can be used for resizing.
  40. * @example
  41. * [rzHandles] = "'n,e,s,w,se,ne,sw,nw'"
  42. * equals to: [rzHandles] = "'all'"
  43. *
  44. * */
  45. rzHandles: ResizeHandleType;
  46. /**
  47. * Whether the element should be constrained to a specific aspect ratio.
  48. * Multiple types supported:
  49. * boolean: When set to true, the element will maintain its original aspect ratio.
  50. * number: Force the element to maintain a specific aspect ratio during resizing.
  51. */
  52. rzAspectRatio: boolean | number;
  53. /**
  54. * Constrains resizing to within the bounds of the specified element or region.
  55. * Multiple types supported:
  56. * Selector: The resizable element will be contained to the bounding box of the first element found by the selector.
  57. * If no element is found, no containment will be set.
  58. * Element: The resizable element will be contained to the bounding box of this element.
  59. * String: Possible values: "parent".
  60. */
  61. rzContainment: string | HTMLElement;
  62. /**
  63. * Snaps the resizing element to a grid, every x and y pixels.
  64. * A number for both width and height or an array values like [ x, y ]
  65. */
  66. rzGrid: number | number[];
  67. /** The minimum width the resizable should be allowed to resize to. */
  68. rzMinWidth: number;
  69. /** The minimum height the resizable should be allowed to resize to. */
  70. rzMinHeight: number;
  71. /** The maximum width the resizable should be allowed to resize to. */
  72. rzMaxWidth: number;
  73. /** The maximum height the resizable should be allowed to resize to. */
  74. rzMaxHeight: number;
  75. /** Whether to prevent default event */
  76. preventDefaultEvent: boolean;
  77. /** emitted when start resizing */
  78. rzStart: EventEmitter<IResizeEvent>;
  79. /** emitted when start resizing */
  80. rzResizing: EventEmitter<IResizeEvent>;
  81. /** emitted when stop resizing */
  82. rzStop: EventEmitter<IResizeEvent>;
  83. constructor(el: ElementRef<HTMLElement>, renderer: Renderer2);
  84. ngOnChanges(changes: SimpleChanges): void;
  85. ngOnInit(): void;
  86. ngOnDestroy(): void;
  87. ngAfterViewInit(): void;
  88. /** A method to reset size */
  89. resetSize(): void;
  90. /** A method to get current status */
  91. getStatus(): {
  92. size: {
  93. width: number;
  94. height: number;
  95. };
  96. position: {
  97. top: number;
  98. left: number;
  99. };
  100. };
  101. private updateResizable;
  102. /** Use it to update aspect */
  103. private updateAspectRatio;
  104. /** Use it to update containment */
  105. private updateContainment;
  106. /** Use it to create handle divs */
  107. private createHandles;
  108. /** Use it to create a handle */
  109. private createHandleByType;
  110. private removeHandles;
  111. onMouseDown(event: MouseEvent | TouchEvent, handle: ResizeHandle): void;
  112. private subscribeEvents;
  113. private unsubscribeEvents;
  114. onMouseLeave(): void;
  115. onMouseMove(event: MouseEvent | TouchEvent): void;
  116. private startResize;
  117. private stopResize;
  118. private onResizing;
  119. private getResizingEvent;
  120. private updateDirection;
  121. private resizeTo;
  122. private doResize;
  123. private adjustByRatio;
  124. private checkBounds;
  125. private checkSize;
  126. private getBounding;
  127. private resetBounding;
  128. private getGridSize;
  129. }