Class SvgHelper

Utility class to simplify SVG operations.

Hierarchy

  • SvgHelper

Constructors

Methods

  • Returns local coordinates relative to the provided localRoot of a client (screen) point.

    Parameters

    • localRoot: undefined | SVGElement

      relative coordinate root

    • x: number

      horizontal client coordinate

    • y: number

      vertical client coordinate

    • zoomLevel: number = 1

      zoom level

    Returns IPoint

    local coordinates relative to localRoot

  • Creates an SVG circle with the specified radius.

    Parameters

    • radius: number
    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGCircleElement

  • Creates SVG "defs".

    Returns SVGDefsElement

  • Creates an SVG ellipse with the specified horizontal and vertical radii.

    Parameters

    • rx: number
    • ry: number
    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGEllipseElement

  • Creaes an SVG text element.

    Parameters

    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGForeignObjectElement

  • Creates an SVG group.

    Parameters

    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGGElement

  • Creates an SVG image element.

    Parameters

    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGImageElement

  • Creates an SVG line with specified end-point coordinates.

    Parameters

    • x1: string | number
    • y1: string | number
    • x2: string | number
    • y2: string | number
    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGLineElement

  • Creates an SVG marker.

    Parameters

    • id: string
    • orient: string
    • markerWidth: string | number
    • markerHeight: string | number
    • refX: string | number
    • refY: string | number
    • markerElement: SVGGraphicsElement

    Returns SVGMarkerElement

  • Creates an SVG path with the specified shape (d).

    Parameters

    • d: string

      path shape

    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGPathElement

  • Creates an SVG point with the specified coordinates.

    Parameters

    • x: number
    • y: number

    Returns DOMPoint

  • Creates an SVG polygon with specified points.

    Parameters

    • points: string

      points as string.

    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGPolygonElement

  • Creates an SVG rectangle with the specified width and height.

    Parameters

    • width: string | number
    • height: string | number
    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGRectElement

  • Creates an SVG image element from a supplied inner SVG markup string.

    Parameters

    • stringSvg: string

      SVG markup (without the root svg tags)

    Returns SVGSVGElement

    SVG image element

  • Creates an SVG TSpan.

    Parameters

    • text: string

      inner text.

    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGTSpanElement

  • Creaes an SVG text element.

    Parameters

    • Optional attributes: [string, string][]

      additional attributes.

    Returns SVGTextElement

  • Creates an SVG transform.

    Returns SVGTransform

  • Sets attributes on an arbitrary SVG element

    Parameters

    • el: SVGElement

      target SVG element.

    • attributes: [string, string][]

      set of name-value attribute pairs.

    Returns void

Generated using TypeDoc