Class SVGRenderer

Renders onto an SVGElement.

Hierarchy (View Summary)

Constructors

Properties

objectLevel: number = 0

Methods

  • Notes the end of an object.

    Parameters

    • OptionalloaderData: LoadSaveDataTable

      a map from strings to JSON-ifyable objects and contains properties attached to the object by whatever loader loaded the image. This is used to preserve attributes not supported by js-draw when loading/saving an image. Renderers may ignore this.

    • OptionalelemClassNames: string[]

      a list of labels (e.g. classNames) to be attached to the object. Renderers may ignore this.

    Returns void

  • Sets an attribute on the root SVG element.

    Parameters

    • name: string
    • value: null | string

    Returns void

  • Creates a new SVG element and SVGRenerer with width, height, viewBox, and other metadata attributes set for the given Viewport.

    If options is a boolean, it is interpreted as whether to sanitize (not add unknown SVG entities to) the output.

    Parameters

    • viewport: Viewport
    • options: boolean | FromViewportOptions = true

    Returns { element: SVGSVGElement; renderer: SVGRenderer }

OpenSource licenses