@eaprelsky/nocturna-wheel 3.1.1 → 4.0.0

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,6 +8,7 @@ A JavaScript library for rendering astrological natal charts.
8
8
  - **Dual chart support** - independent inner and outer circles for synastry and transit charts
9
9
  - **Zodiac sign display** with customizable styling
10
10
  - **House system rendering** with multiple system options (Placidus, Koch, Equal, etc.)
11
+ - **Automatic wheel rotation** - chart automatically positions Ascendant at 9 o'clock when house data is provided
11
12
  - **Planet placement** with customizable icons and colors on two independent circles
12
13
  - **Three types of aspects:**
13
14
  - Primary aspects (outer circle to outer circle)
@@ -169,10 +170,49 @@ const chart = new NocturnaWheel.WheelChart({
169
170
  - `togglePrimaryAspects(visible)`: Toggles visibility of primary aspects (outer circle)
170
171
  - `toggleSecondaryAspects(visible)`: Toggles visibility of secondary aspects (inner circle)
171
172
  - `toggleSynastryAspects(visible)`: Toggles visibility of synastry aspects (cross-circle)
172
- - `setHouseRotation(angle)`: Sets house system rotation
173
+ - `setHouseRotation(angle)`: Sets house system rotation (optional - automatic rotation is enabled by default)
173
174
  - `setHouseSystem(name)`: Changes the house system
174
175
  - `destroy()`: Removes the chart and cleans up resources
175
176
 
177
+ ### Automatic Wheel Rotation
178
+
179
+ The library **automatically rotates** the zodiac wheel to position the Ascendant (1st house cusp) at the 9 o'clock position when house data is provided. This happens in two ways:
180
+
181
+ 1. **When providing a `houses` array**: The first house cusp longitude (`houses[0].lon`) is used for rotation
182
+ 2. **When using `astronomicalData.ascendant`**: The ascendant value is used for rotation
183
+
184
+ ```javascript
185
+ // Auto-rotation with houses array
186
+ const chart = new WheelChart({
187
+ container: '#chart',
188
+ houses: [
189
+ { lon: 300.32 }, // Ascendant - automatically used for rotation
190
+ // ... other houses
191
+ ]
192
+ });
193
+
194
+ // Auto-rotation with astronomicalData
195
+ const chart = new WheelChart({
196
+ container: '#chart',
197
+ config: {
198
+ astronomicalData: {
199
+ ascendant: 120.5, // Automatically used for rotation
200
+ mc: 210.5,
201
+ latitude: 55.75,
202
+ houseSystem: "Placidus"
203
+ }
204
+ }
205
+ });
206
+ ```
207
+
208
+ **Manual override**: You can still override the automatic rotation by calling `setHouseRotation()` after initialization:
209
+
210
+ ```javascript
211
+ chart.setHouseRotation(90); // Custom rotation angle
212
+ ```
213
+
214
+ For more details, see [Auto-Rotation Documentation](docs/AUTO_ROTATION.md).
215
+
176
216
  ## Advanced Configuration
177
217
 
178
218
  ### ChartConfig Options
@@ -293,7 +293,7 @@
293
293
  /**
294
294
  * IconData.js
295
295
  * Auto-generated module containing inline SVG icons as data URLs
296
- * Generated at: 2025-11-21T17:08:56.476Z
296
+ * Generated at: 2025-11-23T10:05:26.626Z
297
297
  *
298
298
  * This file is automatically generated by the build process.
299
299
  * Do not edit manually - changes will be overwritten.
@@ -1131,6 +1131,13 @@
1131
1131
  mc: this.astronomicalData.mc
1132
1132
  }
1133
1133
  );
1134
+
1135
+ // Auto-rotate the wheel to position the Ascendant at 9 o'clock
1136
+ // Only set if not already explicitly configured
1137
+ if (this.houseCusps.length > 0 && this.houseSettings.rotationAngle === 0) {
1138
+ console.log(`ChartConfig: Auto-rotating wheel to Ascendant at ${this.astronomicalData.ascendant}°`);
1139
+ this.houseSettings.rotationAngle = this.astronomicalData.ascendant;
1140
+ }
1134
1141
  } catch (error) {
1135
1142
  console.error("Failed to calculate house cusps:", error?.message || error);
1136
1143
  // Set empty cusps array if calculation fails
@@ -4916,6 +4923,13 @@
4916
4923
 
4917
4924
  this.houses = options.houses || [];
4918
4925
 
4926
+ // Auto-rotate the wheel if houses are provided
4927
+ // This ensures the Ascendant (1st house cusp) is positioned at 9 o'clock
4928
+ if (this.houses.length > 0 && this.houses[0] && typeof this.houses[0].lon === 'number') {
4929
+ console.log(`NocturnaWheel: Auto-rotating wheel to Ascendant at ${this.houses[0].lon}°`);
4930
+ this.config.houseSettings.rotationAngle = this.houses[0].lon;
4931
+ }
4932
+
4919
4933
  // Override aspect settings if provided (legacy support)
4920
4934
  if (options.aspectSettings) {
4921
4935
  this.config.updateAspectSettings(options.aspectSettings);