Skip to content

feat: add atom hover tooltip#115

Open
bud-primordium wants to merge 4 commits intosuperstar54:mainfrom
bud-primordium:feat/atom-hover-tooltip
Open

feat: add atom hover tooltip#115
bud-primordium wants to merge 4 commits intosuperstar54:mainfrom
bud-primordium:feat/atom-hover-tooltip

Conversation

@bud-primordium
Copy link
Copy Markdown

@bud-primordium bud-primordium commented Apr 12, 2026

Hi! We've been happily using WEAS in our project for interactive crystal structure visualization — thanks for the great work!

Summary

This PR adds two small improvements:

1. Atom hover tooltip (main feature)

Displays atom information (element symbol, index, Cartesian coordinates) when hovering over atoms in the 3D viewer.

  • New plugin: AtomTooltipManager with lazy initialization
  • Configurable via enableAtomTooltip (default: true)
  • Integrates with viewer state system (applyState/setState)
  • Tooltip DOM is preserved across drawModels() re-renders
  • Zero new dependencies — uses native DOM overlay + Three.js Raycaster

2. Style subpath export (minor fix)

Exposes style.css through package exports so bundlers that enforce strict export resolution (e.g. Vite 5) can import it directly via import 'weas/style.css'.

Screenshot

weas-fork-test

Bundlers like Vite 5 that enforce strict export resolution cannot
resolve 'weas/style.css' unless it is listed in the exports field.
Add AtomTooltipManager plugin that shows element symbol, atom index,
and Cartesian coordinates on mouse hover over atoms.

- Lazy init: DOM and events only created when enabled
- Configurable via enableAtomTooltip (default: true)
- Integrates with viewer state system (applyState/setState)
- Tooltip state resets on re-render but DOM survives
- Zero new dependencies (native DOM + Three.js Raycaster)
@superstar54 superstar54 self-requested a review April 18, 2026 02:42
Copy link
Copy Markdown
Owner

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants