flight-indicators 1.2.0 → 1.2.2

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
+ - Sixteen instruments: **Attitude**, **Heading**, **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,7 @@ import {
36
36
  VerticalSpeed,
37
37
  TurnCoordinator,
38
38
  VorIndicator,
39
+ IlsIndicator,
39
40
  AdfIndicator,
40
41
  RadioPanel,
41
42
  relativeBearing,
@@ -58,6 +59,7 @@ export function Panel({ data }) {
58
59
  <VerticalSpeed verticalSpeed={data.vs} />
59
60
  <WindIndicator runway={90} windDirection={data.windDir} windSpeed={data.windSpeed} />
60
61
  <VorIndicator course={data.obs} radial={data.navRadial} />
62
+ <IlsIndicator course={data.obs} radial={data.navRadial} glideslope={data.gsDeviation} />
61
63
  <AdfIndicator heading={data.heading} bearing={relativeBearing(data.heading, data.ndbBearing)} />
62
64
  <RadioPanel nav={{ active: data.nav1, standby: data.nav1Stby }} adf={{ active: data.adf }} dme={data.dme} />
63
65
  <FuelIndicator capacity={26} tanks={[{ name: 'Left', quantity: data.fuelL }, { name: 'Right', quantity: data.fuelR }]} />
@@ -161,9 +163,34 @@ A VOR / course deviation indicator with an OBS card. The card turns so the selec
161
163
  | `deviation` | `number` | | Course deviation in degrees, positive when the course is to the right. Clamped to ±10. Overrides `radial`. |
162
164
  | `toFrom` | `"TO" \| "FROM" \| "OFF"` | | TO/FROM flag. Overrides `radial`. `"OFF"` hides both triangles. |
163
165
  | `signal` | `boolean` | `true` | `false` shows the red NAV flag, centres the needle and hides TO/FROM. |
166
+ | `needle` | `"slide" \| "swing"` | `"slide"` | How the needle moves. `"slide"` moves a vertical bar sideways over a straight row of dots. `"swing"` hinges the needle just below the top index so it swings like a pendulum over a curved row of dots, as on older VOR heads, with a TO/FR window on the right. |
164
167
 
165
168
  `vorDeviation(course, radial)` is exported too and returns `{ deviation, toFrom }` if you want the same maths without the drawing.
166
169
 
170
+ ### `<IlsIndicator />`
171
+
172
+ 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. An OBS knob is drawn on the mounting plate. Course inputs work just like `<VorIndicator />`: give `course` and `radial`, or pass `deviation` and `toFrom` directly.
173
+
174
+ | Prop | Type | Default | Description |
175
+ | --------------------- | ------------------------- | --------- | ------------------------------------------------------------------ |
176
+ | `course` | `number` | `0` | Selected course (OBS) in degrees. |
177
+ | `radial` | `number` | | Radial from the station the aircraft is on, in degrees. Drives the course needle and the TO/FROM window. |
178
+ | `deviation` | `number` | | Course deviation in degrees, positive when the course is to the right. Overrides `radial`. |
179
+ | `fullScale` | `number` | `10` | Course deviation at full scale (5 dots). `10` suits a VOR; use `2.5` for a localizer. |
180
+ | `toFrom` | `"TO" \| "FROM" \| "OFF"` | | TO/FROM indication. Overrides `radial`. |
181
+ | `signal` | `boolean` | `true` | `false` drops the NAV flag, centres the course needle and blanks TO/FROM. |
182
+ | `glideslope` | `number` | | Glideslope deviation in degrees, positive when the glidepath is above you (fly up). Leave it out when no glideslope is received. |
183
+ | `glideslopeFullScale` | `number` | `0.7` | Glideslope deviation at full scale (5 dots). |
184
+ | `glideslopeSignal` | `boolean` | | Whether the glideslope is received. Defaults to `true` when `glideslope` is a number; `false` drops the GS flag and parks the needle. |
185
+ | `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. |
186
+
187
+ ```tsx
188
+ // VOR only: the glideslope flag stays down.
189
+ <IlsIndicator course={270} radial={84} />
190
+ // ILS approach on a localizer, with the older hinged-needle look.
191
+ <IlsIndicator course={265} deviation={-0.8} fullScale={2.5} glideslope={0.2} needles="swing" />
192
+ ```
193
+
167
194
  ### `<AdfIndicator />`
168
195
 
169
196
  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.
@@ -303,6 +330,13 @@ Each `DataField`:
303
330
  | `decimals` | `number` | `0` | Decimal places for numeric values. |
304
331
  | `color` | `string` | white | Colour of the value text, e.g. amber for a caution. |
305
332
 
333
+ ## Examples
334
+
335
+ Examples live under [`examples/`](examples), one folder each:
336
+
337
+ - [`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.
338
+ - [IFR trainer](https://github.com/fordnox/ifr-trainer) (separate repository): a radio navigation simulator built with this library.
339
+
306
340
  ## Development
307
341
 
308
342
  ```bash