Highlight Manager v1.0.60¶
Manages the "semi-transparent highlight bands" on the canvas. Accessible as renderer.highlightManager, or instantiated standalone via new HighlightManager().
Call forceRedraw after external changes
After mutating highlightManager directly, call renderer.forceRedraw() to make the changes take effect on the next frame.
Method¶
setRegion¶
method
name: string,
start: number,
end: number,
color = "#3867d6",
assembly?: IAssemblyInfo,
): void
Adds or replaces a highlight region keyed by name.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string |
✓ | – | Unique region ID (used for subsequent update / remove) |
start |
number |
✓ | – | Start coordinate (inclusive), in the same coordinate system as the viewport |
end |
number |
✓ | – | End coordinate (exclusive) |
color |
string |
– | "#3867d6" |
CSS hex color for the border + semi-transparent fill |
assembly |
IAssemblyInfo |
– | undefined |
The reference assembly active at creation time |
Update semantics: first match by name for an in-place replacement; if name differs but start+end are identical, update color/assembly in place instead of adding a duplicate entry. end <= start is normalized to start + 1 (single-base width).
renderer.highlightManager.setRegion(
"tp53-promoter",
7575000,
7580000,
"#ff6b6b",
{ name: "GRCh38" },
);
renderer.forceRedraw();
removeRegion¶
method
clear¶
method
regions / size / isEmpty¶
getter
hm.regions: readonly IHighlightRegion[] // shallow copy
hm.size: number // number of regions
hm.isEmpty: boolean // true when there are no regions (standard empty-set semantics)
isEmpty semantics
isEmpty returns true when there are NO regions (standard empty-set semantics: implementation is regions.length === 0).
Types¶
IHighlightRegion¶
type
interface IHighlightRegion {
/** Unique identifier — used for subsequent update / remove. */
name: string;
/** Start coordinate (inclusive), in the same coordinate system as the viewport. */
start: number;
/** End coordinate (exclusive). */
end: number;
/** CSS hex color for the border + semi-transparent fill. */
color: string;
/** The reference assembly active at creation time, e.g. `{ name: "GRCh38" }`, used to validate against the current reference. */
assembly?: IAssemblyInfo;
}