StarNameLabeltype
One name to draw: the star, the text with the look's case applied, and where everything goes, in the page's pixels. The objects are reused by the next update; copy what you keep.
Import it
import type { StarNameLabel } from "@johnmorrisdotca/hoshi-stars/sky-labels";
Definition
interface StarNameLabel {
hr: number;
text: string;
magnitude: number;
x: number;
y: number;
textX: number;
textY: number;
anchor: "start" | "end" | "middle";
designation: string;
designationX: number;
designationY: number;
ring: number;
x0: number;
y0: number;
x1: number;
y1: number;
leader: boolean;
leaderX0: number;
leaderY0: number;
leaderX1: number;
leaderY1: number;
}
Members
| Name | Type | Description |
|---|---|---|
hr | number | The star's Bright Star Catalogue number. |
text | string | The name to draw, with the look's case applied. |
magnitude | number | The star's visual magnitude. |
x | number | Where the star is on the screen. |
y | number | |
textX | number | Where to draw the text: its baseline start ( |
textY | number | |
anchor | "start" | "middle" | "end" | |
designation | string | The catalogue letter to write under the name ( |
designationX | number | |
designationY | number | |
ring | number | The radius of the ring to draw round the star; 0 for none. |
x0 | number | The box the name and its catalogue letter take together. |
y0 | number | |
x1 | number | |
y1 | number | |
leader | boolean | The short line from the star to the text, from ( |
leaderX0 | number | |
leaderY0 | number | |
leaderX1 | number | |
leaderY1 | number |
Examples
import type { StarNameLabel } from "@johnmorrisdotca/hoshi-stars/sky-labels";
const show = (label: StarNameLabel): string => `${label.text} at ${Math.round(label.x)},${Math.round(label.y)}`;
console.log(typeof show);functionWhat it prints (run when this page was built)