fabric
Version:
Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.
39 lines • 1.96 kB
TypeScript
import type { Transform, TransformActionHandler, FabricImage, ObjectEvents, Control, TMat2D } from 'fabric';
import { Point } from 'fabric';
/**
* Wrap controlsUtils.changeObjectWidth with image constrains
*/
export declare const changeImageWidth: TransformActionHandler;
export declare const changeCropWidth: TransformActionHandler<Transform>;
/**
* Wrap controlsUtils.changeObjectHeight with image constrains
*/
export declare const changeImageHeight: TransformActionHandler;
export declare const changeCropHeight: TransformActionHandler<Transform>;
export declare const changeImageCropX: TransformActionHandler;
export declare const changeImageCropY: TransformActionHandler;
export declare const changeCropX: TransformActionHandler<Transform>;
export declare const changeCropY: TransformActionHandler<Transform>;
/**
* A function to counter the move action and change cropX/cropY of an image
* Keep the image steady, but moves it inside its own cropping rectangle
*/
export declare const cropPanMoveHandler: ({ transform }: ObjectEvents["moving"]) => void;
/**
* This position handler works only for this specific use case.
* It does not support padding nor offset, and it reduces all possible positions
* to the main 4 corners only.
* Any position that is < 0 is the extreme left/top, the rest are right/bottom
*/
export declare function ghostScalePositionHandler(this: Control, dim: Point, // currentDimension
finalMatrix: TMat2D, fabricObject: FabricImage): Point;
/**
* Action handler generator that handles scaling of an image in crop mode.
* The goal is to keep the current bounding box steady.
* So this action handler has its own calculations for a dynamic anchor point
*/
export declare const scaleEquallyCropGenerator: (cx: number, cy: number) => TransformActionHandler;
export declare function renderGhostImage(this: FabricImage, { ctx }: {
ctx: CanvasRenderingContext2D;
}): void;
//# sourceMappingURL=croppingHandlers.d.ts.map