UNPKG

ketcher-core

Version:
90 lines (89 loc) 3.9 kB
/**************************************************************************** * Copyright 2021 EPAM Systems * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ import { Struct } from "../../domain/entities/struct"; import { Vec2 } from "../../domain/entities/vec2"; import type { RaphaelPaper } from 'raphael'; import ReStruct from './restruct/restruct'; import type { RenderOptions, ViewBox } from './render.types'; import type { AttachmentPointName } from "../../domain/types"; import type { KetMonomerClass } from "../formatters/types/ket"; import type { RnaPresetComponentKey } from "../editor/shared/customEvents"; export declare type MonomerCreationInitialValues = { type: KetMonomerClass; symbol: string; name: string; naturalAnalogue: string; aliasHELM: string; aliasBILN: string; }; export declare type RnaComponentAtoms = Map<RnaPresetComponentKey, { atoms: number[]; bonds: number[]; }>; export declare type MonomerCreationState = { assignedAttachmentPoints: Map<AttachmentPointName, [number, number]>; visibleAssignedAttachmentPoints?: Map<AttachmentPointName, [number, number]>; potentialAttachmentPoints: Map<number, Set<number>>; problematicAttachmentPoints: Set<AttachmentPointName>; problematicAtoms?: Set<number>; clickedAttachmentPoint?: AttachmentPointName | null; selectedMonomerClass?: KetMonomerClass | 'rnaPreset'; hasDefaultAttachmentPoints?: boolean; rnaComponentAtoms?: RnaComponentAtoms; isRnaPresetMode?: boolean; connectionAttachmentPoints?: Map<AttachmentPointName, [number, number]>; editInstanceInitialValues?: MonomerCreationInitialValues; } | null; export declare class Render { skipRaphaelInitialization: boolean; readonly clientArea: HTMLElement; readonly paper: RaphaelPaper; sz: Vec2; ctab: ReStruct; options: RenderOptions; viewBox: ViewBox; private readonly userOpts; private oldCb; private scrollbar; private resizeObserver; private _monomerCreationState; constructor(clientArea: HTMLElement, options: RenderOptions, currentRender?: Render, reuseRestructIfExist?: boolean); observeCanvasResize: () => void; unobserveCanvasResize: () => void; updateOptions(opts: string): false | RenderOptions; selectionPolygon(polygon: Vec2[]): any; selectionLine(point0: Vec2, point1: Vec2): any; selectionRectangle(point0: Vec2, point1: Vec2): any; /** @deprecated recommend using `CoordinateTransformation.pageToModel` instead */ page2obj(event: MouseEvent | { clientX: number; clientY: number; }): Vec2; setZoom(zoom: number, event?: WheelEvent): void; private getCanvasSizeVector; resizeViewBox(): void; private zoomOnCanvasCenter; private zoomOnMouse; /** * @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/viewBox */ setViewBox(func: (viewBox: ViewBox) => ViewBox): void; setViewBox(viewBox: ViewBox): void; setMolecule(struct: Struct, forceUpdateWithTimeout?: boolean): void; update(force?: boolean, viewSz?: Vec2 | null): void; get monomerCreationState(): MonomerCreationState; set monomerCreationState(state: MonomerCreationState); }