Overview
TheResizeHandle type represents the four corner handles used for resizing bounding box annotations. Each handle corresponds to a corner of the rectangle and determines the resize behavior.
Type Definition
types.ts
Values
North-West (top-left corner) - Adjusts both top and left edges
North-East (top-right corner) - Adjusts top and right edges
South-West (bottom-left corner) - Adjusts bottom and left edges
South-East (bottom-right corner) - Adjusts both bottom and right edges
Usage
TheResizeHandle type is used when initiating a resize operation on an annotation:
App.tsx
Resize Behavior
Each handle modifies different edges of the bounding box:| Handle | Modifies Edges | Cursor Style |
|---|---|---|
nw | Top + Left | nwse-resize |
ne | Top + Right | nesw-resize |
sw | Bottom + Left | nesw-resize |
se | Bottom + Right | nwse-resize |
Constraints
When resizing, the following constraints are enforced:- Minimum box size (
MIN_BOX_SIZE = 8px) - Canvas boundaries (cannot resize beyond image edges)
- Opposite corners remain fixed (only the selected corner moves)
Visual Representation
Related Types
- AnnotationTransform - Uses ResizeHandle to track which corner is being dragged
- AnnotationBox - The target of resize operations