本文へ移動

Hoshi Stars星

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

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

目次

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

placeLabel関数

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

Put a name on one side of a star: right, left, above (centred over it) or below (centred under it), with the star's catalogue letter under the name when designation is true. Writes into out and answers whether the whole block, and its line, are inside the view. createStarNames tries the four sides in order and takes the first that covers no other name and no star.

インポート

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

定義

function placeLabel(x: number, y: number, width: number, style: LabelStyle, view: SkyView, out: StarNameLabel, designation?: boolean, side?: LabelSide): boolean

引数

名前型説明
xnumber

The star's x on the screen.

ynumber

The star's y on the screen.

widthnumber

The widest line's width in pixels (labelWidth, and designationWidth for the line under it).

styleLabelStyle

A complete look.

viewSkyView

The part of the screen names may use.

outStarNameLabel

Where the answer is written.

designation (省略可)boolean

True when a line for the catalogue letter goes under the name.

side (省略可)"below" | "right" | "left" | "above"

Which side; right by default. A leader line (the look's leader) goes with right and left only.

戻り値

boolean

true when it fits.

例

import { labelStyle, labelWidth, placeLabel, type StarNameLabel } from "@johnmorrisdotca/hoshi-stars/sky-labels";

const style = labelStyle({ leader: 14 });
const out = {} as StarNameLabel;
console.log(placeLabel(395, 100, labelWidth("Rigel", style), style, { width: 400, height: 300 }, out), placeLabel(395, 100, labelWidth("Rigel", style), style, { width: 400, height: 300 }, out, false, "left"), out.anchor);
false true end

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

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

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