import { GcImageViewer } from "../GcImageViewer"; import { IGcPoint } from "../Models/GcMeasurementTypes"; import { Bounds, GcSelectionBoxHandler, GcSelectionEdge, IGcSelectionBox, GcSelectionBoxUsageType, PointLocation, PointIndicatorType, GcSelectionBoxHandler2 } from "../Models/SelectionBoxTypes"; /** * Selection box UI with rotation support. **/ export declare class GcSelectionBox implements IGcSelectionBox { viewer: GcImageViewer; /** * Selection box listeners. **/ listeners: { [listenerKey: string]: GcSelectionBoxHandler; }; readonly id: string; private static _panResumed; /** * Non-dirty selection bounds (selection bounds before resize/move action). **/ private _selectedBounds1; private _selectionContainer?; private _viewBoxElementOuter; private _viewBoxElement; private _viewBoxImageElement; private _selectionCropBoxElement; private _selectionType; private _pointerMoveHandler?; private _pointerUpHandler?; private _documentPointerDownHandler?; private _keepAspectRatio?; private _movedDif?; private _onWindowResizeHandler?; private _penCoords?; private _prevDownTime; private _previewImageUrl?; private _startInfo?; private _windowResizeTimeout?; private _moveOnly; private _allowRotate; /** * Constructor. * @param viewer */ constructor(viewer: GcImageViewer); private _rotationAngle; private _rotationStartInfo?; /** * Get current rotation angle in degrees. **/ get rotationAngle(): number; /** * Set rotation angle in degrees. **/ set rotationAngle(angle: number); /** * Start rotation operation. **/ private startRotation; private updateRotation; /** * Finish rotation operation. **/ private finishRotation; /** * Adjusts selection edge elements' positions based on current rotation angle. * Stores original edge positions in data-start-edge attribute and updates data-edge * with rotated positions. Handles all 8 directional edges and rotation handle. * * @memberof GcSelectionBox * @returns {void} * @example * // Rotates all edge handles by current _rotationAngle * this.updateSelectionEdgesForRotation(); */ updateSelectionEdgesForRotation(): void; setStartInfo(startInfo?: { point: IGcPoint; edge: GcSelectionEdge; } | null): void; showPointIndicator(coords: PointLocation, size: number, type: PointIndicatorType): void; clearPointIndicator(type: PointIndicatorType): void; clearPointIndicators(): void; /** * If `true`, allows the selection to extend beyond the canvas bounds. * * Default is `false`, which restricts the selection to stay fully within the canvas. */ allowOverflow?: boolean; applySelectedBoundsMods(initialBounds: Bounds, finish?: boolean): Bounds; /** * @returns Returns true when selection is changed **/ _updateMovedDif(startPoint: IGcPoint, curPoint: IGcPoint, edge: GcSelectionEdge): boolean; cursorStyle: "crosshair" | "text"; /** * Allow move edges only. **/ get moveOnly(): boolean; set moveOnly(val: boolean); get allowRotate(): boolean; set allowRotate(val: boolean); get previewImageUrl(): string | undefined; set previewImageUrl(dataUrl: string | undefined); /** * Max selection bounds. **/ get maxBounds(): Bounds; /** * Current selection bounds in natural image coordinates. **/ get selectionBounds(): Bounds; set selectionBounds(bounds: Bounds); get keepAspectRatio(): boolean; set keepAspectRatio(keepAspectRatio: boolean); /** * Current selection bounds in viewport coordinates. **/ get viewportSelectionBounds(): Bounds; get activeImageAppearanceBounds(): Bounds; /** * Show selection box. * @param initialBounds * @param selectionType */ show(initialBounds?: Bounds, selectionType?: GcSelectionBoxUsageType, keepAspectRatio?: boolean): void; get selectionType(): GcSelectionBoxUsageType; set selectionType(selectionType: GcSelectionBoxUsageType); dispose(): void; /** * Hide selection box. **/ hide(): void; disable(): void; /** * Add selection box listener. * @param uniqueKey * @param selectionBoxHandler */ addListener(uniqueKey: string, selectionBoxHandler: GcSelectionBoxHandler | GcSelectionBoxHandler2): void; /** * Remove selection box listener. * @param uniqueKey */ removeListener(uniqueKey: string): void; /** * Update preview image. **/ updatePreviewImage(): void; /** * Invalidate selection UI. **/ invalidate(): void; /** * Start selection. * @param point Point in viewport coordinates. * @param edge Selection edge type. */ startSelection(point: IGcPoint, edge: GcSelectionEdge): void; /** * Move selection. * @param point Point in viewport coordinates. */ moveSelection(point: IGcPoint): void; /** * Finish selection. **/ finishSelection(): void; /** * Notify selection box listeners about selection bounds changes. * @param isDirty */ raiseSelectionChanged(isDirty: boolean, trigger: "start" | "move" | "end"): void; raisePenCoordsChanged(penCoords: { x: number; y: number; }[], isDirty: boolean, trigger: "start" | "move" | "end"): void; raisePointerDownEvents(event: PointerEvent): void; /** * Viewport scale ratio. Used for viewport/image coordinates conversion. **/ get viewportScaleRatio(): number; /** * Convert point coordinates from view port coordinates to natural image coordinates. * @param point */ fromViewportPoint(point: IGcPoint): IGcPoint; /** * Convert bounds from natural image coordinates to view port coordinates. * @param bounds **/ toViewportBounds(bounds: Bounds): Bounds; private _createControls; private bindEvents; private unbindEvents; private onWindowResize; handleInteractionStart(event: PointerEvent): void; onPointerDown(event: PointerEvent): void; onDocumentPointerDown(event: PointerEvent): void; _onceHandlers: any; onPointerMove(event: PointerEvent): void; bindOnce(eventName: string, handler: any): void; onPointerUp(event: PointerEvent): void; onKeyDown(event: KeyboardEvent, params: { alt: boolean; space: boolean; shift: boolean; }): void; onKeyUp(e: KeyboardEvent, params: { alt: boolean; space: boolean; shift: boolean; }): void; resumePan(): void; pauseResumedPan(): void; getRelativeXY(event: PointerEvent): PointLocation; }