Options
All
  • Public
  • Public/Protected
  • All
Menu

Main Grapher.ts class. Visualizes the graph. Acts as a container for root SVG element.

Hierarchy

  • Grapher

Implements

Index

Constructors

constructor

  • new Grapher(container: HTMLElement): Grapher
  • Entry point for Grapher.ts component. Initializes graph drawing area (root SVG element) and its controls.

    Parameters

    • container: HTMLElement

      HTMLElement to which component will be added a child.

    Returns Grapher

Properties

graph

graph: Graph

Underlying graph as defined in Domain package.

Protected handlers

Maps handlers to toolbar modes. Allows switching between operation modes without explicitly specifying each transition.

svgEdges

svgEdges: SvgEdge[]

Edges that are present in the graph that is rendered.

svgRoot

svgRoot: SVGSVGElement

Root SVG element to which all other graph SVG elements are appended.

svgVertices

svgVertices: SvgVertex[]

Vertices that are present in the graph that is rendered.

Private toolbar

toolbar: Toolbar

Methods

addEdge

  • Adds an edge to the graph.

    Parameters

    Returns void

addVertex

  • Creates a new vertex at specificed position.

    Parameters

    • pos: Point

      Position at which the new vertex will be added.

    Returns SvgVertex

    Newly added vertex.

getClickCoordinates

  • getClickCoordinates(event: InteractEvent): Point
  • Calculates coordinates at which click occured relevant to SVG root.

    Parameters

    • event: InteractEvent

      Raw click event.

    Returns Point

    Click coordinates relevant to SVG root.

getVertexAtPoint

  • Gets vertex given coordinates if one exists. If more than one vertex exist at the point, first one found will be returned (the one that was created earliest).

    Parameters

    • point: Point

      Coordinates to be used for vertex location.

    Returns SvgVertex | null

    Vertex if one exists at given coordinates, null otherwise.

onClearClick

  • onClearClick(): void

onModeSwitch

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc