Skip to content

#7973 - Hover mouse over AA, LGA, or the bond connecting them should cause highlight of corresponding AP in the Attributes panel#10158

Open
sabaPailodze wants to merge 2 commits into
masterfrom
7973-Hover-mouse-over-AA-LGA-or-bond-highlight-AP-in-Attributes-panel
Open

#7973 - Hover mouse over AA, LGA, or the bond connecting them should cause highlight of corresponding AP in the Attributes panel#10158
sabaPailodze wants to merge 2 commits into
masterfrom
7973-Hover-mouse-over-AA-LGA-or-bond-highlight-AP-in-Attributes-panel

Conversation

@sabaPailodze
Copy link
Copy Markdown
Collaborator

@sabaPailodze sabaPailodze commented Jun 2, 2026

Summary

When hovering over an already-set attachment point on the canvas — the attachment atom (AA), the leaving group atom (LGA), or the bond connecting them — the editor now highlights the corresponding attachment point row in the Attributes panel. Previously only hovering the R-number label triggered the highlight.

Changes

Canvas hover → panel highlight for AA, LGA, and the connecting bond

Problem: Hovering the R-number label highlighted its panel row, but hovering the attachment atom, the leaving-group atom, or the bond between them did not. The highlight was wired up through a Raphael DOM .hover() on the hover plate, which stops firing when the cursor sits directly over the atom's text label, so the highlight broke at the center of the atom.

Solution: Moved the highlight dispatch off the DOM hover plate and into the editor's geometric setHover tracking in ReAtom and ReBond. This is driven by distance-based hit detection rather than DOM pointer events, so it stays stable over the whole element, including the label center. A getAttachmentPointName helper resolves which AP the hovered atom/bond belongs to, and a highlight/reset CustomEvent is dispatched only on real hover transitions.

Order-independent highlight via hover reference counting

Problem: Moving the cursor directly between two elements of the same AP (e.g. from R1 to the H atom) could deliver a "reset" event from the element being left right after the "highlight" event from the element being entered. Since both targeted the same panel row, the late reset wrongly cleared the highlight.

Solution: The panel components now keep an active-hover counter instead of a boolean. Each highlight increments it and each reset decrements it; the row only clears when the count reaches zero — once the cursor has truly left every element of that AP. This makes the result independent of event ordering.

Files Modified

ketcher-core

  • reatom.ts — removed the DOM-.hover()-based highlight trigger; added a getAttachmentPointName helper and a setHover override that dispatches the panel highlight events on hover transitions
  • rebond.ts — added a setHover override and getAttachmentPointName helper so the bond connecting AA↔LGA dispatches the same panel highlight events

ketcher-react

  • AttachmentPoint.tsx — replaced the boolean highlight handling with active-hover reference counting so the row stays highlighted across transitions between the AP's elements
  • ReadonlyAttachmentPoint.tsx — applied the same reference-counting logic for readonly (inter-component connection) attachment point rows

Check list

  • unit-tests written
  • e2e-tests written
  • documentation updated
  • PR name follows the pattern #1234 – issue name
  • branch name doesn't contain '#'
  • PR is linked with the issue
  • base branch (master or release/xx) is correct
  • task status changed to "Code review"
  • reviewers are notified about the pull request

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hover mouse over AA, LGA, or the bond connecting them should cause highlight of corresponding AP in the Attributes panel

1 participant