| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- import { ElementRef, Renderer2, OnInit, EventEmitter, OnChanges, SimpleChanges, OnDestroy, AfterViewInit } from '@angular/core';
- import { ResizeHandle } from './widgets/resize-handle';
- import { ResizeHandleType } from './models/resize-handle-type';
- import { IResizeEvent } from './models/resize-event';
- export declare class AngularResizableDirective implements OnInit, OnChanges, OnDestroy, AfterViewInit {
- private el;
- private renderer;
- private _resizable;
- private _handles;
- private _handleType;
- private _handleResizing;
- private _direction;
- private _directionChanged;
- private _aspectRatio;
- private _containment;
- private _origMousePos;
- /** Original Size and Position */
- private _origSize;
- private _origPos;
- /** Current Size and Position */
- private _currSize;
- private _currPos;
- /** Initial Size and Position */
- private _initSize;
- private _initPos;
- /** Snap to gird */
- private _gridSize;
- private _bounding;
- /**
- * Bugfix: iFrames, and context unrelated elements block all events, and are unusable
- * https://github.com/xieziyu/angular2-draggable/issues/84
- */
- private _helperBlock;
- private draggingSub;
- private _adjusted;
- /** Disables the resizable if set to false. */
- ngResizable: any;
- /**
- * Which handles can be used for resizing.
- * @example
- * [rzHandles] = "'n,e,s,w,se,ne,sw,nw'"
- * equals to: [rzHandles] = "'all'"
- *
- * */
- rzHandles: ResizeHandleType;
- /**
- * Whether the element should be constrained to a specific aspect ratio.
- * Multiple types supported:
- * boolean: When set to true, the element will maintain its original aspect ratio.
- * number: Force the element to maintain a specific aspect ratio during resizing.
- */
- rzAspectRatio: boolean | number;
- /**
- * Constrains resizing to within the bounds of the specified element or region.
- * Multiple types supported:
- * Selector: The resizable element will be contained to the bounding box of the first element found by the selector.
- * If no element is found, no containment will be set.
- * Element: The resizable element will be contained to the bounding box of this element.
- * String: Possible values: "parent".
- */
- rzContainment: string | HTMLElement;
- /**
- * Snaps the resizing element to a grid, every x and y pixels.
- * A number for both width and height or an array values like [ x, y ]
- */
- rzGrid: number | number[];
- /** The minimum width the resizable should be allowed to resize to. */
- rzMinWidth: number;
- /** The minimum height the resizable should be allowed to resize to. */
- rzMinHeight: number;
- /** The maximum width the resizable should be allowed to resize to. */
- rzMaxWidth: number;
- /** The maximum height the resizable should be allowed to resize to. */
- rzMaxHeight: number;
- /** Whether to prevent default event */
- preventDefaultEvent: boolean;
- /** emitted when start resizing */
- rzStart: EventEmitter<IResizeEvent>;
- /** emitted when start resizing */
- rzResizing: EventEmitter<IResizeEvent>;
- /** emitted when stop resizing */
- rzStop: EventEmitter<IResizeEvent>;
- constructor(el: ElementRef<HTMLElement>, renderer: Renderer2);
- ngOnChanges(changes: SimpleChanges): void;
- ngOnInit(): void;
- ngOnDestroy(): void;
- ngAfterViewInit(): void;
- /** A method to reset size */
- resetSize(): void;
- /** A method to get current status */
- getStatus(): {
- size: {
- width: number;
- height: number;
- };
- position: {
- top: number;
- left: number;
- };
- };
- private updateResizable;
- /** Use it to update aspect */
- private updateAspectRatio;
- /** Use it to update containment */
- private updateContainment;
- /** Use it to create handle divs */
- private createHandles;
- /** Use it to create a handle */
- private createHandleByType;
- private removeHandles;
- onMouseDown(event: MouseEvent | TouchEvent, handle: ResizeHandle): void;
- private subscribeEvents;
- private unsubscribeEvents;
- onMouseLeave(): void;
- onMouseMove(event: MouseEvent | TouchEvent): void;
- private startResize;
- private stopResize;
- private onResizing;
- private getResizingEvent;
- private updateDirection;
- private resizeTo;
- private doResize;
- private adjustByRatio;
- private checkBounds;
- private checkSize;
- private getBounding;
- private resetBounding;
- private getGridSize;
- }
|