Skip to content

Commit

Permalink
#6215 – Fix screenshot and appearance of snapping
Browse files Browse the repository at this point in the history
  • Loading branch information
svvald committed Mar 3, 2025
1 parent 7eb3243 commit 4ad7940
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { TransientView } from './TransientView';
import { D3SvgElementSelection } from 'application/render/types';
import { BaseMonomer, PolymerBond } from 'domain/entities';
import { BaseMonomer, HydrogenBond, PolymerBond } from 'domain/entities';
import { Coordinates } from 'application/editor';
import { arc } from 'd3';

export type AngleSnapViewParams = {
connectedMonomer: BaseMonomer;
polymerBond: PolymerBond;
polymerBond: PolymerBond | HydrogenBond;
isDistanceSnapped: boolean;
};

Expand Down Expand Up @@ -57,7 +57,7 @@ export class AngleSnapView extends TransientView {
.attr('x2', connectedPositionInPixels.x)
.attr('y2', connectedPositionInPixels.y - 40)
.attr('stroke', '#365CFF')
.attr('stroke-dasharray', '4 4')
.attr('stroke-dasharray', '4')
.style('opacity', 0.5);

if (!isDistanceSnapped) {
Expand All @@ -69,7 +69,10 @@ export class AngleSnapView extends TransientView {
.attr('y2', movingPositionInPixels.y)
.attr('stroke', '#365CFF')
.attr('stroke-width', 1)
.attr('stroke-dasharray', '4 4');
.attr(
'stroke-dasharray',
polymerBond instanceof HydrogenBond ? '2' : '0',
);
}

const bondAngle = Math.atan2(
Expand Down Expand Up @@ -104,6 +107,7 @@ export class AngleSnapView extends TransientView {
`translate(${connectedPositionInPixels.x}, ${connectedPositionInPixels.y})`,
)
.attr('fill', 'none')
.attr('opacity', 0.5)
.attr('stroke', '#365CFF')
.attr('marker-end', 'url(#arrow-marker-arc)');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Coordinates } from 'application/editor';
import { D3SvgElementSelection } from 'application/render/types';
import { PolymerBond } from 'domain/entities';
import { HydrogenBond, PolymerBond } from 'domain/entities';
import { TransientView } from './TransientView';

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down Expand Up @@ -53,7 +53,7 @@ export class BondSnapView extends TransientView {
.attr('y2', endPositionInPixels.y)
.attr('stroke', '#365CFF')
.attr('stroke-width', 1)
.attr('stroke-dasharray', '4 4')
.attr('stroke-dasharray', bond instanceof HydrogenBond ? '2' : '0')
.attr('style', 'pointer-events: none');
}
}

0 comments on commit 4ad7940

Please sign in to comment.