Skip to content

Commit

Permalink
#4697 - Macro: Highlight connection point (change mouse cursor) on mo…
Browse files Browse the repository at this point in the history
…use hover
  • Loading branch information
ilya-asiyuk-epam committed May 28, 2024
1 parent 52ace78 commit 5c30180
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ exports[`Polymer Bond Renderer should render bond 1`] = `
y1="400"
y2="4000"
/>
<circle
cursor="pointer"
cx="3600"
cy="4000"
fill="transparent"
r="1"
stroke-width="10"
/>
</g>
</g>
</svg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export abstract class BaseRenderer implements IBaseRenderer {
void
>;

protected hoverCircleAreaElement?: D3SvgElementSelection<
SVGGElement | SVGCircleElement,
void
>;

protected canvasWrapper: D3SvgElementSelection<SVGSVGElement, void>;

protected canvas: D3SvgElementSelection<SVGSVGElement, void>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,10 @@ export class PolymerBondRenderer extends BaseRenderer {
.attr('x2', this.scaledPosition.endPosition.x)
.attr('y2', this.scaledPosition.endPosition.y);

this.hoverCircleAreaElement
?.attr('cx', this.scaledPosition.endPosition.x)
.attr('cy', this.scaledPosition.endPosition.y);

this.selectionElement
?.attr('x2', this.scaledPosition.endPosition.x)
?.attr('y2', this.scaledPosition.endPosition.y);
Expand Down Expand Up @@ -632,6 +636,17 @@ export class PolymerBondRenderer extends BaseRenderer {
.attr('x2', this.scaledPosition.endPosition.x)
.attr('y2', this.scaledPosition.endPosition.y)
.attr('stroke-width', '10');

(<D3SvgElementSelection<SVGCircleElement, void> | undefined>(
this.hoverCircleAreaElement
)) = this.rootElement
?.append('circle')
.attr('cursor', 'pointer')
.attr('r', '1')
.attr('fill', 'transparent')
.attr('stroke-width', '10')
.attr('cx', this.scaledPosition.endPosition.x)
.attr('cy', this.scaledPosition.endPosition.y);
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/ketcher-core/src/domain/AttachmentPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class AttachmentPoint {
.insert('g', ':first-child')
.data([this])
.style('pointer-events', 'none')
.style('cursor', 'pointer')
.attr('class', 'dynamic-element');

const attachmentPointElement = this.attachmentPoint.append('g');
Expand Down

0 comments on commit 5c30180

Please sign in to comment.