本文へ移動

Hoshi Stars星

肉眼で見える星の名前・色・距離、88星座の線と境界、メシエ天体、そしてそれらを描くための7種類の図法を使えます。

「星」(ほし) は、夜空に光って見えるものです。 名前について(英語)

目次

リファレンス · いちばん明るい星の名前と、うすい星座の線 (自分で描く空のために。個数か等級で選べます。ポインターが乗っている星座は濃く表示でき、空をおおうものにも対応し、見た目は設定だけで変えられます)

FigureLines型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The figures of one sky. update lays the lines out for the screen as it is, point picks the figure under the pointer.

インポート

import type { FigureLines } from "@johnmorrisdotca/hoshi-stars/sky-labels";

定義

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;
}

メンバー

名前型説明
settingsReadonly<FigureLinesSettings & { strength: number; }>

The settings in force, with the strength held to 0 up to 1.

styleReadonly<LabelStyle>

The look in force for the picked figure's name.

segmentsFloat32Array<ArrayBufferLike>

The line ends laid out by the last update, four numbers for each line: x and y of one end, x and y of the other. Reused, until set takes a new culture; read only up to 4 * count.

countnumber

How many lines the last update laid out.

figuresreadonly FigureOnScreen[]

The figures (the 88, in the order of the catalogue, or the culture's, in its order), each with the lines of segments that belong to it.

pickedFigureOnScreen | undefined

The figure the pointer is on, or undefined.

nameFigureName | undefined

The picked figure's name and where to draw it, or undefined when none is picked.

set(settings: FigureLinesSettings): void

Change the settings; the next update uses them. Every setting is replaced, so set({ strength }) alone goes back to the 88, in English, in the default look: keep the rest with lines.set({ ...lines.settings, strength }). A new culture makes the figures again: segments and figures are new objects after it.

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 reach pixels, is picked: on a star of the figure lights the whole figure, as on a line.

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, 1 starts at the first and -1 at the last.

例

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);
function

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/hoshi-stars 0.47.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。