FigureLinestype
The figures of one sky. update lays the lines out for the screen as it is, point picks the figure under the pointer.
Import it
import type { FigureLines } from "@johnmorrisdotca/hoshi-stars/sky-labels";
Definition
interface FigureLines {
readonly settings: Readonly<FigureLinesSettings & {
strength: number;
}>;
readonly style: Readonly<LabelStyle>;
readonly segments: Float32Array;
readonly count: number;
readonly figures: readonly FigureOnScreen[];
readonly picked: FigureOnScreen | undefined;
readonly name: FigureName | undefined;
set(settings: FigureLinesSettings): void;
opacityOf(figure: FigureOnScreen): number;
update(project: SkyProjector, view: SkyView, avoid?: readonly Box[]): number;
point(x?: number, y?: number): boolean;
step(direction: 1 | -1): boolean;
}
Members
| Name | Type | Description |
|---|---|---|
settings | Readonly<FigureLinesSettings & { strength: number; }> | The settings in force, with the strength held to 0 up to 1. |
style | Readonly<LabelStyle> | The look in force for the picked figure's name. |
segments | Float32Array<ArrayBufferLike> | The line ends laid out by the last |
count | number | How many lines the last |
figures | readonly FigureOnScreen[] | The figures (the 88, in the order of the catalogue, or the culture's, in its order), each with the lines of |
picked | FigureOnScreen | undefined | The figure the pointer is on, or |
name | FigureName | undefined | The picked figure's name and where to draw it, or |
set | (settings: FigureLinesSettings): void | Change the settings; the next |
opacityOf | (figure: FigureOnScreen): number | The opacity to draw a figure's lines at: the picked figure's is 1, every other is the strength. 0 for all when the strength is 0. |
update | (project: SkyProjector, view: SkyView, avoid?: readonly Box[]): number | Lay the lines out for the screen as it is now. Call it when the view, the size or the settings changed. A picked figure that is no longer in view is let go. |
point | (x?: number, y?: number): boolean | Say where the pointer (or a finger) is, in the page's pixels, or call with nothing when it has left. The figure with a line or a star nearest the point, within |
step | (direction: 1 | -1): boolean | Pick the next figure in view, or the one before (for the keyboard): in the catalogue's order, round from the last to the first, skipping figures with no line in view. With none picked, |
Examples
import type { FigureLines } from "@johnmorrisdotca/hoshi-stars/sky-labels";
const total = (lines: FigureLines): number => lines.figures.reduce((sum, f) => sum + f.end - f.start, 0);
console.log(typeof total);functionWhat it prints (run when this page was built)