#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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
setHovertracking inReAtomandReBond. 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. AgetAttachmentPointNamehelper resolves which AP the hovered atom/bond belongs to, and a highlight/resetCustomEventis 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-corereatom.ts— removed the DOM-.hover()-based highlight trigger; added agetAttachmentPointNamehelper and asetHoveroverride that dispatches the panel highlight events on hover transitionsrebond.ts— added asetHoveroverride andgetAttachmentPointNamehelper so the bond connecting AA↔LGA dispatches the same panel highlight eventsketcher-reactAttachmentPoint.tsx— replaced the boolean highlight handling with active-hover reference counting so the row stays highlighted across transitions between the AP's elementsReadonlyAttachmentPoint.tsx— applied the same reference-counting logic for readonly (inter-component connection) attachment point rowsCheck list
#1234 – issue name