diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 660628d..8337885 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -9,3 +9,9 @@ export const representationMapper = { inchiKey: 'InChIKey', molecularFormula: 'MolecularFormula' } as const; + +export const moleculeToSVGOptions = { + suppressChiralText: true, + suppressCIPParity: true, + suppressESR: true +}; diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 7f070dc..b3402f8 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -6,9 +6,10 @@ import { representationTypes, type RepresentationType, representationMapper, - basePath + basePath, + moleculeToSVGOptions } from './constants'; -import { Molecule as MoleculeService } from 'openchemlib/minimal'; +import { Molecule as MoleculeService, type IMoleculeToSVGOptions } from 'openchemlib/minimal'; export type Molecule = Record; export type MoleculeStorage = Molecule[]; @@ -61,8 +62,13 @@ export function getUrlFromId(id: number) { return `${basePath}/cid/${id}/property/${representations},Complexity/JSON`; } -export function getSVGFromSmiles(smiles: string, width = 250, height = 128) { - return MoleculeService.fromSmiles(smiles).toSVG(width, height); +export function getSVGFromSmiles( + smiles: string, + width = 250, + height = 128, + options: IMoleculeToSVGOptions = moleculeToSVGOptions +) { + return MoleculeService.fromSmiles(smiles).toSVG(width, height, undefined, options); } export async function copyToClipboard(molecule: Molecule, representation: RepresentationType) {