Skip to main content
Version: 4.1

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;

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub