Skip to main content
Version: 4.1

SelectionFrameList

SelectionFrameList is an interface for collection of selection frames. It is used by the Selection to render the frames.

It is not intended for direct use, but could be extended to create custom lists of selection frames.

There are several built-in implementations of the SelectionFrameList:

Methods​

add()​

add(cell: dia.Cell): void;

Add a selection frame around the cell.

clear()​

clear(): void;

Remove all selection frames from the list.

count()​

count(): number;

Get the number of selection frames in the list.

destroy()​

destroy(): void;

Remove all selection frames from the list and clean up the resources. It's called when the selection is destroyed.

getCellBBox()​

getCellBBox(cell: dia.Cell): dia.BBox;

Get the bounding box of the selection frame around the cell.

The default implementation returns the rotated model bounding box.

(cell) => cell.getBBox({ rotate: true })

getBBox()​

getBBox(): dia.BBox;

Get the bounding box of all selection frames in the list.

The default implementation returns the union of all cell bounding boxes.

initialize()​

initialize(): void;

The method is called when the selection is initialized.

paper​

readonly paper: dia.Paper;

The paper the selection is rendered on.

translate()​

translate(tx: number, ty: number): void;

A method that is called when the cells are being translated. It is meant to be used when an optimization is needed (as opposed to calling update() which could be more expensive).

If you do not override this method, the default implementation will call update().

remove()​

remove(cell: dia.Cell): void;

Remove the selection frame around the cell.

selection​

readonly selection: ui.Selection;

The selection the frames are associated with.

setSelection()​

setSelection(selection: ui.Selection): void;

Set the selection the frames are associated with.

update()​

update(): void;

Update the selection frames. It's called when the cells change.