Skip to content

Commit

Permalink
#5497 – Refactor (SnakeModeSideChainBondRenderer): Rename `calculateS…
Browse files Browse the repository at this point in the history
…ideConnectionBondTurnPoint(1)`
  • Loading branch information
DmitriiP-EPAM committed Dec 6, 2024
1 parent 0154ba2 commit 7130f51
Showing 1 changed file with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ type D3SelectionSVGPath<ThisType> = D3SvgElementSelection<
type D3SelectionSVGG<ThisType> = D3SvgElementSelection<SVGGElement, ThisType>;

interface AppendPathToElementParameter<ThisType> {
pathDAttributeValue: string;
element: D3SelectionSVGG<ThisType>;
cssClassForPath: string;
readonly cssClassForPath: string;
readonly element: D3SelectionSVGG<ThisType>;
readonly pathDAttributeValue: string;
}

interface AppendSideConnectionBondParameter {
Expand All @@ -36,7 +36,7 @@ interface AppendSideConnectionBondResult {
readonly sideConnectionBondTurnPointUpdated: number;
}

interface CalculateEndOfPathPartParameter {
interface CalculateSideConnectionBondTurnPointParameter {
readonly horizontal: boolean;
readonly monomerSize: BaseMonomerRenderer['monomerSize'];
readonly scaledMonomerPosition: Vec2;
Expand Down Expand Up @@ -262,20 +262,21 @@ export class SnakeModeSideChainBondRenderer {
};
}

private calculateEndOfPathPart({
private calculateSideConnectionBondTurnPoint({
horizontal,
monomerSize,
scaledMonomerPosition,
sideConnectionBondTurnPoint,
xOffset,
yOffset,
}: CalculateEndOfPathPartParameter): number {
if (horizontal && sideConnectionBondTurnPoint) {
return sideConnectionBondTurnPoint;
}: CalculateSideConnectionBondTurnPointParameter): number {
if (horizontal) {
if (sideConnectionBondTurnPoint) {
return sideConnectionBondTurnPoint;
}
return scaledMonomerPosition.x + monomerSize.width / 2 + xOffset;
}
return horizontal
? scaledMonomerPosition.x + monomerSize.width / 2 + xOffset
: scaledMonomerPosition.y + monomerSize.height / 2 + yOffset;
return scaledMonomerPosition.y + monomerSize.height / 2 + yOffset;
}

private drawPartOfSideConnection({
Expand Down Expand Up @@ -305,16 +306,17 @@ export class SnakeModeSideChainBondRenderer {

const { monomerSize, scaledMonomerPosition } = (cell.monomer as BaseMonomer)
.renderer as BaseMonomerRenderer;
let endOfPathPart = this.calculateEndOfPathPart({
horizontal,
monomerSize,
scaledMonomerPosition,
sideConnectionBondTurnPoint,
xOffset,
yOffset,
});
const sideConnectionBondTurnPointInternal =
this.calculateSideConnectionBondTurnPoint({
horizontal,
monomerSize,
scaledMonomerPosition,
sideConnectionBondTurnPoint,
xOffset,
yOffset,
});

const sideConnectionBondTurnPointInternal = endOfPathPart;
let endOfPathPart = sideConnectionBondTurnPointInternal;

if (horizontal) {
endOfPathPart +=
Expand Down

0 comments on commit 7130f51

Please sign in to comment.