RectangularSelectionRegion
RectangularSelectionRegion
is a component for selecting rectangular regions. The rectangle geometry is represented by the g.Rect.
The region can be drawn by the user using the pointer device or programmatically.
It extends the SelectionRegion.
constructorβ
constructor(options?: RectangularSelectionRegion.Options);
It implements all the options from the SelectionRegion and adds the following options:
normalizeβ
[optional] Normalize the rectangle geometry. Default is true
.
While drawing the region, the user can draw the rectangle in any direction. When the user finishes drawing, the region will be normalized to have positive width and height.
If set to true
, the region will always have positive width and height.
If set to false
, the rectangle will have the x
and y
coordinates of the point where the user started drawing the region.
And the width
and height
will be the difference between the start and end points (it could be negative or zero).
const region = new RectangularSelectionRegion({
paper,
normalize: false,
});
Typesβ
Optionsβ
The extended options of the SelectionRegion
.
interface Options extends SelectionRegion.Options<g.Rect> {
normalize?: boolean;
}
Rectβ
Represents the rectangle geometry.
type Rect = g.Rect;