flight-indicators 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  Modern SVG flight instruments for React, with no runtime dependencies.
10
10
 
11
- - Fifteen instruments: **Attitude**, **Heading**, **Airspeed**, **Altimeter**, **Vertical speed**, **Turn coordinator**, **VOR / CDI**, **ADF**, **Radio panel** (NAV / ADF / DME), **Wind / runway**, **Fuel**, **Flaps**, **Angle of attack**, **Engine monitor** and a custom **Data panel** for any readouts you like
11
+ - Seventeen instruments: **Attitude**, **Heading**, **HSI** (horizontal situation indicator), **Airspeed**, **Altimeter**, **Vertical speed**, **Turn coordinator**, **VOR / CDI**, **VOR / ILS** (crossed needles with glideslope), **ADF**, **Radio panel** (NAV / ADF / DME), **Wind / runway**, **Fuel**, **Flaps**, **Angle of attack**, **Engine monitor** and a custom **Data panel** for any readouts you like
12
12
  - Plus **RadioStack**, an interactive NAV / ADF / DME radio with editable standby frequencies
13
13
  - Pure SVG with no image files, so instruments stay sharp at any size and work with any bundler
14
14
  - Written in TypeScript and ships its type declarations
@@ -36,6 +36,8 @@ import {
36
36
  VerticalSpeed,
37
37
  TurnCoordinator,
38
38
  VorIndicator,
39
+ IlsIndicator,
40
+ HsiIndicator,
39
41
  AdfIndicator,
40
42
  RadioPanel,
41
43
  relativeBearing,
@@ -58,6 +60,8 @@ export function Panel({ data }) {
58
60
  <VerticalSpeed verticalSpeed={data.vs} />
59
61
  <WindIndicator runway={90} windDirection={data.windDir} windSpeed={data.windSpeed} />
60
62
  <VorIndicator course={data.obs} radial={data.navRadial} />
63
+ <IlsIndicator course={data.obs} radial={data.navRadial} glideslope={data.gsDeviation} />
64
+ <HsiIndicator heading={data.heading} headingBug={data.hdgBug} course={data.obs} radial={data.navRadial} glideslope={data.gsDeviation} />
61
65
  <AdfIndicator heading={data.heading} bearing={relativeBearing(data.heading, data.ndbBearing)} />
62
66
  <RadioPanel nav={{ active: data.nav1, standby: data.nav1Stby }} adf={{ active: data.adf }} dme={data.dme} />
63
67
  <FuelIndicator capacity={26} tanks={[{ name: 'Left', quantity: data.fuelL }, { name: 'Right', quantity: data.fuelR }]} />
@@ -85,6 +89,7 @@ Every instrument accepts these props:
85
89
  | ------------------- | ------------------ | ------- | --------------------------------------------------------- |
86
90
  | `size` | `number \| string` | `200` | Width and height. A number means pixels; a string can be any CSS length, e.g. `"100%"`. |
87
91
  | `showBox` | `boolean` | `true` | Draw the square mounting plate with screws. |
92
+ | `showKnobs` | `boolean` | `true` | Draw the setting knobs on instruments that have them: OBS on `VorIndicator` and `IlsIndicator`, CRS and HDG on `HsiIndicator`, baro on `Altimeter`, PUSH (gyro set) on `HeadingIndicator`, HDG on `AdfIndicator` and the adjustment knob on `AttitudeIndicator`. Each knob's rim turns with the value it sets. |
88
93
  | `animationDuration` | `number` | `300` | Animation time in ms. `0` turns animation off. |
89
94
  | `className` | `string` | | Class for the root `<svg>`. |
90
95
  | `style` | `CSSProperties` | | Inline style for the root `<svg>`. |
@@ -165,6 +170,55 @@ A VOR / course deviation indicator with an OBS card. The card turns so the selec
165
170
 
166
171
  `vorDeviation(course, radial)` is exported too and returns `{ deviation, toFrom }` if you want the same maths without the drawing.
167
172
 
173
+ ### `<IlsIndicator />`
174
+
175
+ A crossed-needle VOR / ILS head with an OBS card, as found in many light aircraft. The vertical needle shows course (VOR or localizer) deviation and the horizontal needle glideslope deviation, each over a scale of 5 dots either side of the centre circle. Small windows show TO (upper right) or FR (lower left), and orange flags with arrows drop into the window at the bottom when the NAV signal is lost and into the window on the right when there is no glideslope. Course inputs work just like `<VorIndicator />`: give `course` and `radial`, or pass `deviation` and `toFrom` directly.
176
+
177
+ | Prop | Type | Default | Description |
178
+ | --------------------- | ------------------------- | --------- | ------------------------------------------------------------------ |
179
+ | `course` | `number` | `0` | Selected course (OBS) in degrees. |
180
+ | `radial` | `number` | | Radial from the station the aircraft is on, in degrees. Drives the course needle and the TO/FROM window. |
181
+ | `deviation` | `number` | | Course deviation in degrees, positive when the course is to the right. Overrides `radial`. |
182
+ | `fullScale` | `number` | `10` | Course deviation at full scale (5 dots). `10` suits a VOR; use `2.5` for a localizer. |
183
+ | `toFrom` | `"TO" \| "FROM" \| "OFF"` | | TO/FROM indication. Overrides `radial`. |
184
+ | `signal` | `boolean` | `true` | `false` drops the NAV flag, centres the course needle and blanks TO/FROM. |
185
+ | `glideslope` | `number` | | Glideslope deviation in degrees, positive when the glidepath is above you (fly up). Leave it out when no glideslope is received. |
186
+ | `glideslopeFullScale` | `number` | `0.7` | Glideslope deviation at full scale (5 dots). |
187
+ | `glideslopeSignal` | `boolean` | | Whether the glideslope is received. Defaults to `true` when `glideslope` is a number; `false` drops the GS flag and parks the needle. |
188
+ | `needles` | `"slide" \| "swing"` | `"slide"` | `"slide"` moves both needles parallel to themselves over hatched scales. `"swing"` hinges the course needle near the bottom and the glideslope needle near the left, so they pivot like on older heads; without a glideslope the hinged needle is parked above the scale. |
189
+
190
+ ```tsx
191
+ // VOR only: the glideslope flag stays down.
192
+ <IlsIndicator course={270} radial={84} />
193
+ // ILS approach on a localizer, with the older hinged-needle look.
194
+ <IlsIndicator course={265} deviation={-0.8} fullScale={2.5} glideslope={0.2} needles="swing" />
195
+ ```
196
+
197
+ ### `<HsiIndicator />`
198
+
199
+ A horizontal situation indicator: a heading indicator and a VOR / ILS head in one dial. The compass card turns with the `heading` under a fixed aircraft symbol, so the instrument shows the course line the way you would see it from above. The yellow course pointer turns with the selected `course`, and its middle section, the deviation bar, slides sideways to show where the course line lies relative to the aircraft (2 dots each side). A white triangle points TO or FROM the station, an orange heading bug marks `headingBug`, and green pointers on both sides show glideslope deviation. Red flags show NAV when the signal is lost and GS when there is no glideslope. Course inputs work just like `<VorIndicator />` and `<IlsIndicator />`: give `course` and `radial`, or pass `deviation` and `toFrom` directly. The CRS knob (lower left) turns with the course and the HDG knob (lower right) with the heading bug.
200
+
201
+ | Prop | Type | Default | Description |
202
+ | --------------------- | ------------------------- | ------- | ------------------------------------------------------------------ |
203
+ | `heading` | `number` | `0` | Aircraft heading in degrees. Any value is accepted and wrapped to 0–359. |
204
+ | `headingBug` | `number` | | Heading bug in degrees. Leave it out to hide the bug. |
205
+ | `course` | `number` | `0` | Selected course in degrees. |
206
+ | `radial` | `number` | | Radial from the station the aircraft is on, in degrees. Drives the deviation bar and the TO/FROM triangle. |
207
+ | `deviation` | `number` | | Course deviation in degrees, positive when the course is to the right. Overrides `radial`. |
208
+ | `fullScale` | `number` | `10` | Course deviation at full scale (2 dots). `10` suits a VOR; use `2.5` for a localizer. |
209
+ | `toFrom` | `"TO" \| "FROM" \| "OFF"` | | TO/FROM indication. Overrides `radial`. |
210
+ | `signal` | `boolean` | `true` | `false` shows the NAV flag, centres the deviation bar and hides TO/FROM. |
211
+ | `glideslope` | `number` | | Glideslope deviation in degrees, positive when the glidepath is above you (fly up). Leave it out when no glideslope is received. |
212
+ | `glideslopeFullScale` | `number` | `0.7` | Glideslope deviation at full scale (2 dots). |
213
+ | `glideslopeSignal` | `boolean` | | Whether the glideslope is received. Defaults to `true` when `glideslope` is a number; `false` shows the GS flag and hides the pointers. |
214
+
215
+ ```tsx
216
+ // Tracking a VOR radial with the heading bug set to the intercept heading.
217
+ <HsiIndicator heading={60} headingBug={60} course={90} radial={262} />
218
+ // On an ILS approach: localizer sensitivity and glideslope.
219
+ <HsiIndicator heading={262} headingBug={265} course={265} deviation={-0.8} fullScale={2.5} glideslope={0.2} />
220
+ ```
221
+
168
222
  ### `<AdfIndicator />`
169
223
 
170
224
  An automatic direction finder. The needle points at the tuned NDB: give it the `bearing` of the station relative to the nose. With `heading` left at `0` it is a fixed-card ADF that reads relative bearing. Pass the aircraft `heading` and the card turns with it (a rotatable-card ADF or RMI), so the needle head reads the magnetic bearing to the station and the tail the bearing from it.
@@ -309,6 +363,7 @@ Each `DataField`:
309
363
  Examples live under [`examples/`](examples), one folder each:
310
364
 
311
365
  - [`examples/instruments`](examples/instruments): the gallery behind the live demo, with every instrument on simulated flight data and sliders to drive each one by hand.
366
+ - [`examples/instruments/navigation.html`](examples/instruments/navigation.tsx) ([live](https://flight-indicators.harvis.page/navigation.html)): VOR, ILS and HSI in depth. Track a radial around a VOR station on a map, fly an ILS approach with plan and profile views and LOC / GS failures, and browse snapshots of every needle and flag state with the props behind each one.
312
367
  - [IFR trainer](https://github.com/fordnox/ifr-trainer) (separate repository): a radio navigation simulator built with this library.
313
368
 
314
369
  ## Development