Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Controller

This class abstracts connecting the structure to the webpage. It connects the given structure to the slider and has methods for adding buttons, text inputs, etc.

Hierarchy

  • Controller

Index

Constructors

constructor

  • Parameters

    • struct: StructureViz

      the structure that will be linked to the slider of the page.

    Returns Controller

Properties

interval

interval: Timer

structure

structure: StructureViz

Methods

addButton

  • addButton(text: string, onclick: Function, tooltip?: string, dontDisable?: boolean, forAnimation?: boolean): void
  • Adds a button to the page.

    Parameters

    • text: string

      the text of the button.

    • onclick: Function

      function to execute when button is clicked.

    • Optional tooltip: string

      text displayed when button is hovered over.

    • Optional dontDisable: boolean

      if set to true then the button will not be disabled when in the middle of the timeline set to true for buttons that do not affect the state of the structure

    • forAnimation: boolean = false

      Adds a green btn color if true.

    Returns void

pause

  • pause(): void
  • Stops animations from occurring.

    Returns void

play

  • play(ms: number): void
  • Starts the animations going along the timeline. With a new transition occurring every ms milliseconds.

    Parameters

    • ms: number

    Returns void

playPause

  • playPause(): void
  • Toggles the play pause state.

    Returns void

pushAndTransition

  • pushAndTransition(): void
  • A helper function that saves the state of the structure and then transitions to the newest state. Equivalent to this.structure.pushState(); this.updateSliderAndTransition();.

    Returns void

updateSlider

  • updateSlider(): void
  • Updates the slider to match the number of states in the timeline of the structure.

    Returns void

updateSliderAndTransition

  • updateSliderAndTransition(): void
  • Makes the slider match the number of states of the structure and applies the last state.

    Returns void

Static addTextInput

  • addTextInput(placeholderText: string, width: number, id: string): void
  • Adds a text input button to the page with placeholder text and a width specified in rem. id becomes the DOM id of the element. See graphTraversal.ts for an example of it's usage.

    Parameters

    • placeholderText: string
    • width: number
    • id: string

    Returns void

Static addVisualizationInfo

  • addVisualizationInfo(markdown: string): void
  • Adds markdown to the Visualization info modal

    Parameters

    • markdown: string

      a multiline markdown formatted string.

    Returns void

Static getFullDimensions

  • getFullDimensions(): number[]
  • Returns the current size of the main svg element of the page in the form [width, height] where both width and height are in pixels. Best used for placing structures

    Returns number[]

Generated using TypeDoc