@eaprelsky/nocturna-wheel 3.1.1 → 4.0.1
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 +41 -1
- package/dist/nocturna-wheel.bundle.js +46 -12
- package/dist/nocturna-wheel.bundle.js.map +1 -1
- package/dist/nocturna-wheel.es.js +46 -12
- package/dist/nocturna-wheel.es.js.map +1 -1
- package/dist/nocturna-wheel.min.js +1 -1
- package/dist/nocturna-wheel.min.js.map +1 -1
- package/dist/nocturna-wheel.umd.js +46 -12
- package/dist/nocturna-wheel.umd.js.map +1 -1
- package/package.json +1 -1
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-
|
|
296
|
+
* Generated at: 2025-11-27T18:13:39.810Z
|
|
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
|
|
@@ -2331,17 +2338,37 @@
|
|
|
2331
2338
|
ascendantAlignmentOffset = (360 - ascendantLon) % 360;
|
|
2332
2339
|
}
|
|
2333
2340
|
|
|
2334
|
-
//
|
|
2341
|
+
// Create array of houses with their rotated angles and original indices
|
|
2342
|
+
const housesWithAngles = [];
|
|
2335
2343
|
for (let i = 0; i < 12; i++) {
|
|
2336
|
-
|
|
2337
|
-
let baseHouseAngle;
|
|
2344
|
+
let baseAngle;
|
|
2338
2345
|
if (this.houseData && this.houseData.length >= 12) {
|
|
2339
|
-
|
|
2346
|
+
baseAngle = this.getHouseLongitude(this.houseData[i]);
|
|
2340
2347
|
} else {
|
|
2341
|
-
|
|
2348
|
+
baseAngle = i * 30; // Default if no data
|
|
2342
2349
|
}
|
|
2343
|
-
|
|
2344
|
-
|
|
2350
|
+
const rotatedAngle = (baseAngle + ascendantAlignmentOffset + rotationAngle) % 360;
|
|
2351
|
+
|
|
2352
|
+
housesWithAngles.push({
|
|
2353
|
+
originalIndex: i,
|
|
2354
|
+
baseAngle: baseAngle,
|
|
2355
|
+
rotatedAngle: rotatedAngle
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
// Sort by rotated angle to determine visual order
|
|
2360
|
+
housesWithAngles.sort((a, b) => a.rotatedAngle - b.rotatedAngle);
|
|
2361
|
+
|
|
2362
|
+
// Find which house is Ascendant (originally index 0) after rotation
|
|
2363
|
+
const ascendantVisualIndex = housesWithAngles.findIndex(h => h.originalIndex === 0);
|
|
2364
|
+
|
|
2365
|
+
// Render houses with correct numbering based on visual position
|
|
2366
|
+
housesWithAngles.forEach((house, visualIndex) => {
|
|
2367
|
+
const houseAngle = house.rotatedAngle;
|
|
2368
|
+
|
|
2369
|
+
// Calculate house number based on position relative to Ascendant
|
|
2370
|
+
// Counter-clockwise from Ascendant
|
|
2371
|
+
const houseNumber = ((visualIndex - ascendantVisualIndex + 12) % 12) + 1;
|
|
2345
2372
|
|
|
2346
2373
|
// Offset text from house line clockwise
|
|
2347
2374
|
const angle = (houseAngle + 15) % 360; // Place in middle of house segment, apply modulo
|
|
@@ -2377,15 +2404,15 @@
|
|
|
2377
2404
|
text.setAttribute("dominant-baseline", "middle");
|
|
2378
2405
|
}
|
|
2379
2406
|
|
|
2380
|
-
// Set house number as text (Roman numeral)
|
|
2381
|
-
text.textContent = AstrologyUtils.houseToRoman(
|
|
2407
|
+
// Set house number as text (Roman numeral) - now based on visual position
|
|
2408
|
+
text.textContent = AstrologyUtils.houseToRoman(houseNumber);
|
|
2382
2409
|
|
|
2383
2410
|
// Add tooltip with house information
|
|
2384
|
-
this.svgUtils.addTooltip(text, `House ${
|
|
2411
|
+
this.svgUtils.addTooltip(text, `House ${houseNumber}`);
|
|
2385
2412
|
|
|
2386
2413
|
parentGroup.appendChild(text);
|
|
2387
2414
|
elements.push(text);
|
|
2388
|
-
}
|
|
2415
|
+
});
|
|
2389
2416
|
|
|
2390
2417
|
return elements;
|
|
2391
2418
|
}
|
|
@@ -4916,6 +4943,13 @@
|
|
|
4916
4943
|
|
|
4917
4944
|
this.houses = options.houses || [];
|
|
4918
4945
|
|
|
4946
|
+
// Auto-rotate the wheel if houses are provided
|
|
4947
|
+
// This ensures the Ascendant (1st house cusp) is positioned at 9 o'clock
|
|
4948
|
+
if (this.houses.length > 0 && this.houses[0] && typeof this.houses[0].lon === 'number') {
|
|
4949
|
+
console.log(`NocturnaWheel: Auto-rotating wheel to Ascendant at ${this.houses[0].lon}°`);
|
|
4950
|
+
this.config.houseSettings.rotationAngle = this.houses[0].lon;
|
|
4951
|
+
}
|
|
4952
|
+
|
|
4919
4953
|
// Override aspect settings if provided (legacy support)
|
|
4920
4954
|
if (options.aspectSettings) {
|
|
4921
4955
|
this.config.updateAspectSettings(options.aspectSettings);
|