ketcher-core
Version:
Web-based molecule sketcher
131 lines (130 loc) • 6.77 kB
TypeScript
import { type ITwoStrandedChainItem, ChainsCollection } from "../../../../domain/entities/monomer-chains/ChainsCollection";
import { type BaseMonomer, Vec2 } from "../../../../domain/entities";
import type { IBaseRenderer } from "../BaseRenderer";
import type { Chain } from "../../../../domain/entities/monomer-chains/Chain";
import type { SubChainNode } from "../../../../domain/entities/monomer-chains/types";
import { RestoreSequenceCaretPositionOperation } from "../../../editor/operations/modes";
import { Command } from "../../../../domain/entities/Command";
import { SequenceViewModel } from "./SequenceViewModel/SequenceViewModel";
import type { SequenceViewModelChain } from "./SequenceViewModel/SequenceViewModelChain";
declare type BaseNodeSelection = {
nodeIndexOverall: number;
isNucleosideConnectedAndSelectedWithPhosphate?: boolean;
hasR1Connection?: boolean;
};
export declare type NodeSelection = BaseNodeSelection & {
node: SubChainNode;
twoStrandedNode?: ITwoStrandedChainItem;
};
export declare type TwoStrandedNodeSelection = BaseNodeSelection & {
node: ITwoStrandedChainItem;
};
export declare type TwoStrandedNodesSelection = TwoStrandedNodeSelection[][];
export declare type NodesSelection = NodeSelection[][];
export declare type SetCaretPositionOptions = {
afterRowEnd?: boolean;
};
export declare class SequenceRenderer {
private static caretPositionValue;
private static lastUserDefinedCaretPositionValue;
private static chainsCollectionValue;
private static lastChainStartPositionValue;
private static newSequenceButtons;
private static readonly sequenceBondRenderers;
static get caretPosition(): number;
private static set caretPosition(value);
static get lastUserDefinedCaretPosition(): number;
private static set lastUserDefinedCaretPosition(value);
static get chainsCollection(): ChainsCollection;
private static set chainsCollection(value);
static get lastChainStartPosition(): Vec2;
private static set lastChainStartPosition(value);
static get sequenceViewModel(): SequenceViewModel;
private static set sequenceViewModel(value);
static show(chainsCollection: ChainsCollection, chainBeforeNewEmptyChainIndex?: number): void;
private static setCaretToLastNodeInChain;
static removeNewSequenceButtons(): void;
private static addNewEmptyChainIfNeeded;
private static showNodes;
static getNextChainPosition(currentChainStartPosition?: Vec2, previousChainLength?: number): Vec2;
private static showBonds;
private static showBondRenderer;
private static isCaretAfterRowEndValue;
static get isCaretAfterRowEnd(): boolean;
private static set isCaretAfterRowEnd(value);
static setCaretPosition(caretPosition: number, options?: SetCaretPositionOptions): void;
static rerenderCaret(): void;
static forEachNode(forEachCallback: (params: {
chainIndex: number;
chain: SequenceViewModelChain;
nodeIndex: number;
nodeIndexOverall: number;
twoStrandedNode: ITwoStrandedChainItem;
}) => void): void;
static setCaretPositionBySequenceItemRenderer(sequenceItemRenderer: IBaseRenderer): void;
static setCaretPositionByMonomer(monomer: BaseMonomer): void;
static setCaretPositionNextToMonomer(monomer: BaseMonomer): void;
static setCaretPositionByNode(nodeToCompare: ITwoStrandedChainItem): void;
static getMonomersByCaretPositionRange(startCaretPosition: number, endCaretPosition: any): BaseMonomer[];
static resetLastUserDefinedCaretPosition(): void;
private static get nodesGroupedByRows();
private static getNodeIndexInRowByGlobalIndex;
private static get currentChainRow();
private static get previousRowOfNodes();
private static get nextRowOfNodes();
static moveCaretUp(): void;
static moveCaretDown(): void;
static moveCaretForward(): RestoreSequenceCaretPositionOperation;
static moveCaretBack(): RestoreSequenceCaretPositionOperation;
private static redrawCaretOnRenderer;
private static redrawCaretOnBothStrands;
static get isCurrentCaretAtLastInFullRow(): boolean;
static moveCaretForwardOrToRowEnd(): void;
static moveCaretBackOrFromRowEnd(): void;
static moveCaretToRowStart(): void;
static moveCaretToRowEnd(): void;
static get currentChainIndex(): number;
static get lastNodeCaretPosition(): number | undefined;
static getNodeByPointer(sequencePointer?: number): ITwoStrandedChainItem | undefined;
static get currentEdittingNode(): ITwoStrandedChainItem | undefined;
static get previousFromCurrentEdittingMonomer(): ITwoStrandedChainItem | undefined;
static get currentChain(): Chain;
static get previousChain(): SequenceViewModelChain;
static get nextChain(): Chain;
static getLastNonEmptyNode(chain: Chain): SubChainNode;
static getLastNode(chain: Chain): SubChainNode;
static get nextNode(): ITwoStrandedChainItem | undefined;
static get previousNode(): ITwoStrandedChainItem | undefined;
static get nextNodeInSameChain(): ITwoStrandedChainItem | undefined;
static get previousNodeInSameChain(): ITwoStrandedChainItem | undefined;
private static get nextCaretPosition();
static get previousCaretPosition(): number | undefined;
static get lastChain(): Chain;
static get lastChainLength(): number;
static startNewSequence(indexOfRowBefore?: number): void;
static getPreviousNodeInSameChain(nodeToCompare: ITwoStrandedChainItem): ITwoStrandedChainItem | undefined;
static getNextNodeInSameChain(nodeToCompare: ITwoStrandedChainItem): ITwoStrandedChainItem | undefined;
static getPreviousNode(nodeToCompare: ITwoStrandedChainItem): ITwoStrandedChainItem | undefined;
static getNextNode(nodeToCompare: ITwoStrandedChainItem): ITwoStrandedChainItem | undefined;
static shiftArrowSelectionInEditMode(event: any): void;
private static getShiftArrowChanges;
static unselectEmptyAndBackboneSequenceNodes(): Command;
static get selections(): TwoStrandedNodesSelection;
static getRenderedStructuresBbox(): {
left: any;
right: any;
top: any;
bottom: any;
width: number;
height: number;
};
static getRendererByMonomer(monomer: BaseMonomer): any;
static showNewSequenceButton(indexOfRowBefore: number, width?: number): void;
static isEmptyCanvas(): boolean;
static get isCaretAtChainEnd(): boolean;
private static clearBondRenderers;
static clear(): void;
private static attachDelegatedEvents;
private static removeDelegatedEvents;
}
export {};