diff --git a/packages/ketcher-core/src/application/render/renderers/PolymerBondRenderer/SnakeModePolymerBondRenderer.ts b/packages/ketcher-core/src/application/render/renderers/PolymerBondRenderer/SnakeModePolymerBondRenderer.ts index c6def15491..3bc3ea2fa2 100644 --- a/packages/ketcher-core/src/application/render/renderers/PolymerBondRenderer/SnakeModePolymerBondRenderer.ts +++ b/packages/ketcher-core/src/application/render/renderers/PolymerBondRenderer/SnakeModePolymerBondRenderer.ts @@ -222,7 +222,7 @@ export class SnakeModePolymerBondRenderer extends BaseRenderer { let previousConnection; let previousCell; - const horizontalPartIntersectionsOffset = firstCellConnection.offset; + const horizontalPartIntersectionsOffset = firstCellConnection.xOffset; const areCellsOnSameRow = cells.every((cell) => { return cell.y === firstCell.y; @@ -276,9 +276,9 @@ export class SnakeModePolymerBondRenderer extends BaseRenderer { : 0 : xDirection; const maxXOffset = cell.connections.reduce((max, connection) => { - return connection.isVertical || max > connection.offset + return connection.isVertical || max > connection.xOffset ? max - : connection.offset; + : connection.xOffset; }, 0); maxHorizontalOffset = @@ -304,8 +304,8 @@ export class SnakeModePolymerBondRenderer extends BaseRenderer { SMOOTH_CORNER_SIZE - sin * (cellConnection.yOffset || 0) * 3 - (isTwoNeighborRowsConnection - ? maxHorizontalOffset - cellConnection.offset - : cellConnection.offset) * + ? maxHorizontalOffset - cellConnection.xOffset + : cellConnection.xOffset) * 3 } `; dAttributeForPath += generateBend(0, sin, cos, 1); diff --git a/packages/ketcher-core/src/domain/entities/canvas-matrix/CanvasMatrix.ts b/packages/ketcher-core/src/domain/entities/canvas-matrix/CanvasMatrix.ts index 6f8a439997..b38dfb2a58 100644 --- a/packages/ketcher-core/src/domain/entities/canvas-matrix/CanvasMatrix.ts +++ b/packages/ketcher-core/src/domain/entities/canvas-matrix/CanvasMatrix.ts @@ -42,12 +42,12 @@ export class CanvasMatrix { direction: number, increaseOffset = (connection: Connection, increaseValue?: number) => { if (isNumber(increaseValue)) { - connection.offset = increaseValue; + connection.xOffset = increaseValue; } else { - connection.offset++; + connection.xOffset++; } }, - getOffset = (connection: Connection) => connection.offset, + getOffset = (connection: Connection) => connection.xOffset, ) { // set offsets for connections with overlappings const currentConnections = new Map>(); @@ -133,8 +133,8 @@ export class CanvasMatrix { this.matrix.forEach((cell) => { const biggestOffsetInCell = cell.connections.reduce( (biggestOffset, connection) => { - return connection.offset > biggestOffset - ? connection.offset + return connection.xOffset > biggestOffset + ? connection.xOffset : biggestOffset; }, 0, @@ -144,12 +144,12 @@ export class CanvasMatrix { if (connection.direction !== direction) { return; } - if (connection.offset <= biggestOffsetInCell) { + if (connection.xOffset <= biggestOffsetInCell) { const polymerBondConnections = this.polymerBondToConnections.get( connection.polymerBond, ); polymerBondConnections?.forEach((polymerBondConnection) => { - polymerBondConnection.offset = biggestOffsetInCell; + polymerBondConnection.xOffset = biggestOffsetInCell; }); handledConnections.add(connection.polymerBond); } @@ -164,7 +164,7 @@ export class CanvasMatrix { return; } - polymerBondConnection.offset++; + polymerBondConnection.xOffset++; }); }); } @@ -286,7 +286,7 @@ export class CanvasMatrix { polymerBond, connectedNode, direction: isVertical ? 90 : xDirection, - offset: 0, + xOffset: 0, yOffset: 0, isVertical, }; @@ -309,7 +309,7 @@ export class CanvasMatrix { polymerBond, connectedNode: null, direction: xDirection, - offset: 0, + xOffset: 0, yOffset: 0, isVertical, }; @@ -331,7 +331,7 @@ export class CanvasMatrix { polymerBond, connectedNode: null, direction: yDirection, - offset: 0, + xOffset: 0, yOffset: 0, isVertical, }; @@ -356,7 +356,7 @@ export class CanvasMatrix { direction: isVertical ? yDirection : { x: xDistance === 0 ? 0 : xDirection, y: yDirection }, - offset: 0, + xOffset: 0, yOffset: 0, isVertical, }; diff --git a/packages/ketcher-core/src/domain/entities/canvas-matrix/Connection.ts b/packages/ketcher-core/src/domain/entities/canvas-matrix/Connection.ts index f810f4e90f..0562558e61 100644 --- a/packages/ketcher-core/src/domain/entities/canvas-matrix/Connection.ts +++ b/packages/ketcher-core/src/domain/entities/canvas-matrix/Connection.ts @@ -7,7 +7,7 @@ export class Connection { public readonly direction: 0 | 90 | 180 | 270 | { x: number; y: number }, public readonly isVertical: boolean, public readonly polymerBond: PolymerBond, - public offset: number, + public xOffset: number, public yOffset: number, ) {} }