kaabalah 6.9.0 → 6.11.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/dist/{chunk-THD4XOYR.mjs → chunk-4MACEIWO.mjs} +447 -365
- package/dist/chunk-4MACEIWO.mjs.map +1 -0
- package/dist/{chunk-3C235FNN.js → chunk-XUD2HQUG.js} +446 -365
- package/dist/chunk-XUD2HQUG.js.map +1 -0
- package/dist/cli.js +448 -404
- package/dist/cli.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -46
- package/dist/index.mjs +1 -1
- package/dist/visual/index.d.mts +94 -73
- package/dist/visual/index.d.ts +94 -73
- package/dist/visual/index.js +42 -46
- package/dist/visual/index.mjs +1 -1
- package/package.json +2 -1
- package/dist/chunk-3C235FNN.js.map +0 -1
- package/dist/chunk-THD4XOYR.mjs.map +0 -1
|
@@ -164,12 +164,13 @@ function getArcheometerRenderModel(options = {}) {
|
|
|
164
164
|
};
|
|
165
165
|
const frameRadius = round(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
|
|
166
166
|
const outerRadius = round(Math.max(0, frameRadius - ARCHEOMETER_OUTER_CROWN_BLEED * scale));
|
|
167
|
-
|
|
167
|
+
const rings = buildRings(outerRadius, frameRadius);
|
|
168
|
+
const modelBase = {
|
|
168
169
|
viewBox,
|
|
169
170
|
center,
|
|
170
171
|
outerRadius,
|
|
171
172
|
scale,
|
|
172
|
-
rings
|
|
173
|
+
rings,
|
|
173
174
|
palette: resolvePalette(options.palette),
|
|
174
175
|
rotationDegrees: options.rotationDegrees ?? 0,
|
|
175
176
|
layers: { ...DEFAULT_LAYERS, ...options.layers ?? {} },
|
|
@@ -181,6 +182,10 @@ function getArcheometerRenderModel(options = {}) {
|
|
|
181
182
|
zodiacSigns: options.zodiacSigns ?? DEFAULT_ARCHEOMETER_ZODIAC,
|
|
182
183
|
planetaryPoints: options.planetaryPoints ?? DEFAULT_ARCHEOMETER_PLANETS
|
|
183
184
|
};
|
|
185
|
+
return {
|
|
186
|
+
...modelBase,
|
|
187
|
+
geometry: buildArcheometerGeometry(modelBase)
|
|
188
|
+
};
|
|
184
189
|
}
|
|
185
190
|
var DEFAULT_ARCHETYPE_UTTERANCE = DEFAULT_ARCHEOMETER_UTTERANCE;
|
|
186
191
|
var DEFAULT_ARCHETYPE_TRIANGLES = DEFAULT_ARCHEOMETER_TRIANGLES;
|
|
@@ -296,7 +301,6 @@ function renderDegreeCrown(push, model) {
|
|
|
296
301
|
function renderZodiacUtterance(push, model) {
|
|
297
302
|
const { center, rings, palette, scale } = model;
|
|
298
303
|
const ring = rings.zodiacUtterance;
|
|
299
|
-
const sorted = sortedByDegree(model.utterance);
|
|
300
304
|
push(`<g id="archeometer-zodiacal-utterance" aria-label="zodiacal crown of the utterance">`);
|
|
301
305
|
for (let i = 0; i < 12; i++) {
|
|
302
306
|
const degree = i * 30;
|
|
@@ -314,9 +318,9 @@ function renderZodiacUtterance(push, model) {
|
|
|
314
318
|
)}" stroke-opacity="0.34" stroke-width="${fmt(0.7 * scale)}"/>`
|
|
315
319
|
);
|
|
316
320
|
}
|
|
317
|
-
for (const
|
|
318
|
-
const
|
|
319
|
-
const p =
|
|
321
|
+
for (const geometry of model.geometry.utterancePoints) {
|
|
322
|
+
const point = geometry.data;
|
|
323
|
+
const p = geometry.anchor;
|
|
320
324
|
const shieldR = (ring.r2 - ring.r1) * 0.22;
|
|
321
325
|
const letterParts = point.letter.split(",").map((part) => part.trim()).filter(Boolean);
|
|
322
326
|
const isStacked = letterParts.length > 1;
|
|
@@ -345,11 +349,11 @@ function renderPlanetaryUtterance(push, model) {
|
|
|
345
349
|
const { center, rings, palette, scale } = model;
|
|
346
350
|
const ring = rings.planetaryUtterance;
|
|
347
351
|
const clipOuter = planetaryTriangleClipOuterRadius(rings);
|
|
348
|
-
const vertexRadius = clipOuter;
|
|
349
352
|
push(`<g id="archeometer-planetary-utterance" aria-label="four trigones of the planetary utterance">`);
|
|
350
353
|
push(`<g clip-path="url(#archeometer-planetary-clip)">`);
|
|
351
|
-
for (const
|
|
352
|
-
const
|
|
354
|
+
for (const triangleGeometry of model.geometry.triangles) {
|
|
355
|
+
const triangle = triangleGeometry.data;
|
|
356
|
+
const vertices = triangleGeometry.vertices;
|
|
353
357
|
if (triangle.vertexFills) {
|
|
354
358
|
const centroid = polygonCentroid(vertices);
|
|
355
359
|
const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
|
|
@@ -358,17 +362,18 @@ function renderPlanetaryUtterance(push, model) {
|
|
|
358
362
|
const nextMidpoint = midpoints[index];
|
|
359
363
|
push(`<path class="archeometer-trigone-vertex-fill" data-triangle="${escapeAttr(triangle.id)}" data-degree="${fmt(normalizeDegrees(triangle.vertices[index]))}" d="${polygonPath([vertex, nextMidpoint, centroid, previousMidpoint])}" fill="${escapeAttr(triangle.vertexFills[index])}" fill-opacity="0.54" stroke="none"/>`);
|
|
360
364
|
}
|
|
361
|
-
push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${
|
|
365
|
+
push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${triangleGeometry.path}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.82" stroke-width="${fmt(1.35 * scale)}"/>`);
|
|
362
366
|
} else {
|
|
363
|
-
push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${
|
|
367
|
+
push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${triangleGeometry.path}" fill="${escapeAttr(triangle.fill)}" fill-opacity="0.52" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.82" stroke-width="${fmt(1.35 * scale)}"/>`);
|
|
364
368
|
}
|
|
365
369
|
}
|
|
366
370
|
push(`</g>`);
|
|
367
|
-
for (const
|
|
371
|
+
for (const labelGeometry of model.geometry.triangleLabels) {
|
|
372
|
+
const label = labelGeometry.data;
|
|
368
373
|
if (!label.label)
|
|
369
374
|
continue;
|
|
370
375
|
const a = angleOf(model, label.degree);
|
|
371
|
-
const labelPoint =
|
|
376
|
+
const labelPoint = labelGeometry.anchor;
|
|
372
377
|
push(textSvg(label.label, labelPoint, 12 * scale, palette.ink, 0, "middle", 700));
|
|
373
378
|
if (label.number !== void 0) {
|
|
374
379
|
const numberPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.8, a);
|
|
@@ -398,10 +403,11 @@ function renderCosmologicalMusic(push, model) {
|
|
|
398
403
|
push(`<path class="archeometer-music-staff-line" data-degree="${fmt(normalizeDegrees(note.degree))}" d="${arcSegmentPath(center, r, start, end)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.58" stroke-width="${fmt(0.48 * scale)}" stroke-linecap="round"/>`);
|
|
399
404
|
}
|
|
400
405
|
}
|
|
401
|
-
for (const
|
|
406
|
+
for (const noteGeometry of model.geometry.musicalNotes) {
|
|
407
|
+
const note = noteGeometry.data;
|
|
402
408
|
if (!note.note)
|
|
403
409
|
continue;
|
|
404
|
-
const p =
|
|
410
|
+
const p = noteGeometry.anchor;
|
|
405
411
|
push(textSvg(note.note, p, 11.8 * scale, palette.ink, tangentRotation(angleOf(model, note.degree)), "middle", 700));
|
|
406
412
|
}
|
|
407
413
|
push(`</g>`);
|
|
@@ -411,7 +417,8 @@ function renderAstralZodiac(push, model) {
|
|
|
411
417
|
const ring = rings.astralZodiac;
|
|
412
418
|
const ringWidth = ring.r2 - ring.r1;
|
|
413
419
|
push(`<g id="archeometer-astral-zodiac" aria-label="astral zodiacal crown">`);
|
|
414
|
-
for (const
|
|
420
|
+
for (const signGeometry of model.geometry.zodiacSigns) {
|
|
421
|
+
const sign = signGeometry.data;
|
|
415
422
|
const sector = annularSectorPath(
|
|
416
423
|
center,
|
|
417
424
|
ring.r1,
|
|
@@ -429,9 +436,10 @@ function renderAstralZodiac(push, model) {
|
|
|
429
436
|
}
|
|
430
437
|
const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
|
|
431
438
|
const glyphSize = 17.5 * scale;
|
|
432
|
-
for (const
|
|
439
|
+
for (const signGeometry of model.geometry.zodiacSigns) {
|
|
440
|
+
const sign = signGeometry.data;
|
|
433
441
|
const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
|
|
434
|
-
const p =
|
|
442
|
+
const p = signGeometry.anchor;
|
|
435
443
|
push(
|
|
436
444
|
`<g class="archeometer-zodiac-sign" data-sign="${escapeAttr(sign.name)}" data-degree="${fmt(
|
|
437
445
|
normalizeDegrees(sign.degree)
|
|
@@ -452,7 +460,8 @@ function renderAstralPlanetary(push, model) {
|
|
|
452
460
|
const ring = rings.astralPlanetary;
|
|
453
461
|
const ringWidth = ring.r2 - ring.r1;
|
|
454
462
|
push(`<g id="archeometer-astral-planetary" aria-label="astral planetary crown">`);
|
|
455
|
-
for (const
|
|
463
|
+
for (const planetGeometry of model.geometry.planetaryPoints) {
|
|
464
|
+
const planet = planetGeometry.data;
|
|
456
465
|
const pointColor = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ringFills.astralPlanetary;
|
|
457
466
|
const sector = annularSectorPath(
|
|
458
467
|
center,
|
|
@@ -473,8 +482,9 @@ function renderAstralPlanetary(push, model) {
|
|
|
473
482
|
push(lineSvg(line, palette.ringStroke, 0.6 * scale, 0.42, "archeometer-astral-planetary-divider", ` data-degree="${fmt(degree)}"`));
|
|
474
483
|
}
|
|
475
484
|
const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
|
|
476
|
-
for (const
|
|
477
|
-
const
|
|
485
|
+
for (const planetGeometry of model.geometry.planetaryPoints) {
|
|
486
|
+
const planet = planetGeometry.data;
|
|
487
|
+
const p = planetGeometry.anchor;
|
|
478
488
|
const color = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ink;
|
|
479
489
|
const glyphSize = (planet.name === "Moon" ? 17 : 18.5) * scale;
|
|
480
490
|
push(
|
|
@@ -636,6 +646,84 @@ function renderFrame(push, model) {
|
|
|
636
646
|
);
|
|
637
647
|
push(`</g>`);
|
|
638
648
|
}
|
|
649
|
+
function buildArcheometerGeometry(model) {
|
|
650
|
+
const { center, rings, scale } = model;
|
|
651
|
+
const utteranceRing = rings.zodiacUtterance;
|
|
652
|
+
const triangleLabelRing = rings.planetaryUtterance;
|
|
653
|
+
const musicRing = rings.cosmologicalMusic;
|
|
654
|
+
const zodiacRing = rings.astralZodiac;
|
|
655
|
+
const planetRing = rings.astralPlanetary;
|
|
656
|
+
const planetaryClipOuter = planetaryTriangleClipOuterRadius(rings);
|
|
657
|
+
const whiteRaySolarRadius = rings.solarCenter.r2;
|
|
658
|
+
const pointHitRadius = Math.max(11 * scale, 8);
|
|
659
|
+
const element = (layerId, idPrefix, item, radius, hitRadius = pointHitRadius) => {
|
|
660
|
+
const anchor = polarToXY(center, radius, angleOf(model, item.degree));
|
|
661
|
+
return {
|
|
662
|
+
id: `${idPrefix}-${slugForGeometry(item.id ?? item.name ?? item.note ?? item.label ?? item.degree)}`,
|
|
663
|
+
layerId,
|
|
664
|
+
data: item,
|
|
665
|
+
degree: normalizeDegrees(item.degree),
|
|
666
|
+
anchor,
|
|
667
|
+
hitTarget: { kind: "circle", cx: anchor.x, cy: anchor.y, r: hitRadius }
|
|
668
|
+
};
|
|
669
|
+
};
|
|
670
|
+
const triangles = model.triangles.map((triangle) => {
|
|
671
|
+
const vertices = triangle.vertices.map(
|
|
672
|
+
(degree) => polarToXY(center, planetaryClipOuter, angleOf(model, degree))
|
|
673
|
+
);
|
|
674
|
+
const centroid = polygonCentroid(vertices);
|
|
675
|
+
return {
|
|
676
|
+
id: `triangle-${slugForGeometry(triangle.id)}`,
|
|
677
|
+
layerId: "planetaryUtterance",
|
|
678
|
+
data: triangle,
|
|
679
|
+
vertices,
|
|
680
|
+
centroid,
|
|
681
|
+
path: polygonPath(vertices),
|
|
682
|
+
hitTarget: { kind: "polygon", points: vertices }
|
|
683
|
+
};
|
|
684
|
+
});
|
|
685
|
+
const degreeTicks = Array.from({ length: 12 }, (_, index) => {
|
|
686
|
+
const degree = index * 30;
|
|
687
|
+
const angle = angleOf(model, degree);
|
|
688
|
+
return {
|
|
689
|
+
id: `degree-${degree}`,
|
|
690
|
+
degree,
|
|
691
|
+
outerAnchor: polarToXY(center, (rings.degreeOuter.r1 + rings.degreeOuter.r2) / 2, angle),
|
|
692
|
+
innerAnchor: polarToXY(center, (rings.degreeInner.r1 + rings.degreeInner.r2) / 2, angle)
|
|
693
|
+
};
|
|
694
|
+
});
|
|
695
|
+
const rays = Array.from({ length: 12 }, (_, index) => index * 30).filter((degree) => degree !== 90 && degree !== 270).map((degree) => ({
|
|
696
|
+
id: `white-ray-${degree}`,
|
|
697
|
+
degree,
|
|
698
|
+
layerId: "whiteRays",
|
|
699
|
+
line: lineFromPolar(center, whiteRaySolarRadius, 3.3, angleOf(model, degree))
|
|
700
|
+
}));
|
|
701
|
+
return {
|
|
702
|
+
utterancePoints: sortedByDegree(model.utterance).map(
|
|
703
|
+
(point) => element("zodiacUtterance", "utterance", point, utteranceRing.r1 + (utteranceRing.r2 - utteranceRing.r1) * 0.58)
|
|
704
|
+
),
|
|
705
|
+
triangles,
|
|
706
|
+
triangleLabels: sortedByDegree(model.triangleLabels).map(
|
|
707
|
+
(label) => element("triangleLabels", "triangle-label", label, triangleLabelRing.r1 + (planetaryClipOuter - triangleLabelRing.r1) * 0.56)
|
|
708
|
+
),
|
|
709
|
+
musicalNotes: sortedByDegree(model.musicalNotes).map(
|
|
710
|
+
(note) => element("cosmologicalMusic", "music", note, (musicRing.r1 + musicRing.r2) / 2)
|
|
711
|
+
),
|
|
712
|
+
zodiacSigns: sortedByDegree(model.zodiacSigns).map(
|
|
713
|
+
(sign) => element("astralZodiac", "zodiac", sign, (zodiacRing.r1 + zodiacRing.r2) / 2, Math.min((zodiacRing.r2 - zodiacRing.r1) * 0.33, 13 * scale))
|
|
714
|
+
),
|
|
715
|
+
planetaryPoints: sortedByDegree(model.planetaryPoints).map(
|
|
716
|
+
(planet) => element("astralPlanetary", "planet", planet, (planetRing.r1 + planetRing.r2) / 2, Math.min((planetRing.r2 - planetRing.r1) * 0.33, 13 * scale))
|
|
717
|
+
),
|
|
718
|
+
degreeTicks,
|
|
719
|
+
rays,
|
|
720
|
+
center: {
|
|
721
|
+
id: "solar-center",
|
|
722
|
+
anchor: center,
|
|
723
|
+
hitTarget: { kind: "circle", cx: center.x, cy: center.y, r: rings.solarCenter.r2 }
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
}
|
|
639
727
|
function buildRings(contentRadius, frameRadius = contentRadius) {
|
|
640
728
|
const ring = (id2, r1, r2, radius = contentRadius) => ({
|
|
641
729
|
id: id2,
|
|
@@ -777,6 +865,9 @@ function polygonCentroid(points) {
|
|
|
777
865
|
function sortedByDegree(items) {
|
|
778
866
|
return [...items].sort((a, b) => normalizeDegrees(a.degree) - normalizeDegrees(b.degree));
|
|
779
867
|
}
|
|
868
|
+
function slugForGeometry(value) {
|
|
869
|
+
return String(value).trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "item";
|
|
870
|
+
}
|
|
780
871
|
function nearestUtterance(degree, utterance) {
|
|
781
872
|
let best;
|
|
782
873
|
let bestDelta = Number.POSITIVE_INFINITY;
|
|
@@ -1255,7 +1346,7 @@ function generateAstroGlyphSvg(keyOrGlyph, options = {}) {
|
|
|
1255
1346
|
const svg = generateGlyphSvg(glyph.primitives, options);
|
|
1256
1347
|
return svg.replace("<svg ", `<svg data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" `);
|
|
1257
1348
|
}
|
|
1258
|
-
function
|
|
1349
|
+
function buildAstroWheelSvgModel(chart, options = {}) {
|
|
1259
1350
|
const viewBox = normalizeViewBox2(options.viewBox);
|
|
1260
1351
|
const palette = resolvePalette2(options.palette, options.background ?? "transparent");
|
|
1261
1352
|
const excludedBodies = resolveExcludedBodies(options.excludeBodies);
|
|
@@ -1263,7 +1354,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
1263
1354
|
viewBox.width / ASTRO_WHEEL_DEFAULT_VIEWBOX.width,
|
|
1264
1355
|
viewBox.height / ASTRO_WHEEL_DEFAULT_VIEWBOX.height
|
|
1265
1356
|
);
|
|
1266
|
-
const padding = options.padding ?? round2(18 * scale + getExternalPointPadding(
|
|
1357
|
+
const padding = options.padding ?? round2(18 * scale + getExternalPointPadding());
|
|
1267
1358
|
const center = {
|
|
1268
1359
|
x: round2(viewBox.minX + viewBox.width / 2),
|
|
1269
1360
|
y: round2(viewBox.minY + viewBox.height / 2)
|
|
@@ -1273,6 +1364,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
1273
1364
|
const rings = buildRings2(outerRadius, options.layout?.rings);
|
|
1274
1365
|
const pointConnectorMode = options.layout?.pointConnectors ?? "auto";
|
|
1275
1366
|
const maxPointDisplacementDegrees = options.layout?.maxPointDisplacementDegrees ?? DEFAULT_POINT_DISPLACEMENT_DEGREES;
|
|
1367
|
+
const railVisibility = resolveRailVisibility(options.layout?.rails);
|
|
1276
1368
|
const resolvedPoints = resolvePointOptions(options.points);
|
|
1277
1369
|
const resolvedHouses = resolveHouseOptions(options.houses);
|
|
1278
1370
|
const resolvedAspects = resolveAspectOptions(options.aspects);
|
|
@@ -1291,7 +1383,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
1291
1383
|
rings,
|
|
1292
1384
|
scale
|
|
1293
1385
|
}) : [];
|
|
1294
|
-
const
|
|
1386
|
+
const basePointGroup = buildPointGroup({
|
|
1295
1387
|
layer: {
|
|
1296
1388
|
id: "birth",
|
|
1297
1389
|
label: "Birth",
|
|
@@ -1310,28 +1402,15 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
1310
1402
|
palette,
|
|
1311
1403
|
excludedBodies,
|
|
1312
1404
|
pointConnectorMode,
|
|
1313
|
-
maxDisplacementDegrees: maxPointDisplacementDegrees
|
|
1405
|
+
maxDisplacementDegrees: maxPointDisplacementDegrees,
|
|
1406
|
+
railVisibility
|
|
1314
1407
|
});
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1317
|
-
layer,
|
|
1318
|
-
center,
|
|
1319
|
-
angleOf: angleOf2,
|
|
1320
|
-
rings,
|
|
1321
|
-
scale,
|
|
1322
|
-
palette,
|
|
1323
|
-
excludedBodies,
|
|
1324
|
-
pointConnectorMode,
|
|
1325
|
-
maxDisplacementDegrees: maxPointDisplacementDegrees
|
|
1326
|
-
})
|
|
1327
|
-
);
|
|
1328
|
-
const pointLayers = [
|
|
1329
|
-
...resolvedPoints.enabled ? [basePointLayer] : [],
|
|
1330
|
-
...extraPointLayers
|
|
1408
|
+
const pointGroups = [
|
|
1409
|
+
...resolvedPoints.enabled ? [basePointGroup] : []
|
|
1331
1410
|
];
|
|
1332
|
-
const points =
|
|
1411
|
+
const points = pointGroups.flatMap((layer) => [...layer.points]);
|
|
1333
1412
|
const pointByKey = Object.fromEntries(points.map((point) => [point.key, point]));
|
|
1334
|
-
const
|
|
1413
|
+
const baseAspectGroup = resolvedAspects.enabled ? buildAspectGroup({
|
|
1335
1414
|
layer: {
|
|
1336
1415
|
id: "birth",
|
|
1337
1416
|
label: "Birth aspects",
|
|
@@ -1347,23 +1426,11 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
1347
1426
|
palette,
|
|
1348
1427
|
excludedBodies
|
|
1349
1428
|
}) : null;
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1352
|
-
layer,
|
|
1353
|
-
chart: layer.chart ?? chart,
|
|
1354
|
-
pointByKey,
|
|
1355
|
-
center,
|
|
1356
|
-
angleOf: angleOf2,
|
|
1357
|
-
rings,
|
|
1358
|
-
palette,
|
|
1359
|
-
excludedBodies
|
|
1360
|
-
})
|
|
1361
|
-
);
|
|
1362
|
-
const aspectLayers = [
|
|
1363
|
-
...baseAspectLayer ? [baseAspectLayer] : [],
|
|
1364
|
-
...extraAspectLayers
|
|
1429
|
+
const aspectGroups = [
|
|
1430
|
+
...baseAspectGroup ? [baseAspectGroup] : []
|
|
1365
1431
|
];
|
|
1366
|
-
const aspectLines =
|
|
1432
|
+
const aspectLines = aspectGroups.flatMap((layer) => [...layer.aspectLines]);
|
|
1433
|
+
const positionRails = basePointGroup.rails;
|
|
1367
1434
|
return {
|
|
1368
1435
|
viewBox,
|
|
1369
1436
|
center,
|
|
@@ -1377,13 +1444,14 @@ function getAstroWheelRenderModel(chart, options = {}) {
|
|
|
1377
1444
|
points,
|
|
1378
1445
|
pointByKey,
|
|
1379
1446
|
aspectLines,
|
|
1380
|
-
|
|
1381
|
-
|
|
1447
|
+
pointGroups,
|
|
1448
|
+
aspectGroups,
|
|
1449
|
+
positionRails,
|
|
1382
1450
|
palette
|
|
1383
1451
|
};
|
|
1384
1452
|
}
|
|
1385
1453
|
function generateAstroWheelSvg(chart, options = {}) {
|
|
1386
|
-
const model =
|
|
1454
|
+
const model = buildAstroWheelSvgModel(chart, options);
|
|
1387
1455
|
const viewBox = model.viewBox;
|
|
1388
1456
|
const zodiacOptions = resolveZodiacOptions(options.zodiac);
|
|
1389
1457
|
const houseOptions = resolveHouseOptions(options.houses);
|
|
@@ -1407,6 +1475,7 @@ function generateAstroWheelSvg(chart, options = {}) {
|
|
|
1407
1475
|
`<rect x="${fmt2(viewBox.minX)}" y="${fmt2(viewBox.minY)}" width="${fmt2(viewBox.width)}" height="${fmt2(viewBox.height)}" fill="${escapeAttr2(background)}"/>`
|
|
1408
1476
|
);
|
|
1409
1477
|
}
|
|
1478
|
+
renderAspectBoundary(push, model);
|
|
1410
1479
|
renderAspects(push, model);
|
|
1411
1480
|
renderZodiac(push, model, zodiacOptions);
|
|
1412
1481
|
renderHouses(push, model, houseOptions);
|
|
@@ -1437,23 +1506,15 @@ function renderSvgDefs(push, model) {
|
|
|
1437
1506
|
push(`</defs>`);
|
|
1438
1507
|
}
|
|
1439
1508
|
function renderAspects(push, model) {
|
|
1440
|
-
if (model.
|
|
1509
|
+
if (model.aspectGroups.length === 0) {
|
|
1441
1510
|
return;
|
|
1442
1511
|
}
|
|
1443
|
-
const guideRadius = model.rings.aspects.r2 * 0.96;
|
|
1444
|
-
const innerGuideRadius = guideRadius * 0.52;
|
|
1445
1512
|
push(`<g id="astro-wheel-aspects" aria-label="aspects">`);
|
|
1446
|
-
|
|
1447
|
-
`<
|
|
1448
|
-
);
|
|
1449
|
-
push(
|
|
1450
|
-
`<circle cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(innerGuideRadius)}" fill="none" stroke="${escapeAttr2(model.palette.aspectGuide)}" stroke-opacity="0.28" stroke-width="${fmt2(model.scale)}"/>`
|
|
1451
|
-
);
|
|
1452
|
-
for (const layer of model.aspectLayers) {
|
|
1453
|
-
push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
|
|
1513
|
+
for (const layer of model.aspectGroups) {
|
|
1514
|
+
push(`<g class="astro-wheel-aspect-group" data-aspect-group="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
|
|
1454
1515
|
for (const aspect of layer.aspectLines) {
|
|
1455
1516
|
push(
|
|
1456
|
-
`<line data-aspect-
|
|
1517
|
+
`<line data-aspect-group="${escapeAttr2(aspect.groupId)}" data-aspect="${escapeAttr2(aspect.aspect)}" data-planet-a="${escapeAttr2(aspect.planetA)}" data-planet-b="${escapeAttr2(aspect.planetB)}" x1="${fmt2(aspect.line.x1)}" y1="${fmt2(aspect.line.y1)}" x2="${fmt2(aspect.line.x2)}" y2="${fmt2(aspect.line.y2)}" stroke="${escapeAttr2(aspect.color)}" stroke-opacity="${fmt2(aspect.opacity)}" stroke-width="${fmt2(aspect.strokeWidth * model.scale)}" stroke-linecap="round"/>`
|
|
1457
1518
|
);
|
|
1458
1519
|
}
|
|
1459
1520
|
push(`</g>`);
|
|
@@ -1463,6 +1524,11 @@ function renderAspects(push, model) {
|
|
|
1463
1524
|
);
|
|
1464
1525
|
push(`</g>`);
|
|
1465
1526
|
}
|
|
1527
|
+
function renderAspectBoundary(push, model) {
|
|
1528
|
+
push(
|
|
1529
|
+
`<circle id="astro-wheel-aspect-boundary" cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(model.rings.aspects.r2)}" fill="none" stroke="${escapeAttr2(model.palette.aspectGuide)}" stroke-opacity="0.9" stroke-width="${fmt2(1.25 * model.scale)}"/>`
|
|
1530
|
+
);
|
|
1531
|
+
}
|
|
1466
1532
|
function renderZodiac(push, model, options) {
|
|
1467
1533
|
if (!options.segments && !options.glyphs && !options.ticks) {
|
|
1468
1534
|
return;
|
|
@@ -1535,30 +1601,21 @@ function renderHouses(push, model, options) {
|
|
|
1535
1601
|
);
|
|
1536
1602
|
}
|
|
1537
1603
|
}
|
|
1538
|
-
if (options.angles) {
|
|
1539
|
-
for (const marker of model.angleMarkers) {
|
|
1540
|
-
push(`<g data-angle-marker="${marker.key}">`);
|
|
1541
|
-
push(
|
|
1542
|
-
`<line x1="${fmt2(marker.line.x1)}" y1="${fmt2(marker.line.y1)}" x2="${fmt2(marker.line.x2)}" y2="${fmt2(marker.line.y2)}" stroke="${escapeAttr2(model.palette.angleLine)}" stroke-width="${fmt2(2 * model.scale)}"/>`
|
|
1543
|
-
);
|
|
1544
|
-
push(`</g>`);
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
1604
|
push(`</g>`);
|
|
1548
1605
|
}
|
|
1549
1606
|
function renderPlanets(push, model) {
|
|
1550
|
-
if (model.
|
|
1607
|
+
if (model.pointGroups.length === 0) {
|
|
1551
1608
|
return;
|
|
1552
1609
|
}
|
|
1553
1610
|
push(`<g id="astro-wheel-planets" aria-label="planets">`);
|
|
1554
|
-
for (const layer of model.
|
|
1555
|
-
|
|
1611
|
+
for (const layer of model.pointGroups) {
|
|
1612
|
+
renderPointGroupGuide(push, layer, model);
|
|
1556
1613
|
}
|
|
1557
|
-
for (const layer of model.
|
|
1558
|
-
push(`<g class="astro-wheel-point-
|
|
1614
|
+
for (const layer of model.pointGroups) {
|
|
1615
|
+
push(`<g class="astro-wheel-point-group" data-point-group="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
|
|
1559
1616
|
for (const point of layer.points) {
|
|
1560
1617
|
push(
|
|
1561
|
-
`<g class="astro-wheel-point" data-point-
|
|
1618
|
+
`<g class="astro-wheel-point" data-point-group="${escapeAttr2(point.groupId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt2(point.longitude)}">`
|
|
1562
1619
|
);
|
|
1563
1620
|
push(`<title>${escapeText2(point.name)} ${fmt2(point.longitude)}\xB0</title>`);
|
|
1564
1621
|
push(
|
|
@@ -1579,17 +1636,17 @@ function renderPlanets(push, model) {
|
|
|
1579
1636
|
}
|
|
1580
1637
|
push(`</g>`);
|
|
1581
1638
|
}
|
|
1582
|
-
function
|
|
1639
|
+
function renderPointGroupGuide(push, layer, model) {
|
|
1583
1640
|
const isExternal = layer.radius > model.rings.houses.r2 + model.scale;
|
|
1584
1641
|
if (!isExternal) {
|
|
1585
1642
|
return;
|
|
1586
1643
|
}
|
|
1587
1644
|
push(
|
|
1588
|
-
`<circle class="astro-wheel-external-point-ring" data-point-
|
|
1645
|
+
`<circle class="astro-wheel-external-point-ring" data-point-group="${escapeAttr2(layer.id)}" cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(layer.radius)}" fill="none" stroke="${escapeAttr2(layer.tickColor)}" stroke-opacity="0.32" stroke-width="${fmt2(1.15 * model.scale)}"/>`
|
|
1589
1646
|
);
|
|
1590
1647
|
}
|
|
1591
1648
|
function renderGlyphOverlay(push, model) {
|
|
1592
|
-
if (model.angleMarkers.length === 0 && model.
|
|
1649
|
+
if (model.angleMarkers.length === 0 && model.pointGroups.length === 0) {
|
|
1593
1650
|
return;
|
|
1594
1651
|
}
|
|
1595
1652
|
push(`<g id="astro-wheel-glyph-layer" aria-label="chart glyphs">`);
|
|
@@ -1600,10 +1657,10 @@ function renderGlyphOverlay(push, model) {
|
|
|
1600
1657
|
}
|
|
1601
1658
|
push(`</g>`);
|
|
1602
1659
|
}
|
|
1603
|
-
if (model.
|
|
1660
|
+
if (model.pointGroups.length > 0) {
|
|
1604
1661
|
push(`<g id="astro-wheel-point-glyphs" aria-label="planet glyphs">`);
|
|
1605
|
-
for (const layer of model.
|
|
1606
|
-
push(`<g class="astro-wheel-point-glyph-layer" data-point-
|
|
1662
|
+
for (const layer of model.pointGroups) {
|
|
1663
|
+
push(`<g class="astro-wheel-point-glyph-layer" data-point-group="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)} glyphs"` : ""}>`);
|
|
1607
1664
|
for (const point of layer.points) {
|
|
1608
1665
|
renderPointLabelGroup(push, point, model);
|
|
1609
1666
|
}
|
|
@@ -1616,37 +1673,21 @@ function renderGlyphOverlay(push, model) {
|
|
|
1616
1673
|
function renderAngleGlyph(push, marker, model) {
|
|
1617
1674
|
const label = angleDisplayLabel(marker.key);
|
|
1618
1675
|
const position = formatInlinePosition(marker.zodiacPosition);
|
|
1619
|
-
const
|
|
1620
|
-
const
|
|
1621
|
-
const signScale = positionFontSize * 0.88;
|
|
1622
|
-
const gap = clamp(3.2 * model.scale, 2.5, 5);
|
|
1623
|
-
const labelWidth = estimateTextWidth(label, labelFontSize);
|
|
1676
|
+
const positionFontSize = clamp(marker.labelFontSize * 0.62, 6 * model.scale, 10 * model.scale);
|
|
1677
|
+
const gap = clamp(3 * model.scale, 2, 5);
|
|
1624
1678
|
const degreeWidth = estimateTextWidth(position.degreesText, positionFontSize);
|
|
1625
1679
|
const minutesWidth = estimateTextWidth(position.minutesText, positionFontSize);
|
|
1626
|
-
const totalWidth =
|
|
1680
|
+
const totalWidth = degreeWidth + gap + minutesWidth;
|
|
1627
1681
|
const startX = -totalWidth / 2;
|
|
1628
|
-
const
|
|
1629
|
-
const
|
|
1630
|
-
const signX = degreeX + degreeWidth + gap + signScale / 2;
|
|
1631
|
-
const minutesX = signX + signScale / 2 + gap;
|
|
1682
|
+
const degreeX = startX;
|
|
1683
|
+
const minutesX = degreeX + degreeWidth + gap;
|
|
1632
1684
|
push(
|
|
1633
1685
|
`<g class="astro-wheel-angle-glyph-label" data-angle-marker="${marker.key}" data-longitude="${fmt2(marker.longitude)}" transform="translate(${fmt2(marker.labelPosition.x)} ${fmt2(marker.labelPosition.y)}) rotate(${fmt2(marker.labelRotation)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
|
|
1634
1686
|
);
|
|
1635
1687
|
push(`<title>${escapeText2(`${label} ${position.degreesText} ${position.sign} ${position.minutesText}`)}</title>`);
|
|
1636
|
-
push(
|
|
1637
|
-
`<text class="astro-wheel-angle-label" x="${fmt2(labelX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(labelFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}" font-weight="700">${escapeText2(label)}</text>`
|
|
1638
|
-
);
|
|
1639
1688
|
push(
|
|
1640
1689
|
`<text class="astro-wheel-angle-degree" x="${fmt2(degreeX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(positionFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}">${escapeText2(position.degreesText)}</text>`
|
|
1641
1690
|
);
|
|
1642
|
-
renderInlineSignGlyph(
|
|
1643
|
-
push,
|
|
1644
|
-
position.sign,
|
|
1645
|
-
signX,
|
|
1646
|
-
0,
|
|
1647
|
-
signScale,
|
|
1648
|
-
model.palette.angleLabel
|
|
1649
|
-
);
|
|
1650
1691
|
push(
|
|
1651
1692
|
`<text class="astro-wheel-angle-minutes" x="${fmt2(minutesX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(positionFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}">${escapeText2(position.minutesText)}</text>`
|
|
1652
1693
|
);
|
|
@@ -1660,24 +1701,29 @@ function angleDisplayLabel(key) {
|
|
|
1660
1701
|
return key;
|
|
1661
1702
|
}
|
|
1662
1703
|
function renderPointLabelGroup(push, point, model) {
|
|
1663
|
-
const layout = getPointLabelLayout(point, model.scale);
|
|
1664
|
-
const boundsAttr = point.labelBounds ? ` data-label-bounds="${escapeAttr2(formatLabelBounds(point.labelBounds))}"` : "";
|
|
1665
1704
|
push(
|
|
1666
|
-
`<g class="astro-wheel-point-label" data-point-
|
|
1705
|
+
`<g class="astro-wheel-point-label" data-point-group="${escapeAttr2(point.groupId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt2(point.longitude)}" data-display-longitude="${fmt2(point.displayLongitude)}" data-house="${point.house ?? ""}" transform="translate(${fmt2(point.glyphPosition.x)} ${fmt2(point.glyphPosition.y)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
|
|
1667
1706
|
);
|
|
1668
1707
|
push(`<title>${escapeText2(pointLabelTitle(point))}</title>`);
|
|
1669
|
-
renderPointGlyph(push, point,
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
point.color
|
|
1708
|
+
renderPointGlyph(push, point, 0, 0, point.glyphScale, model.palette.glyphHalo);
|
|
1709
|
+
push(`</g>`);
|
|
1710
|
+
for (const label of point.railLabels) {
|
|
1711
|
+
if (!label.visible)
|
|
1712
|
+
continue;
|
|
1713
|
+
push(
|
|
1714
|
+
`<g class="astro-wheel-position-rail-label" data-point-group="${escapeAttr2(point.groupId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-position-rail="${label.railId}" transform="translate(${fmt2(label.position.x)} ${fmt2(label.position.y)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
|
|
1677
1715
|
);
|
|
1716
|
+
if (label.railId === "sign" && label.sign) {
|
|
1717
|
+
renderInlineSignGlyph(push, label.sign, 0, 0, label.glyphScale ?? label.fontSize, point.color);
|
|
1718
|
+
} else if (label.railId === "retrograde") {
|
|
1719
|
+
renderRetrogradeMarker(push, 0, 0, label.fontSize, point.color);
|
|
1720
|
+
} else {
|
|
1721
|
+
push(
|
|
1722
|
+
`<text class="astro-wheel-point-${label.railId}" x="0" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(label.fontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(point.color)}" fill-opacity="0.9">${escapeText2(label.text)}</text>`
|
|
1723
|
+
);
|
|
1724
|
+
}
|
|
1725
|
+
push(`</g>`);
|
|
1678
1726
|
}
|
|
1679
|
-
renderPointInlineDegreeLabel(push, point, layout);
|
|
1680
|
-
push(`</g>`);
|
|
1681
1727
|
}
|
|
1682
1728
|
function renderPointGlyph(push, point, x, y, glyphScale, glyphFill) {
|
|
1683
1729
|
const glyph = point.glyphKey ? getAstroGlyph(point.glyphKey) : resolvePointGlyph(point.name);
|
|
@@ -1710,18 +1756,6 @@ function renderRetrogradeMarker(push, x, y, fontSize, color) {
|
|
|
1710
1756
|
`<text class="astro-wheel-point-retrograde" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${textFontFamily2()}" font-size="${fmt2(fontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(color)}" font-weight="700">R</text>`
|
|
1711
1757
|
);
|
|
1712
1758
|
}
|
|
1713
|
-
function renderPointInlineDegreeLabel(push, point, layout) {
|
|
1714
|
-
if (!layout.position) {
|
|
1715
|
-
return;
|
|
1716
|
-
}
|
|
1717
|
-
push(
|
|
1718
|
-
`<text class="astro-wheel-point-degree" x="${fmt2(layout.degreeX)}" y="${fmt2(layout.degreeY)}" font-family="${textFontFamily2()}" font-size="${fmt2(layout.fontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(point.color)}" fill-opacity="0.9">${escapeText2(layout.position.degreesText)}</text>`
|
|
1719
|
-
);
|
|
1720
|
-
renderInlineSignGlyph(push, layout.position.sign, layout.signX, layout.signY, layout.signScale, point.color);
|
|
1721
|
-
push(
|
|
1722
|
-
`<text class="astro-wheel-point-minutes" x="${fmt2(layout.minutesX)}" y="${fmt2(layout.minutesY)}" font-family="${textFontFamily2()}" font-size="${fmt2(layout.fontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(point.color)}" fill-opacity="0.9">${escapeText2(layout.position.minutesText)}</text>`
|
|
1723
|
-
);
|
|
1724
|
-
}
|
|
1725
1759
|
function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
|
|
1726
1760
|
const glyph = ZODIAC_GLYPHS[sign];
|
|
1727
1761
|
if (glyph) {
|
|
@@ -1737,89 +1771,6 @@ function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
|
|
|
1737
1771
|
`<text class="astro-wheel-point-sign-glyph" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${symbolFontFamily()}" font-size="${fmt2(glyphScale)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(color)}">${escapeText2(sign.charAt(0).toUpperCase())}</text>`
|
|
1738
1772
|
);
|
|
1739
1773
|
}
|
|
1740
|
-
function getPointLabelLayout(point, scale) {
|
|
1741
|
-
const glyphScale = point.glyphFontSize * 0.66;
|
|
1742
|
-
const fontSize = clamp(point.glyphFontSize * 0.31, 5.5 * scale, 9 * scale);
|
|
1743
|
-
const signScale = fontSize * 0.82;
|
|
1744
|
-
const gap = clamp(3.2 * scale, 2.4, 5);
|
|
1745
|
-
const railGap = clamp(4.4 * scale, 3.2, 7);
|
|
1746
|
-
const retrogradeFontSize = clamp(fontSize * 0.74, 4.4 * scale, 7.2 * scale);
|
|
1747
|
-
const retrogradeTextWidth = point.retrograde ? estimateTextWidth("Rx", retrogradeFontSize) : 0;
|
|
1748
|
-
const retrogradeGap = point.retrograde ? clamp(1.7 * scale, 1.2, 3) : 0;
|
|
1749
|
-
const position = point.zodiacPosition ? formatInlinePosition(point.zodiacPosition) : null;
|
|
1750
|
-
const degreeWidth = position ? estimateTextWidth(position.degreesText, fontSize) : 0;
|
|
1751
|
-
const minutesWidth = position ? estimateTextWidth(position.minutesText, fontSize) : 0;
|
|
1752
|
-
const positionWidth = position ? degreeWidth + gap + signScale + gap + minutesWidth : 0;
|
|
1753
|
-
const positionHeight = position ? Math.max(fontSize, signScale) : 0;
|
|
1754
|
-
const inwardX = -Math.cos(point.labelAngle);
|
|
1755
|
-
const inwardY = -Math.sin(point.labelAngle);
|
|
1756
|
-
const glyphHalf = glyphScale / 2;
|
|
1757
|
-
const retrogradeCenterDistance = point.retrograde ? glyphHalf + retrogradeGap + retrogradeTextWidth / 2 : 0;
|
|
1758
|
-
const retrogradeRailWidth = point.retrograde ? retrogradeGap + retrogradeTextWidth : 0;
|
|
1759
|
-
const positionCenterDistance = position ? glyphHalf + retrogradeRailWidth + railGap + positionWidth / 2 : 0;
|
|
1760
|
-
const positionCenterX = inwardX * positionCenterDistance;
|
|
1761
|
-
const positionCenterY = inwardY * positionCenterDistance;
|
|
1762
|
-
const positionLeftX = positionCenterX - positionWidth / 2;
|
|
1763
|
-
const glyphX = 0;
|
|
1764
|
-
const glyphY = 0;
|
|
1765
|
-
const retrogradeX = inwardX * retrogradeCenterDistance;
|
|
1766
|
-
const retrogradeY = inwardY * retrogradeCenterDistance;
|
|
1767
|
-
const degreeX = positionLeftX;
|
|
1768
|
-
const degreeY = positionCenterY;
|
|
1769
|
-
const signX = degreeX + degreeWidth + gap + signScale / 2;
|
|
1770
|
-
const signY = positionCenterY;
|
|
1771
|
-
const minutesX = signX + signScale / 2 + gap;
|
|
1772
|
-
const minutesY = positionCenterY;
|
|
1773
|
-
const boxes = [
|
|
1774
|
-
{
|
|
1775
|
-
x: -glyphHalf,
|
|
1776
|
-
y: -glyphHalf,
|
|
1777
|
-
width: glyphScale,
|
|
1778
|
-
height: glyphScale
|
|
1779
|
-
}
|
|
1780
|
-
];
|
|
1781
|
-
if (point.retrograde) {
|
|
1782
|
-
boxes.push({
|
|
1783
|
-
x: retrogradeX - retrogradeTextWidth / 2,
|
|
1784
|
-
y: retrogradeY - retrogradeFontSize / 2,
|
|
1785
|
-
width: retrogradeTextWidth,
|
|
1786
|
-
height: retrogradeFontSize
|
|
1787
|
-
});
|
|
1788
|
-
}
|
|
1789
|
-
if (position) {
|
|
1790
|
-
boxes.push({
|
|
1791
|
-
x: positionLeftX,
|
|
1792
|
-
y: positionCenterY - positionHeight / 2,
|
|
1793
|
-
width: positionWidth,
|
|
1794
|
-
height: positionHeight
|
|
1795
|
-
});
|
|
1796
|
-
}
|
|
1797
|
-
const boundsX = Math.min(...boxes.map((box) => box.x));
|
|
1798
|
-
const boundsY = Math.min(...boxes.map((box) => box.y));
|
|
1799
|
-
const boundsMaxX = Math.max(...boxes.map((box) => box.x + box.width));
|
|
1800
|
-
const boundsMaxY = Math.max(...boxes.map((box) => box.y + box.height));
|
|
1801
|
-
return {
|
|
1802
|
-
glyphScale,
|
|
1803
|
-
glyphX,
|
|
1804
|
-
glyphY,
|
|
1805
|
-
fontSize,
|
|
1806
|
-
degreeX,
|
|
1807
|
-
degreeY,
|
|
1808
|
-
signX,
|
|
1809
|
-
signScale,
|
|
1810
|
-
signY,
|
|
1811
|
-
minutesX,
|
|
1812
|
-
minutesY,
|
|
1813
|
-
retrogradeX,
|
|
1814
|
-
retrogradeY,
|
|
1815
|
-
retrogradeFontSize,
|
|
1816
|
-
boundsX,
|
|
1817
|
-
boundsY,
|
|
1818
|
-
width: boundsMaxX - boundsX,
|
|
1819
|
-
height: boundsMaxY - boundsY,
|
|
1820
|
-
position
|
|
1821
|
-
};
|
|
1822
|
-
}
|
|
1823
1774
|
function formatInlinePosition(position) {
|
|
1824
1775
|
let degrees = Math.floor(position.decimalDegrees);
|
|
1825
1776
|
let minutes = Math.round((position.decimalDegrees - degrees) * 60);
|
|
@@ -1844,70 +1795,6 @@ function pointLabelTitle(point) {
|
|
|
1844
1795
|
function estimateTextWidth(value, fontSize) {
|
|
1845
1796
|
return value.length * fontSize * 0.56;
|
|
1846
1797
|
}
|
|
1847
|
-
function labelBoundsFor(position, layout, padding) {
|
|
1848
|
-
const width = layout.width + padding * 2;
|
|
1849
|
-
const height = layout.height + padding * 2;
|
|
1850
|
-
return {
|
|
1851
|
-
x: round2(position.x + layout.boundsX - padding),
|
|
1852
|
-
y: round2(position.y + layout.boundsY - padding),
|
|
1853
|
-
width: round2(width),
|
|
1854
|
-
height: round2(height)
|
|
1855
|
-
};
|
|
1856
|
-
}
|
|
1857
|
-
function constrainLabelInsideCircle(params) {
|
|
1858
|
-
const { center, layout, padding, maxRadius } = params;
|
|
1859
|
-
if (!Number.isFinite(maxRadius)) {
|
|
1860
|
-
return {
|
|
1861
|
-
position: params.position,
|
|
1862
|
-
bounds: labelBoundsFor(params.position, layout, padding),
|
|
1863
|
-
moved: false
|
|
1864
|
-
};
|
|
1865
|
-
}
|
|
1866
|
-
let position = params.position;
|
|
1867
|
-
let moved = false;
|
|
1868
|
-
for (let attempt = 0; attempt < 6; attempt++) {
|
|
1869
|
-
const bounds = labelBoundsFor(position, layout, padding);
|
|
1870
|
-
const overflow = labelBoundsCircleOverflow(center, bounds, maxRadius);
|
|
1871
|
-
if (overflow <= 0) {
|
|
1872
|
-
return { position, bounds, moved };
|
|
1873
|
-
}
|
|
1874
|
-
const dx = position.x - center.x;
|
|
1875
|
-
const dy = position.y - center.y;
|
|
1876
|
-
const distance = Math.max(Math.hypot(dx, dy), 1);
|
|
1877
|
-
position = {
|
|
1878
|
-
x: round2(position.x - dx / distance * (overflow + 0.75)),
|
|
1879
|
-
y: round2(position.y - dy / distance * (overflow + 0.75))
|
|
1880
|
-
};
|
|
1881
|
-
moved = true;
|
|
1882
|
-
}
|
|
1883
|
-
return {
|
|
1884
|
-
position,
|
|
1885
|
-
bounds: labelBoundsFor(position, layout, padding),
|
|
1886
|
-
moved
|
|
1887
|
-
};
|
|
1888
|
-
}
|
|
1889
|
-
function labelBoundsCircleOverflow(center, bounds, maxRadius) {
|
|
1890
|
-
const corners = [
|
|
1891
|
-
{ x: bounds.x, y: bounds.y },
|
|
1892
|
-
{ x: bounds.x + bounds.width, y: bounds.y },
|
|
1893
|
-
{ x: bounds.x, y: bounds.y + bounds.height },
|
|
1894
|
-
{ x: bounds.x + bounds.width, y: bounds.y + bounds.height }
|
|
1895
|
-
];
|
|
1896
|
-
const farthestCorner = Math.max(
|
|
1897
|
-
...corners.map(
|
|
1898
|
-
(corner) => Math.hypot(corner.x - center.x, corner.y - center.y)
|
|
1899
|
-
)
|
|
1900
|
-
);
|
|
1901
|
-
return farthestCorner - maxRadius;
|
|
1902
|
-
}
|
|
1903
|
-
function formatLabelBounds(bounds) {
|
|
1904
|
-
return `${fmt2(bounds.x)} ${fmt2(bounds.y)} ${fmt2(bounds.width)} ${fmt2(bounds.height)}`;
|
|
1905
|
-
}
|
|
1906
|
-
function projectedLabelWidthAlongTangent(angleRad, bounds) {
|
|
1907
|
-
const tangentX = -Math.sin(angleRad);
|
|
1908
|
-
const tangentY = Math.cos(angleRad);
|
|
1909
|
-
return Math.abs(tangentX) * bounds.width + Math.abs(tangentY) * bounds.height;
|
|
1910
|
-
}
|
|
1911
1798
|
var POINT_GLYPH_ALIASES = {
|
|
1912
1799
|
"mean node": "north node",
|
|
1913
1800
|
"true node": "north node",
|
|
@@ -1942,13 +1829,7 @@ function resolvePointGlyph(name) {
|
|
|
1942
1829
|
return PLANET_GLYPHS[resolved] ?? ANGLE_GLYPHS[resolved] ?? null;
|
|
1943
1830
|
}
|
|
1944
1831
|
function getExternalPointPadding(options, scale) {
|
|
1945
|
-
|
|
1946
|
-
if (externalLayers.length === 0) {
|
|
1947
|
-
return 0;
|
|
1948
|
-
}
|
|
1949
|
-
return Math.max(
|
|
1950
|
-
...externalLayers.map((layer) => (layer.radiusOffset ?? 18) + 36 * scale)
|
|
1951
|
-
);
|
|
1832
|
+
return 0;
|
|
1952
1833
|
}
|
|
1953
1834
|
function buildZodiacSegments(params) {
|
|
1954
1835
|
const { center, angleOf: angleOf2, rings, scale, palette } = params;
|
|
@@ -1990,7 +1871,7 @@ function buildHouseCusps(params) {
|
|
|
1990
1871
|
const ring = rings.houses;
|
|
1991
1872
|
const spokeInnerRadius = rings.aspects.r2;
|
|
1992
1873
|
const spokeOuterRadius = ring.r2 + 4 * scale;
|
|
1993
|
-
const labelRadius = ring.
|
|
1874
|
+
const labelRadius = (ring.r1 + ring.r2) / 2;
|
|
1994
1875
|
const labelFontSize = clamp((ring.r2 - ring.r1) * 0.48, 10 * scale, 19 * scale);
|
|
1995
1876
|
return houses.map((house, index) => {
|
|
1996
1877
|
const angle = angleOf2(house.longitude);
|
|
@@ -2011,10 +1892,7 @@ function buildAngleMarkers(params) {
|
|
|
2011
1892
|
const { chart, center, angleOf: angleOf2, rings, scale } = params;
|
|
2012
1893
|
const ring = rings.houses;
|
|
2013
1894
|
const labelFontSize = clamp((ring.r2 - ring.r1) * 0.32, 8 * scale, 18 * scale);
|
|
2014
|
-
const labelRadius =
|
|
2015
|
-
ring.r2 + 9 * scale,
|
|
2016
|
-
ring.r2 - Math.max(10 * scale, labelFontSize * 0.6)
|
|
2017
|
-
);
|
|
1895
|
+
const labelRadius = rings.zodiac.r1 + (rings.zodiac.r2 - rings.zodiac.r1) * 0.32;
|
|
2018
1896
|
const markers = [
|
|
2019
1897
|
{ key: "ASC", position: chart.houses.ascendant },
|
|
2020
1898
|
{ key: "MC", position: chart.houses.mc },
|
|
@@ -2046,7 +1924,7 @@ function buildAngleMarkers(params) {
|
|
|
2046
1924
|
};
|
|
2047
1925
|
});
|
|
2048
1926
|
}
|
|
2049
|
-
function
|
|
1927
|
+
function buildPointGroup(params) {
|
|
2050
1928
|
const {
|
|
2051
1929
|
layer,
|
|
2052
1930
|
center,
|
|
@@ -2056,10 +1934,11 @@ function buildPointLayer(params) {
|
|
|
2056
1934
|
palette,
|
|
2057
1935
|
excludedBodies,
|
|
2058
1936
|
pointConnectorMode,
|
|
2059
|
-
maxDisplacementDegrees
|
|
1937
|
+
maxDisplacementDegrees,
|
|
1938
|
+
railVisibility
|
|
2060
1939
|
} = params;
|
|
2061
1940
|
const ring = rings.planets;
|
|
2062
|
-
const requestedRadius =
|
|
1941
|
+
const requestedRadius = resolvePointGroupRadius(layer, rings);
|
|
2063
1942
|
const requestedExternalLayer = requestedRadius > rings.houses.r2 + scale;
|
|
2064
1943
|
const thickness = ring.r2 - ring.r1;
|
|
2065
1944
|
const glyphFontSize = clamp(thickness * 0.68, 14 * scale, 30 * scale) * (layer.glyphScale ?? 1);
|
|
@@ -2071,6 +1950,19 @@ function buildPointLayer(params) {
|
|
|
2071
1950
|
) : requestedRadius;
|
|
2072
1951
|
const isExternalLayer = radius > rings.houses.r2 + scale;
|
|
2073
1952
|
const tickLength = Math.min(14 * scale, thickness * 0.34);
|
|
1953
|
+
const layerRailVisibility = resolveLayerRailVisibility({
|
|
1954
|
+
layer,
|
|
1955
|
+
fallback: railVisibility,
|
|
1956
|
+
external: isExternalLayer
|
|
1957
|
+
});
|
|
1958
|
+
const rails = buildPositionRails({
|
|
1959
|
+
ring,
|
|
1960
|
+
scale,
|
|
1961
|
+
visibility: layerRailVisibility,
|
|
1962
|
+
layerRadius: radius,
|
|
1963
|
+
external: isExternalLayer,
|
|
1964
|
+
glyphFontSize
|
|
1965
|
+
});
|
|
2074
1966
|
const collisionPadding = Math.max(2 * scale, 1.5);
|
|
2075
1967
|
const zodiacKeepOutGap = Math.max(5 * scale, 4);
|
|
2076
1968
|
const labelMaxRadius = isExternalLayer ? Number.POSITIVE_INFINITY : rings.zodiac.r1 - zodiacKeepOutGap;
|
|
@@ -2079,6 +1971,7 @@ function buildPointLayer(params) {
|
|
|
2079
1971
|
const tickColor = layer.tickColor ?? color;
|
|
2080
1972
|
const pointIntents = seeds.map((seed) => {
|
|
2081
1973
|
const tickAngle = angleOf2(seed.longitude);
|
|
1974
|
+
const trueAnchor = polarToXY2(center.x, center.y, rings.aspects.r2, tickAngle);
|
|
2082
1975
|
const pointGlyphFontSize = seed.kind === "vertex" ? glyphFontSize * 0.82 : glyphFontSize;
|
|
2083
1976
|
const rawGlyphRadius = radius;
|
|
2084
1977
|
const glyphRadius = isExternalLayer ? rawGlyphRadius : clamp(
|
|
@@ -2087,37 +1980,43 @@ function buildPointLayer(params) {
|
|
|
2087
1980
|
labelMaxRadius - pointGlyphFontSize * 0.5
|
|
2088
1981
|
);
|
|
2089
1982
|
const connectorRadius = glyphRadius;
|
|
1983
|
+
const glyphClearance = pointGlyphFontSize * 0.34;
|
|
2090
1984
|
const tickLine = isExternalLayer ? lineFromPolar2(
|
|
2091
1985
|
center,
|
|
2092
|
-
rings.
|
|
2093
|
-
|
|
1986
|
+
Math.max(rings.aspects.r1, rings.aspects.r2 - tickLength * 0.5),
|
|
1987
|
+
rings.aspects.r2 + tickLength * 0.5,
|
|
2094
1988
|
tickAngle
|
|
2095
1989
|
) : lineFromPolar2(
|
|
2096
1990
|
center,
|
|
2097
1991
|
Math.min(ring.r2, connectorRadius + tickLength),
|
|
2098
|
-
connectorRadius,
|
|
1992
|
+
Math.min(ring.r2, connectorRadius + glyphClearance),
|
|
2099
1993
|
tickAngle
|
|
2100
1994
|
);
|
|
2101
1995
|
const idealPosition = polarToXY2(center.x, center.y, glyphRadius, tickAngle);
|
|
2102
|
-
|
|
1996
|
+
makeAstroWheelPoint({
|
|
2103
1997
|
layer,
|
|
2104
1998
|
seed,
|
|
2105
1999
|
tickLine,
|
|
2000
|
+
trueAngle: tickAngle,
|
|
2001
|
+
displayAngle: tickAngle,
|
|
2002
|
+
trueAnchor,
|
|
2106
2003
|
labelAngle: tickAngle,
|
|
2107
2004
|
glyphPosition: idealPosition,
|
|
2108
2005
|
glyphFontSize: pointGlyphFontSize,
|
|
2006
|
+
rails,
|
|
2007
|
+
houses: layer.chart?.houses.houses,
|
|
2008
|
+
center,
|
|
2109
2009
|
color,
|
|
2110
2010
|
tickColor
|
|
2111
2011
|
});
|
|
2112
|
-
const
|
|
2113
|
-
const labelBounds = labelBoundsFor(idealPosition, layout, collisionPadding);
|
|
2114
|
-
const labelTangentDemandPx = projectedLabelWidthAlongTangent(tickAngle, labelBounds);
|
|
2012
|
+
const labelTangentDemandPx = pointGlyphFontSize * 0.72;
|
|
2115
2013
|
const configuredTangentDemandPx = layer.collisionThresholdDegrees ? deg2rad2(clamp(layer.collisionThresholdDegrees, 0, 30)) * glyphRadius : 0;
|
|
2116
2014
|
const tangentDemandPx = Math.max(labelTangentDemandPx, configuredTangentDemandPx);
|
|
2117
2015
|
return {
|
|
2118
2016
|
seed,
|
|
2119
2017
|
tickAngle,
|
|
2120
2018
|
tickLine,
|
|
2019
|
+
trueAnchor,
|
|
2121
2020
|
connectorRadius,
|
|
2122
2021
|
glyphRadius,
|
|
2123
2022
|
pointGlyphFontSize,
|
|
@@ -2146,42 +2045,37 @@ function buildPointLayer(params) {
|
|
|
2146
2045
|
layer,
|
|
2147
2046
|
seed: intent.seed,
|
|
2148
2047
|
tickLine: intent.tickLine,
|
|
2048
|
+
trueAngle: intent.tickAngle,
|
|
2049
|
+
displayAngle: visualAngle,
|
|
2050
|
+
trueAnchor: intent.trueAnchor,
|
|
2149
2051
|
labelAngle: visualAngle,
|
|
2150
2052
|
glyphPosition,
|
|
2151
2053
|
glyphFontSize: intent.pointGlyphFontSize,
|
|
2054
|
+
rails,
|
|
2055
|
+
houses: layer.chart?.houses.houses,
|
|
2056
|
+
center,
|
|
2152
2057
|
color,
|
|
2153
2058
|
tickColor
|
|
2154
2059
|
});
|
|
2155
|
-
const
|
|
2156
|
-
const constrainedLabel = constrainLabelInsideCircle({
|
|
2060
|
+
const leaderArc = buildPointConnector({
|
|
2157
2061
|
center,
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2062
|
+
tickAngle: intent.tickAngle,
|
|
2063
|
+
labelAngle: visualAngle,
|
|
2064
|
+
connectorRadius: intent.connectorRadius,
|
|
2065
|
+
glyphPosition,
|
|
2066
|
+
mode: pointConnectorMode
|
|
2067
|
+
});
|
|
2068
|
+
const connector = buildPointLineConnector({
|
|
2069
|
+
trueAnchor: point.trueAnchor,
|
|
2070
|
+
glyphPosition,
|
|
2071
|
+
mode: pointConnectorMode,
|
|
2072
|
+
tickAngle: intent.tickAngle,
|
|
2073
|
+
displayAngle: visualAngle
|
|
2162
2074
|
});
|
|
2163
|
-
if (constrainedLabel.moved) {
|
|
2164
|
-
glyphPosition = constrainedLabel.position;
|
|
2165
|
-
point = {
|
|
2166
|
-
...point,
|
|
2167
|
-
glyphPosition,
|
|
2168
|
-
leaderLine: void 0
|
|
2169
|
-
};
|
|
2170
|
-
}
|
|
2171
|
-
point = {
|
|
2172
|
-
...point,
|
|
2173
|
-
leaderArc: buildPointConnector({
|
|
2174
|
-
center,
|
|
2175
|
-
tickAngle: intent.tickAngle,
|
|
2176
|
-
labelAngle: visualAngle,
|
|
2177
|
-
connectorRadius: intent.connectorRadius,
|
|
2178
|
-
glyphPosition,
|
|
2179
|
-
mode: pointConnectorMode
|
|
2180
|
-
})
|
|
2181
|
-
};
|
|
2182
2075
|
return {
|
|
2183
2076
|
...point,
|
|
2184
|
-
|
|
2077
|
+
leaderArc,
|
|
2078
|
+
connector
|
|
2185
2079
|
};
|
|
2186
2080
|
});
|
|
2187
2081
|
return {
|
|
@@ -2190,6 +2084,7 @@ function buildPointLayer(params) {
|
|
|
2190
2084
|
color,
|
|
2191
2085
|
tickColor,
|
|
2192
2086
|
radius,
|
|
2087
|
+
rails,
|
|
2193
2088
|
points
|
|
2194
2089
|
};
|
|
2195
2090
|
}
|
|
@@ -2198,21 +2093,42 @@ function makeAstroWheelPoint(params) {
|
|
|
2198
2093
|
layer,
|
|
2199
2094
|
seed,
|
|
2200
2095
|
tickLine,
|
|
2096
|
+
trueAngle,
|
|
2097
|
+
displayAngle,
|
|
2098
|
+
trueAnchor,
|
|
2201
2099
|
labelAngle,
|
|
2202
2100
|
glyphPosition,
|
|
2203
2101
|
glyphFontSize,
|
|
2102
|
+
rails,
|
|
2103
|
+
houses,
|
|
2104
|
+
center,
|
|
2204
2105
|
color,
|
|
2205
2106
|
tickColor
|
|
2206
2107
|
} = params;
|
|
2108
|
+
const houseContext = houses ? getHouseContext(seed.longitude, houses) : {};
|
|
2109
|
+
const railLabels = buildPointRailLabels({
|
|
2110
|
+
seed,
|
|
2111
|
+
rails,
|
|
2112
|
+
center,
|
|
2113
|
+
displayAngle,
|
|
2114
|
+
glyphFontSize
|
|
2115
|
+
});
|
|
2116
|
+
const glyphScale = glyphFontSize * 0.66;
|
|
2207
2117
|
return {
|
|
2208
|
-
|
|
2118
|
+
groupId: layer.id,
|
|
2209
2119
|
key: seed.key,
|
|
2210
2120
|
name: seed.name,
|
|
2211
2121
|
kind: seed.kind,
|
|
2212
2122
|
glyph: seed.glyph,
|
|
2213
2123
|
glyphKey: seed.glyphKey,
|
|
2214
2124
|
longitude: normalizeAngle(seed.longitude),
|
|
2215
|
-
displayLongitude: normalizeAngle(seed.longitude),
|
|
2125
|
+
displayLongitude: normalizeAngle(seed.longitude + rad2deg2(signedAngleDelta(displayAngle, trueAngle))),
|
|
2126
|
+
trueAnchor,
|
|
2127
|
+
trueAngle,
|
|
2128
|
+
displayAngle,
|
|
2129
|
+
house: houseContext.house,
|
|
2130
|
+
nearestCuspHouse: houseContext.nearestCuspHouse,
|
|
2131
|
+
nearestCuspDistanceDegrees: houseContext.nearestCuspDistanceDegrees,
|
|
2216
2132
|
zodiacPosition: seed.zodiacPosition,
|
|
2217
2133
|
tickLine,
|
|
2218
2134
|
labelAngle,
|
|
@@ -2220,27 +2136,158 @@ function makeAstroWheelPoint(params) {
|
|
|
2220
2136
|
leaderLine: void 0,
|
|
2221
2137
|
glyphPosition,
|
|
2222
2138
|
glyphFontSize,
|
|
2139
|
+
glyphScale,
|
|
2140
|
+
railLabels,
|
|
2141
|
+
hitTarget: {
|
|
2142
|
+
kind: "circle",
|
|
2143
|
+
cx: glyphPosition.x,
|
|
2144
|
+
cy: glyphPosition.y,
|
|
2145
|
+
r: round2(glyphScale * 0.72)
|
|
2146
|
+
},
|
|
2223
2147
|
retrograde: seed.retrograde,
|
|
2224
2148
|
color,
|
|
2225
2149
|
tickColor
|
|
2226
2150
|
};
|
|
2227
2151
|
}
|
|
2228
|
-
function
|
|
2152
|
+
function resolveRailVisibility(input) {
|
|
2153
|
+
if (!input || input === "glyph-only") {
|
|
2154
|
+
return { degree: false, sign: false, minutes: false, retrograde: false };
|
|
2155
|
+
}
|
|
2156
|
+
if (input === "compact") {
|
|
2157
|
+
return { degree: true, sign: true, minutes: false, retrograde: true };
|
|
2158
|
+
}
|
|
2159
|
+
if (input === "full") {
|
|
2160
|
+
return { degree: true, sign: true, minutes: true, retrograde: true };
|
|
2161
|
+
}
|
|
2162
|
+
return {
|
|
2163
|
+
degree: input.degree ?? true,
|
|
2164
|
+
sign: input.sign ?? true,
|
|
2165
|
+
minutes: input.minutes ?? true,
|
|
2166
|
+
retrograde: input.retrograde ?? true
|
|
2167
|
+
};
|
|
2168
|
+
}
|
|
2169
|
+
function resolveLayerRailVisibility(params) {
|
|
2170
|
+
if (params.layer.rails) {
|
|
2171
|
+
return resolveRailVisibility(params.layer.rails);
|
|
2172
|
+
}
|
|
2173
|
+
if (params.external) {
|
|
2174
|
+
return {
|
|
2175
|
+
degree: params.fallback.degree,
|
|
2176
|
+
sign: false,
|
|
2177
|
+
minutes: false,
|
|
2178
|
+
retrograde: false
|
|
2179
|
+
};
|
|
2180
|
+
}
|
|
2181
|
+
return params.fallback;
|
|
2182
|
+
}
|
|
2183
|
+
function buildPositionRails(params) {
|
|
2184
|
+
const { ring, scale, visibility, layerRadius, external, glyphFontSize } = params;
|
|
2185
|
+
if (external) {
|
|
2186
|
+
const gap = Math.max(2.4 * scale, 2);
|
|
2187
|
+
const step = Math.max(glyphFontSize * 0.22, 4.2 * scale);
|
|
2188
|
+
const firstRailRadius = layerRadius + glyphFontSize * 0.42 + gap;
|
|
2189
|
+
return [
|
|
2190
|
+
{ id: "degree", label: "Degree", radius: round2(firstRailRadius), visible: visibility.degree },
|
|
2191
|
+
{ id: "minutes", label: "Minutes", radius: round2(firstRailRadius + step * 2), visible: visibility.minutes },
|
|
2192
|
+
{ id: "sign", label: "Sign", radius: round2(firstRailRadius + step), visible: visibility.sign },
|
|
2193
|
+
{ id: "retrograde", label: "Retrograde", radius: round2(firstRailRadius + step * 3), visible: visibility.retrograde }
|
|
2194
|
+
];
|
|
2195
|
+
}
|
|
2196
|
+
const thickness = ring.r2 - ring.r1;
|
|
2197
|
+
const inset = Math.max(2 * scale, 1.5);
|
|
2198
|
+
return [
|
|
2199
|
+
{ id: "degree", label: "Degree", radius: round2(ring.r1 + thickness * 0.52 + inset), visible: visibility.degree },
|
|
2200
|
+
{ id: "minutes", label: "Minutes", radius: round2(ring.r1 + thickness * 0.24 + inset), visible: visibility.minutes },
|
|
2201
|
+
{ id: "sign", label: "Sign", radius: round2(ring.r1 + thickness * 0.38 + inset), visible: visibility.sign },
|
|
2202
|
+
{ id: "retrograde", label: "Retrograde", radius: round2(ring.r1 + thickness * 0.1 + inset), visible: visibility.retrograde }
|
|
2203
|
+
];
|
|
2204
|
+
}
|
|
2205
|
+
function buildPointRailLabels(params) {
|
|
2206
|
+
const position = params.seed.zodiacPosition ? formatInlinePosition(params.seed.zodiacPosition) : null;
|
|
2207
|
+
const fontSize = clamp(params.glyphFontSize * 0.25, 5, 8);
|
|
2208
|
+
return params.rails.flatMap((rail) => {
|
|
2209
|
+
let text = "";
|
|
2210
|
+
let sign;
|
|
2211
|
+
let glyphScale;
|
|
2212
|
+
if (rail.id === "degree")
|
|
2213
|
+
text = position?.degreesText ?? "";
|
|
2214
|
+
if (rail.id === "sign") {
|
|
2215
|
+
sign = position?.sign;
|
|
2216
|
+
text = sign ? ASTRO_WHEEL_ZODIAC_SIGNS.find((entry) => entry.sign === sign)?.glyph ?? sign : "";
|
|
2217
|
+
glyphScale = fontSize * 0.78;
|
|
2218
|
+
}
|
|
2219
|
+
if (rail.id === "minutes")
|
|
2220
|
+
text = position?.minutesText ?? "";
|
|
2221
|
+
if (rail.id === "retrograde")
|
|
2222
|
+
text = params.seed.retrograde ? "R" : "";
|
|
2223
|
+
if (!text)
|
|
2224
|
+
return [];
|
|
2225
|
+
return [{
|
|
2226
|
+
railId: rail.id,
|
|
2227
|
+
text,
|
|
2228
|
+
sign,
|
|
2229
|
+
position: polarToXY2(params.center.x, params.center.y, rail.radius, params.displayAngle),
|
|
2230
|
+
angle: params.displayAngle,
|
|
2231
|
+
fontSize,
|
|
2232
|
+
glyphScale,
|
|
2233
|
+
visible: rail.visible
|
|
2234
|
+
}];
|
|
2235
|
+
});
|
|
2236
|
+
}
|
|
2237
|
+
function getHouseContext(longitude, houses) {
|
|
2238
|
+
if (houses.length === 0) {
|
|
2239
|
+
return {};
|
|
2240
|
+
}
|
|
2241
|
+
const lon = normalizeAngle(longitude);
|
|
2242
|
+
let house = houses.length;
|
|
2243
|
+
let nearestCuspHouse = 1;
|
|
2244
|
+
let nearestCuspDistanceDegrees = Number.POSITIVE_INFINITY;
|
|
2245
|
+
for (let index = 0; index < houses.length; index++) {
|
|
2246
|
+
const cusp = normalizeAngle(houses[index].longitude);
|
|
2247
|
+
const next = normalizeAngle(houses[(index + 1) % houses.length].longitude);
|
|
2248
|
+
const span = clamp360(next - cusp);
|
|
2249
|
+
const offset = clamp360(lon - cusp);
|
|
2250
|
+
const distance = Math.abs(shortestLongitudeDistance(lon, cusp));
|
|
2251
|
+
if (offset < span || Math.abs(offset - span) < 1e-4) {
|
|
2252
|
+
house = index + 1;
|
|
2253
|
+
}
|
|
2254
|
+
if (distance < nearestCuspDistanceDegrees) {
|
|
2255
|
+
nearestCuspDistanceDegrees = distance;
|
|
2256
|
+
nearestCuspHouse = index + 1;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
return {
|
|
2260
|
+
house,
|
|
2261
|
+
nearestCuspHouse,
|
|
2262
|
+
nearestCuspDistanceDegrees: round2(nearestCuspDistanceDegrees)
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2265
|
+
function buildPointLineConnector(params) {
|
|
2266
|
+
if (params.mode === "never")
|
|
2267
|
+
return void 0;
|
|
2268
|
+
if (params.mode === "auto" && circularAngleDistance(params.tickAngle, params.displayAngle) < deg2rad2(0.35)) {
|
|
2269
|
+
return void 0;
|
|
2270
|
+
}
|
|
2271
|
+
return {
|
|
2272
|
+
x1: params.trueAnchor.x,
|
|
2273
|
+
y1: params.trueAnchor.y,
|
|
2274
|
+
x2: params.glyphPosition.x,
|
|
2275
|
+
y2: params.glyphPosition.y
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
function buildAspectGroup(params) {
|
|
2229
2279
|
const { layer, chart, pointByKey, center, angleOf: angleOf2, rings, palette, excludedBodies } = params;
|
|
2230
|
-
const sourceEdges = getSourceAspectEdges(chart, {
|
|
2280
|
+
const sourceEdges = layer.edges ? layer.edges : getSourceAspectEdges(chart, {
|
|
2231
2281
|
edges: layer.edges,
|
|
2232
2282
|
aspectSpecs: layer.aspectSpecs
|
|
2233
2283
|
});
|
|
2234
2284
|
const aspectRadius = layer.radius ?? rings.aspects.r2 * (layer.radiusScale ?? 0.96);
|
|
2235
|
-
const layerPointPrefix = pointKeyPrefix(layer.pointLayerId);
|
|
2236
|
-
const layerPointPrefixA = layer.pointLayerIdA ? pointKeyPrefix(layer.pointLayerIdA) : layerPointPrefix;
|
|
2237
|
-
const layerPointPrefixB = layer.pointLayerIdB ? pointKeyPrefix(layer.pointLayerIdB) : layerPointPrefix;
|
|
2238
2285
|
const aspectLines = sourceEdges.flatMap((edge) => {
|
|
2239
2286
|
if (isExcludedBody(edge.planetA, excludedBodies) || isExcludedBody(edge.planetB, excludedBodies)) {
|
|
2240
2287
|
return [];
|
|
2241
2288
|
}
|
|
2242
|
-
const planetAKey =
|
|
2243
|
-
const planetBKey =
|
|
2289
|
+
const planetAKey = normalizePointKey(edge.planetA);
|
|
2290
|
+
const planetBKey = normalizePointKey(edge.planetB);
|
|
2244
2291
|
const planetA = pointByKey[planetAKey];
|
|
2245
2292
|
const planetB = pointByKey[planetBKey];
|
|
2246
2293
|
if (!planetA || !planetB) {
|
|
@@ -2249,10 +2296,10 @@ function buildAspectLayer(params) {
|
|
|
2249
2296
|
const spec = findAspectSpec(edge.aspect, layer.aspectSpecs);
|
|
2250
2297
|
const maxOrb = spec?.orb ?? 8;
|
|
2251
2298
|
const opacity = clamp((1 - edge.orb / Math.max(maxOrb, 1e-3)) * (layer.opacityScale ?? 1), 0.25, 0.92);
|
|
2252
|
-
const a = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude));
|
|
2253
|
-
const b = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude));
|
|
2299
|
+
const a = layer.radius || layer.radiusScale ? polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude)) : planetA.trueAnchor;
|
|
2300
|
+
const b = layer.radius || layer.radiusScale ? polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude)) : planetB.trueAnchor;
|
|
2254
2301
|
return [{
|
|
2255
|
-
|
|
2302
|
+
groupId: layer.id,
|
|
2256
2303
|
planetA: planetA.name,
|
|
2257
2304
|
planetB: planetB.name,
|
|
2258
2305
|
planetAKey,
|
|
@@ -2311,9 +2358,9 @@ function getPointSeeds(layer, excludedBodies) {
|
|
|
2311
2358
|
}
|
|
2312
2359
|
return seeds.filter((seed) => !isExcludedBody(seed.name, excludedBodies)).sort((a, b) => normalizeAngle(a.longitude) - normalizeAngle(b.longitude));
|
|
2313
2360
|
}
|
|
2314
|
-
function planetSeed(key, planet,
|
|
2361
|
+
function planetSeed(key, planet, groupId) {
|
|
2315
2362
|
return {
|
|
2316
|
-
key: layerPointKey(
|
|
2363
|
+
key: layerPointKey(groupId, key || planet.name),
|
|
2317
2364
|
name: planet.name,
|
|
2318
2365
|
kind: "planet",
|
|
2319
2366
|
glyph: pointGlyph(planet.name),
|
|
@@ -2323,9 +2370,9 @@ function planetSeed(key, planet, layerId) {
|
|
|
2323
2370
|
zodiacPosition: planet.zodiacPosition
|
|
2324
2371
|
};
|
|
2325
2372
|
}
|
|
2326
|
-
function nodeSeed(key, node,
|
|
2373
|
+
function nodeSeed(key, node, groupId) {
|
|
2327
2374
|
return {
|
|
2328
|
-
key: layerPointKey(
|
|
2375
|
+
key: layerPointKey(groupId, node.name || key),
|
|
2329
2376
|
name: node.name,
|
|
2330
2377
|
kind: "node",
|
|
2331
2378
|
glyph: pointGlyph(node.name),
|
|
@@ -2334,9 +2381,9 @@ function nodeSeed(key, node, layerId) {
|
|
|
2334
2381
|
zodiacPosition: node
|
|
2335
2382
|
};
|
|
2336
2383
|
}
|
|
2337
|
-
function pointSeed(point,
|
|
2384
|
+
function pointSeed(point, groupId) {
|
|
2338
2385
|
return {
|
|
2339
|
-
key: layerPointKey(
|
|
2386
|
+
key: layerPointKey(groupId, point.key ?? point.name),
|
|
2340
2387
|
name: point.name,
|
|
2341
2388
|
kind: point.kind ?? "planet",
|
|
2342
2389
|
glyph: point.glyph ?? pointGlyph(point.name),
|
|
@@ -2351,7 +2398,7 @@ function solveCircularLabelAngles(items, options) {
|
|
|
2351
2398
|
if (items.length === 0) {
|
|
2352
2399
|
return [];
|
|
2353
2400
|
}
|
|
2354
|
-
const normalized = items.map((item) => ({
|
|
2401
|
+
const normalized = seedExactAngleClusters(items, { paddingPx, maxDisplacementRad }).map((item) => ({
|
|
2355
2402
|
...item,
|
|
2356
2403
|
idealAngle: clampRad(item.idealAngle)
|
|
2357
2404
|
})).sort((a, b) => a.idealAngle - b.idealAngle);
|
|
@@ -2390,8 +2437,8 @@ function solveCircularLabelAngles(items, options) {
|
|
|
2390
2437
|
}
|
|
2391
2438
|
const solved = linear.map((item) => ({
|
|
2392
2439
|
...item,
|
|
2393
|
-
visualAngle: item.idealAngle
|
|
2394
|
-
}));
|
|
2440
|
+
visualAngle: item.visualAngleSeed ?? item.idealAngle
|
|
2441
|
+
})).sort((a, b) => a.visualAngle - b.visualAngle);
|
|
2395
2442
|
for (let iteration = 0; iteration < 50; iteration++) {
|
|
2396
2443
|
const forces = new Array(solved.length).fill(0);
|
|
2397
2444
|
let maxForce = 0;
|
|
@@ -2434,6 +2481,38 @@ function solveCircularLabelAngles(items, options) {
|
|
|
2434
2481
|
visualAngle: clampRad(item.visualAngle)
|
|
2435
2482
|
}));
|
|
2436
2483
|
}
|
|
2484
|
+
function seedExactAngleClusters(items, options) {
|
|
2485
|
+
const seeded = items.map((item) => ({
|
|
2486
|
+
...item,
|
|
2487
|
+
idealAngle: clampRad(item.idealAngle)
|
|
2488
|
+
}));
|
|
2489
|
+
const groups = /* @__PURE__ */ new Map();
|
|
2490
|
+
for (const item of seeded) {
|
|
2491
|
+
const key = item.idealAngle.toFixed(6);
|
|
2492
|
+
const group = groups.get(key);
|
|
2493
|
+
if (group) {
|
|
2494
|
+
group.push(item);
|
|
2495
|
+
} else {
|
|
2496
|
+
groups.set(key, [item]);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
for (const group of groups.values()) {
|
|
2500
|
+
if (group.length < 2) {
|
|
2501
|
+
continue;
|
|
2502
|
+
}
|
|
2503
|
+
const center = group[0].idealAngle;
|
|
2504
|
+
const largestDemand = Math.max(
|
|
2505
|
+
...group.map((item) => labelAngularHalfDemand(item, options.paddingPx) * 2)
|
|
2506
|
+
);
|
|
2507
|
+
const maxStep = group.length > 1 ? options.maxDisplacementRad * 2 / (group.length - 1) : largestDemand;
|
|
2508
|
+
const step = Math.min(largestDemand, maxStep);
|
|
2509
|
+
const midpoint2 = (group.length - 1) / 2;
|
|
2510
|
+
group.forEach((item, index) => {
|
|
2511
|
+
item.visualAngleSeed = center + (index - midpoint2) * step;
|
|
2512
|
+
});
|
|
2513
|
+
}
|
|
2514
|
+
return seeded;
|
|
2515
|
+
}
|
|
2437
2516
|
function clampAngleAroundIdeal(value, ideal, maxDistance) {
|
|
2438
2517
|
if (!Number.isFinite(maxDistance) || maxDistance >= Math.PI) {
|
|
2439
2518
|
return value;
|
|
@@ -2460,6 +2539,9 @@ function circularAngleDistance(a, b) {
|
|
|
2460
2539
|
const delta = Math.abs(clampRad(a) - clampRad(b));
|
|
2461
2540
|
return Math.min(delta, TAU2 - delta);
|
|
2462
2541
|
}
|
|
2542
|
+
function rad2deg2(radians) {
|
|
2543
|
+
return radians * (360 / TAU2);
|
|
2544
|
+
}
|
|
2463
2545
|
function buildPointConnector(params) {
|
|
2464
2546
|
const { center, tickAngle, labelAngle, connectorRadius, glyphPosition, mode } = params;
|
|
2465
2547
|
const displacement = circularAngleDistance(tickAngle, labelAngle);
|
|
@@ -2527,6 +2609,9 @@ function getAspectMatch(lonA, lonB, specs) {
|
|
|
2527
2609
|
}
|
|
2528
2610
|
return null;
|
|
2529
2611
|
}
|
|
2612
|
+
function shortestLongitudeDistance(a, b) {
|
|
2613
|
+
return (normalizeAngle(a) - normalizeAngle(b) + 540) % 360 - 180;
|
|
2614
|
+
}
|
|
2530
2615
|
function findAspectSpec(aspect, specs = ASTRO_WHEEL_DEFAULT_ASPECT_SPECS) {
|
|
2531
2616
|
return specs.find((spec) => spec.name === aspect);
|
|
2532
2617
|
}
|
|
@@ -2659,7 +2744,7 @@ function resolveAspectOptions(options) {
|
|
|
2659
2744
|
aspectSpecs: options.aspectSpecs
|
|
2660
2745
|
};
|
|
2661
2746
|
}
|
|
2662
|
-
function
|
|
2747
|
+
function resolvePointGroupRadius(layer, rings) {
|
|
2663
2748
|
const ring = rings.planets;
|
|
2664
2749
|
if (layer.radius === "external") {
|
|
2665
2750
|
return rings.houses.r2 + (layer.radiusOffset ?? 18);
|
|
@@ -2692,12 +2777,9 @@ function isExcludedBody(name, excludedBodies) {
|
|
|
2692
2777
|
function normalizePointKey(value) {
|
|
2693
2778
|
return value.trim().toLocaleLowerCase().replace(/[_-]+/g, " ").replace(/\s+/g, " ");
|
|
2694
2779
|
}
|
|
2695
|
-
function layerPointKey(
|
|
2780
|
+
function layerPointKey(groupId, value) {
|
|
2696
2781
|
const key = normalizePointKey(value);
|
|
2697
|
-
return
|
|
2698
|
-
}
|
|
2699
|
-
function pointKeyPrefix(layerId) {
|
|
2700
|
-
return !layerId || layerId === "birth" ? "" : `${layerId}:`;
|
|
2782
|
+
return groupId === "birth" ? key : `${groupId}:${key}`;
|
|
2701
2783
|
}
|
|
2702
2784
|
function renderGlyphPrimitives(push, primitives, options) {
|
|
2703
2785
|
for (const p of primitives) {
|
|
@@ -3802,10 +3884,9 @@ exports.generateGlyphSvg = generateGlyphSvg;
|
|
|
3802
3884
|
exports.generateTreeSvg = generateTreeSvg;
|
|
3803
3885
|
exports.getArcheometerRenderModel = getArcheometerRenderModel;
|
|
3804
3886
|
exports.getAstroGlyph = getAstroGlyph;
|
|
3805
|
-
exports.getAstroWheelRenderModel = getAstroWheelRenderModel;
|
|
3806
3887
|
exports.getRouteActivations = getRouteActivations;
|
|
3807
3888
|
exports.getTreeLayout = getTreeLayout;
|
|
3808
3889
|
exports.getTreeRenderModel = getTreeRenderModel;
|
|
3809
3890
|
exports.listAstroGlyphs = listAstroGlyphs;
|
|
3810
3891
|
//# sourceMappingURL=out.js.map
|
|
3811
|
-
//# sourceMappingURL=chunk-
|
|
3892
|
+
//# sourceMappingURL=chunk-XUD2HQUG.js.map
|