TOOLTIPS: extract .tt base to _tooltips.scss + natus element/planet title colours
- New _tooltips.scss: .token-tooltip/.tt base block extracted from _wallet-tokens.scss
- core.scss: import order …billboard → tooltips → game-kit → wallet-tokens
- _natus.scss: .tt-title--au/ag/…/pu (--six* dark, --pri* light) + .tt-title--el-* for element ring (--pri* dark, --ter* light) via body[class*="-light"] selector
- natus-wheel.js: element tooltip title switched from inline style to .tt-title--el-{key} CSS class; PLANET_ELEMENTS map drives .tt-title--{el} class on planet titles
- _game-kit.scss: kit bag .tt child font-size rules added (1rem title, 0.75rem desc/shoptalk/expiry)
- CLAUDE.md: SCSS import order updated
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,16 @@ const NatusWheel = (() => {
|
||||
Jupiter: 'sn', Saturn: 'pb', Uranus: 'u', Neptune: 'np', Pluto: 'pu',
|
||||
};
|
||||
|
||||
// EarthmanRPG element names + classical equivalents + ring segment color var
|
||||
const ELEMENT_INFO = {
|
||||
Fire: { abbr: 'Ar', name: 'Ardor', classical: 'fire', titleVar: '--priRd' },
|
||||
Stone: { abbr: 'Om', name: 'Ossum', classical: 'stone', titleVar: '--priFs' },
|
||||
Time: { abbr: 'Tp', name: 'Tempo', classical: 'time', titleVar: '--priYl' },
|
||||
Space: { abbr: 'Nx', name: 'Nexus', classical: 'space', titleVar: '--priGn' },
|
||||
Air: { abbr: 'Pn', name: 'Pneuma', classical: 'air', titleVar: '--priCy' },
|
||||
Water: { abbr: 'Hm', name: 'Humor', classical: 'water', titleVar: '--priId' },
|
||||
};
|
||||
|
||||
// Aspect stroke colors remain in JS — they are data-driven, not stylistic.
|
||||
const ASPECT_COLORS = {
|
||||
Conjunction: 'var(--priYl, #f0e060)',
|
||||
@@ -287,7 +297,7 @@ const NatusWheel = (() => {
|
||||
const inDeg = _inSignDeg(pdata.degree).toFixed(1);
|
||||
const rx = pdata.retrograde ? ' ℞' : '';
|
||||
tooltip.innerHTML =
|
||||
`<div class="tt-title">${name} (${sym})</div>` +
|
||||
`<div class="tt-title tt-title--${el}">${name} (${sym})</div>` +
|
||||
`<div class="tt-description">${inDeg}° ${pdata.sign} ${signSym}${rx}</div>`;
|
||||
tooltip.style.left = (event.clientX + 14) + 'px';
|
||||
tooltip.style.top = (event.clientY - 10) + 'px';
|
||||
@@ -383,12 +393,12 @@ const NatusWheel = (() => {
|
||||
|
||||
function _drawElements(g, data) {
|
||||
const el = data.elements;
|
||||
const total = (el.Fire || 0) + (el.Stone || 0) + (el.Air || 0) + (el.Water || 0);
|
||||
// Deasil order: Fire → Stone → Time → Space → Air → Water
|
||||
const ELEMENT_ORDER = ['Fire', 'Stone', 'Time', 'Space', 'Air', 'Water'];
|
||||
const total = ELEMENT_ORDER.reduce((s, k) => s + (el[k] || 0), 0);
|
||||
if (total === 0) return;
|
||||
|
||||
const pieData = ['Fire', 'Stone', 'Air', 'Water'].map(k => ({
|
||||
key: k, value: el[k] || 0,
|
||||
}));
|
||||
const pieData = ELEMENT_ORDER.map(k => ({ key: k, value: el[k] || 0 }));
|
||||
|
||||
const pie = d3.pie().value(d => d.value).sort(null)(pieData);
|
||||
const arc = d3.arc().innerRadius(R.elementInner).outerRadius(R.elementOuter);
|
||||
@@ -397,24 +407,36 @@ const NatusWheel = (() => {
|
||||
.attr('class', 'nw-elements')
|
||||
.attr('transform', `translate(${_cx},${_cy})`);
|
||||
|
||||
elGroup.selectAll('path')
|
||||
.data(pie)
|
||||
.join('path')
|
||||
.attr('d', arc)
|
||||
.attr('class', d => `nw-element--${d.data.key.toLowerCase()}`);
|
||||
// Per-slice group: carries hover events + glow, arc path inside
|
||||
pie.forEach(slice => {
|
||||
const info = ELEMENT_INFO[slice.data.key] || {};
|
||||
|
||||
// Time + Space emergent counts as text
|
||||
['Time', 'Space'].forEach((key, i) => {
|
||||
const count = el[key] || 0;
|
||||
if (count === 0) return;
|
||||
g.append('text')
|
||||
.attr('x', _cx + (i === 0 ? -1 : 1) * R.elementInner * 0.6)
|
||||
.attr('y', _cy)
|
||||
.attr('text-anchor', 'middle')
|
||||
.attr('dominant-baseline', 'middle')
|
||||
.attr('font-size', `${_r * 0.045}px`)
|
||||
.attr('class', `nw-element-label--${key.toLowerCase()}`)
|
||||
.text(`${key[0]}${count}`);
|
||||
const sliceGroup = elGroup.append('g')
|
||||
.attr('class', 'nw-element-group')
|
||||
.on('mouseover', function (event) {
|
||||
d3.select(this).classed('nw-element--hover', true);
|
||||
const tooltip = document.getElementById('id_natus_tooltip');
|
||||
if (!tooltip) return;
|
||||
const count = slice.data.value;
|
||||
const pct = total > 0 ? Math.round((count / total) * 100) : 0;
|
||||
const elKey = slice.data.key.toLowerCase();
|
||||
tooltip.innerHTML =
|
||||
`<div class="tt-title tt-title--el-${elKey}">[${info.abbr}] ${info.name}</div>` +
|
||||
`<div class="tt-description">${info.classical} · ${count} (${pct}%)</div>`;
|
||||
tooltip.style.left = (event.clientX + 14) + 'px';
|
||||
tooltip.style.top = (event.clientY - 10) + 'px';
|
||||
tooltip.style.display = 'block';
|
||||
})
|
||||
.on('mouseout', function (event) {
|
||||
if (sliceGroup.node().contains(event.relatedTarget)) return;
|
||||
d3.select(this).classed('nw-element--hover', false);
|
||||
const tooltip = document.getElementById('id_natus_tooltip');
|
||||
if (tooltip) tooltip.style.display = 'none';
|
||||
});
|
||||
|
||||
sliceGroup.append('path')
|
||||
.attr('d', arc(slice))
|
||||
.attr('class', `nw-element--${slice.data.key.toLowerCase()}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user