@eaprelsky/nocturna-wheel 3.1.0 → 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 +41 -1
- package/dist/assets/css/nocturna-wheel.css +16 -1
- package/dist/nocturna-wheel.bundle.js +35 -15
- package/dist/nocturna-wheel.bundle.js.map +1 -1
- package/dist/nocturna-wheel.es.js +35 -15
- 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 +35 -15
- 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
|
|
@@ -147,6 +147,10 @@
|
|
|
147
147
|
pointer-events: none;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
.projection-dot {
|
|
151
|
+
stroke-width: 0.5 !important;
|
|
152
|
+
}
|
|
153
|
+
|
|
150
154
|
/* Aspect elements */
|
|
151
155
|
.aspect-line {
|
|
152
156
|
transition: opacity 0.2s ease;
|
|
@@ -194,7 +198,7 @@
|
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
.nocturna-wheel-checkbox {
|
|
197
|
-
margin-right: 5px;
|
|
201
|
+
margin-right: 5px; /* Reverted to original value */
|
|
198
202
|
}
|
|
199
203
|
|
|
200
204
|
.nocturna-wheel-slider {
|
|
@@ -202,6 +206,17 @@
|
|
|
202
206
|
margin: 10px 0;
|
|
203
207
|
}
|
|
204
208
|
|
|
209
|
+
/* Bootstrap overrides for control alignment and spacing */
|
|
210
|
+
.form-check,
|
|
211
|
+
.form-switch {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.form-check-label {
|
|
217
|
+
margin-left: 10px; /* Add spacing between control and label */
|
|
218
|
+
}
|
|
219
|
+
|
|
205
220
|
/* Tooltips */
|
|
206
221
|
.nocturna-wheel-tooltip {
|
|
207
222
|
position: absolute;
|
|
@@ -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-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
|
|
@@ -2840,7 +2847,8 @@
|
|
|
2840
2847
|
const adjustedPositions = [...positions];
|
|
2841
2848
|
|
|
2842
2849
|
// The minimum angular distance needed to prevent overlap at base radius
|
|
2843
|
-
|
|
2850
|
+
// Add safety factor to ensure visual separation
|
|
2851
|
+
const minAngularDistance = (minDistance / baseRadius) * (180 / Math.PI) * 1.3; // 30% extra spacing
|
|
2844
2852
|
console.log(`PlanetPositionCalculator: Minimum angular distance: ${minAngularDistance.toFixed(2)}°`);
|
|
2845
2853
|
|
|
2846
2854
|
// Sort positions by longitude for overlap detection
|
|
@@ -2990,10 +2998,16 @@
|
|
|
2990
2998
|
static _distributeClusterByAngle(positions, radius, minAngularDistance, centerX, centerY, iconSize) {
|
|
2991
2999
|
const n = positions.length;
|
|
2992
3000
|
|
|
3001
|
+
// If only one planet, keep its original position
|
|
3002
|
+
if (n === 1) {
|
|
3003
|
+
this._setExactPosition(positions[0], positions[0].longitude, radius, centerX, centerY, iconSize);
|
|
3004
|
+
return;
|
|
3005
|
+
}
|
|
3006
|
+
|
|
2993
3007
|
// Sort positions by their original longitude to maintain order
|
|
2994
3008
|
positions.sort((a, b) => a.longitude - b.longitude);
|
|
2995
3009
|
|
|
2996
|
-
// Calculate central angle and total span
|
|
3010
|
+
// Calculate central angle and total span
|
|
2997
3011
|
const firstPos = positions[0].longitude;
|
|
2998
3012
|
const lastPos = positions[n-1].longitude;
|
|
2999
3013
|
let totalArc = lastPos - firstPos;
|
|
@@ -3003,26 +3017,25 @@
|
|
|
3003
3017
|
totalArc = (360 + lastPos - firstPos) % 360;
|
|
3004
3018
|
}
|
|
3005
3019
|
|
|
3006
|
-
// Calculate the center of the cluster
|
|
3007
|
-
let
|
|
3020
|
+
// Calculate the center of the cluster (weighted average of all positions)
|
|
3021
|
+
let sumAngles = 0;
|
|
3022
|
+
for (let i = 0; i < n; i++) {
|
|
3023
|
+
sumAngles += positions[i].longitude;
|
|
3024
|
+
}
|
|
3025
|
+
let centerAngle = (sumAngles / n) % 360;
|
|
3008
3026
|
|
|
3009
3027
|
// Determine minimum arc needed for n planets with minimum spacing
|
|
3010
|
-
|
|
3028
|
+
// Add extra spacing factor to ensure planets don't overlap
|
|
3029
|
+
const minRequiredArc = (n - 1) * minAngularDistance * 1.2; // 20% extra spacing
|
|
3011
3030
|
|
|
3012
|
-
//
|
|
3013
|
-
const spanToUse = Math.max(
|
|
3031
|
+
// Always use at least the minimum required arc
|
|
3032
|
+
const spanToUse = Math.max(minRequiredArc, totalArc);
|
|
3014
3033
|
|
|
3015
3034
|
// Calculate start angle (center - half of span)
|
|
3016
3035
|
const startAngle = (centerAngle - spanToUse/2 + 360) % 360;
|
|
3017
3036
|
|
|
3018
3037
|
// Distribute planets evenly from the start angle
|
|
3019
3038
|
for (let i = 0; i < n; i++) {
|
|
3020
|
-
// If only one planet, keep its original position
|
|
3021
|
-
if (n === 1) {
|
|
3022
|
-
this._setExactPosition(positions[i], positions[i].longitude, radius, centerX, centerY, iconSize);
|
|
3023
|
-
continue;
|
|
3024
|
-
}
|
|
3025
|
-
|
|
3026
3039
|
const angle = (startAngle + i * (spanToUse / (n-1))) % 360;
|
|
3027
3040
|
this._setExactPosition(positions[i], angle, radius, centerX, centerY, iconSize);
|
|
3028
3041
|
}
|
|
@@ -3994,7 +4007,7 @@
|
|
|
3994
4007
|
class: `projection-dot projection-${planet.name}`,
|
|
3995
4008
|
fill: 'none',
|
|
3996
4009
|
stroke: planet.color || '#666666',
|
|
3997
|
-
'stroke-width': '1
|
|
4010
|
+
'stroke-width': '1'
|
|
3998
4011
|
});
|
|
3999
4012
|
|
|
4000
4013
|
// Add tooltip
|
|
@@ -4910,6 +4923,13 @@
|
|
|
4910
4923
|
|
|
4911
4924
|
this.houses = options.houses || [];
|
|
4912
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
|
+
|
|
4913
4933
|
// Override aspect settings if provided (legacy support)
|
|
4914
4934
|
if (options.aspectSettings) {
|
|
4915
4935
|
this.config.updateAspectSettings(options.aspectSettings);
|