@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.
@@ -287,7 +287,7 @@ class IconProvider {
287
287
  /**
288
288
  * IconData.js
289
289
  * Auto-generated module containing inline SVG icons as data URLs
290
- * Generated at: 2025-11-21T17:08:55.797Z
290
+ * Generated at: 2025-11-27T18:13:39.048Z
291
291
  *
292
292
  * This file is automatically generated by the build process.
293
293
  * Do not edit manually - changes will be overwritten.
@@ -1125,6 +1125,13 @@ class ChartConfig {
1125
1125
  mc: this.astronomicalData.mc
1126
1126
  }
1127
1127
  );
1128
+
1129
+ // Auto-rotate the wheel to position the Ascendant at 9 o'clock
1130
+ // Only set if not already explicitly configured
1131
+ if (this.houseCusps.length > 0 && this.houseSettings.rotationAngle === 0) {
1132
+ console.log(`ChartConfig: Auto-rotating wheel to Ascendant at ${this.astronomicalData.ascendant}°`);
1133
+ this.houseSettings.rotationAngle = this.astronomicalData.ascendant;
1134
+ }
1128
1135
  } catch (error) {
1129
1136
  console.error("Failed to calculate house cusps:", error?.message || error);
1130
1137
  // Set empty cusps array if calculation fails
@@ -2325,17 +2332,37 @@ class HouseRenderer extends BaseRenderer {
2325
2332
  ascendantAlignmentOffset = (360 - ascendantLon) % 360;
2326
2333
  }
2327
2334
 
2328
- // Add Roman numerals for house numbers
2335
+ // Create array of houses with their rotated angles and original indices
2336
+ const housesWithAngles = [];
2329
2337
  for (let i = 0; i < 12; i++) {
2330
- // Get house angle with rotation
2331
- let baseHouseAngle;
2338
+ let baseAngle;
2332
2339
  if (this.houseData && this.houseData.length >= 12) {
2333
- baseHouseAngle = this.getHouseLongitude(this.houseData[i]);
2340
+ baseAngle = this.getHouseLongitude(this.houseData[i]);
2334
2341
  } else {
2335
- baseHouseAngle = i * 30; // Default if no data
2342
+ baseAngle = i * 30; // Default if no data
2336
2343
  }
2337
- // Apply alignment offset and user rotation
2338
- const houseAngle = (baseHouseAngle + ascendantAlignmentOffset + rotationAngle) % 360;
2344
+ const rotatedAngle = (baseAngle + ascendantAlignmentOffset + rotationAngle) % 360;
2345
+
2346
+ housesWithAngles.push({
2347
+ originalIndex: i,
2348
+ baseAngle: baseAngle,
2349
+ rotatedAngle: rotatedAngle
2350
+ });
2351
+ }
2352
+
2353
+ // Sort by rotated angle to determine visual order
2354
+ housesWithAngles.sort((a, b) => a.rotatedAngle - b.rotatedAngle);
2355
+
2356
+ // Find which house is Ascendant (originally index 0) after rotation
2357
+ const ascendantVisualIndex = housesWithAngles.findIndex(h => h.originalIndex === 0);
2358
+
2359
+ // Render houses with correct numbering based on visual position
2360
+ housesWithAngles.forEach((house, visualIndex) => {
2361
+ const houseAngle = house.rotatedAngle;
2362
+
2363
+ // Calculate house number based on position relative to Ascendant
2364
+ // Counter-clockwise from Ascendant
2365
+ const houseNumber = ((visualIndex - ascendantVisualIndex + 12) % 12) + 1;
2339
2366
 
2340
2367
  // Offset text from house line clockwise
2341
2368
  const angle = (houseAngle + 15) % 360; // Place in middle of house segment, apply modulo
@@ -2371,15 +2398,15 @@ class HouseRenderer extends BaseRenderer {
2371
2398
  text.setAttribute("dominant-baseline", "middle");
2372
2399
  }
2373
2400
 
2374
- // Set house number as text (Roman numeral)
2375
- text.textContent = AstrologyUtils.houseToRoman(i + 1);
2401
+ // Set house number as text (Roman numeral) - now based on visual position
2402
+ text.textContent = AstrologyUtils.houseToRoman(houseNumber);
2376
2403
 
2377
2404
  // Add tooltip with house information
2378
- this.svgUtils.addTooltip(text, `House ${i + 1}`);
2405
+ this.svgUtils.addTooltip(text, `House ${houseNumber}`);
2379
2406
 
2380
2407
  parentGroup.appendChild(text);
2381
2408
  elements.push(text);
2382
- }
2409
+ });
2383
2410
 
2384
2411
  return elements;
2385
2412
  }
@@ -4910,6 +4937,13 @@ class NocturnaWheel {
4910
4937
 
4911
4938
  this.houses = options.houses || [];
4912
4939
 
4940
+ // Auto-rotate the wheel if houses are provided
4941
+ // This ensures the Ascendant (1st house cusp) is positioned at 9 o'clock
4942
+ if (this.houses.length > 0 && this.houses[0] && typeof this.houses[0].lon === 'number') {
4943
+ console.log(`NocturnaWheel: Auto-rotating wheel to Ascendant at ${this.houses[0].lon}°`);
4944
+ this.config.houseSettings.rotationAngle = this.houses[0].lon;
4945
+ }
4946
+
4913
4947
  // Override aspect settings if provided (legacy support)
4914
4948
  if (options.aspectSettings) {
4915
4949
  this.config.updateAspectSettings(options.aspectSettings);