Skip to content

Commit

Permalink
#5497 – Refactor (SideChainConnectionBondRenderer): Create the interf…
Browse files Browse the repository at this point in the history
…aces for `drawPartOfSideConnection(1)`
  • Loading branch information
DmitriiP-EPAM committed Dec 5, 2024
1 parent 37f0128 commit 1062c3e
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ interface CalculateEndOfPathPartParameter {
readonly yOffset: number;
}

interface DrawPartOfSideConnectionParameter {
readonly cell: Cell;
readonly connection: Connection;
readonly direction: ConnectionDirectionInDegrees;
readonly horizontal: boolean;
readonly sideConnectionBondTurnPoint: number;
}

interface DrawPartOfSideConnectionResult {
readonly pathPart: string;
readonly sideConnectionBondTurnPoint: number;
}

const BOND_END_LENGTH = 15;
const CELL_HEIGHT = 40;
const SMOOTH_CORNER_SIZE = 5;
Expand Down Expand Up @@ -261,23 +274,13 @@ export class SideChainConnectionBondRenderer {
: scaledMonomerPosition.y + monomerSize.height / 2 + yOffset;
}

// TODO: Specify the types.
private drawPartOfSideConnection({
cell,
connection,
direction,
horizontal,
sideConnectionBondTurnPoint,
}: {
readonly cell: Cell;
readonly connection: Connection;
readonly direction: ConnectionDirectionInDegrees;
readonly horizontal: boolean;
readonly sideConnectionBondTurnPoint: number;
}): {
readonly pathPart: string;
readonly sideConnectionBondTurnPoint: number;
} {
}: DrawPartOfSideConnectionParameter): DrawPartOfSideConnectionResult {
const sin = Math.sin((direction * Math.PI) / 180);
const cos = Math.cos((direction * Math.PI) / 180);
const xOffset = (SNAKE_LAYOUT_CELL_WIDTH / 2) * cos;
Expand Down

0 comments on commit 1062c3e

Please sign in to comment.