ChartViewDetail型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What hoshi-view says: where the chart looks now, and final once the hand has settled.
インポート
import type { ChartViewDetail } from "@johnmorrisdotca/hoshi-stars/chart/element";
定義
interface ChartViewDetail {
projection: Projection;
ra: number;
dec: number;
zoom: number;
final: boolean;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
projection | "stereographic" | "orthographic" | "gnomonic" | "equidistant" | "equirectangular" | "mollweide" | "hammer" | |
ra | number | |
dec | number | |
zoom | number | |
final | boolean |
例
import type { ChartViewDetail } from "@johnmorrisdotca/hoshi-stars/chart/element";
document.querySelector("hoshi-chart")!.addEventListener("hoshi-view", (event) => {
const { ra, dec, zoom, final } = (event as CustomEvent<ChartViewDetail>).detail;
if (final) history.replaceState(null, "", `?ra=${ra.toFixed(2)}&dec=${dec.toFixed(2)}&zoom=${zoom.toFixed(2)}`);
});この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。