Functions supported by Marvin.

interface Marvin {
    addTemplate(template): Promise<void>;
    applySettings(settings): Promise<void>;
    center(): void;
    clear(): void;
    clearHistory(): void;
    exportDocument(documentType): Promise<ExportResult>;
    exportImage(imageType, exportOptions?): Promise<ExportResult>;
    getSettings(): Promise<MarvinSettings>;
    importDocument(documentSource, importOptions?): Promise<void>;
    isEmpty(): boolean;
    off(eventType, eventHandler?): void;
    on(eventType, eventHandler, eventInit?): void;
    removeTemplate(template): void;
    removeUI(): void;
}

Methods

  • Add a new template to the template list on the left sidebar.

    Parameters

    • template: TemplateSettings

      the template definition including name, structure and icon

    Returns Promise<void>

    Throws

    error if a strucuture is invalid or does not contain any molecules or a template with the given name was already added before

  • Applies editor settings.

    Parameters

    Returns Promise<void>

  • Moves to drawing center if not emtpy.

    Returns void

  • Clears canvas.

    Returns void

  • Resets undo stack.

    Returns void

  • Exports the current content of the canvas as a document format.

    Parameters

    • documentType: DocumentType

      the document type in which to export, currently supported types: cxon.

    Returns Promise<ExportResult>

    The generated document as a string value.

  • Exports the current content of the canvas as an image.

    Parameters

    • imageType: ImageType

      currently supported image types: JPG, PNG, SVG, WEBP (WebP image format is partially supported on Safari).

    • Optional exportOptions: ExportOptions

      settings to be used for image export.

    Returns Promise<ExportResult>

    The generated image as a string value.

  • Imports document. Content is displayed on the previously cleared canvas.

    Parameters

    • documentSource: string

      the document content. Source format determined automatically.

    • Optional importOptions: ImportOptions

      to configure import if differ from default. Default values are { clearCanvas: true, select: false, throwError: true, placement: 'TOP_LEFT', scale: 'NONE' }

    Returns Promise<void>

    Throws

    error if document or its content is invalid

  • Determines whether the canvas is empty or not.

    Returns boolean

    true if nothing on the canvas, else false.

  • Deregister a previously registered event handler.

    Parameters

    • eventType: EventType

      the event type associated to the client event handler.

    • Optional eventHandler: EventHandler

      the event handler function.

    Returns void

  • Register event handler.

    Parameters

    Returns void

  • Remove a template from the template list on the left sidebar.

    Parameters

    • template: TemplateSettings

      the template definition including name, structure and icon

    Returns void

  • Removes Marvin from the dom.

    Returns void

Generated using TypeDoc