Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

Index

Constructors

constructor

  • Constructs a control at the position (x,y)

    Parameters

    • x: number
    • y: number

    Returns ControlCircle

Properties

classList

classList: DOMTokenList

Class attribute for the root element.

handle

handle: Circle

point

point: Circle

root

root: SVGGElement

style

style: CSSStyleDeclaration

Style for the root element.

update

update: function

The update function describes how this element should update itself

Type declaration

    • (): void
    • Returns void

Static controller

controller: Controller = new Controller()

The controller manages the dependencies between elements. Every element is added to this controller upon creation.

Static count

count: number = 0

This number uniquely identifes elements

Static disable

disable: boolean = false

Allows for the events attatched to elements to be disabled.

Accessors

dx

dx:

Gets the change in x position of this control.

dy

dy:

Gets the change in y position of this control.

id

id:

Returns the unique generated identifier associated with this element.

onchange

onchange:

This function is called whenever the state of an input element changes. The default behavior of this function is to update the dependents of this element. WARNING: changing this function can have unintented side effects.

x

x:

Updates the x position of the control. Gets the x position of the control.

y

y:

Updates the y position of the control. Gets the y position of the control.

Methods

a

  • a(href: string): A
  • Constructs and appends an 'a' (link) within this element.

    Parameters

    • href: string

    Returns A

addDependency

appendChild

  • appendChild<T>(child: T): T

circle

  • circle(cx: number, cy: number, r: number): Circle
  • Parameters

    • cx: number
    • cy: number
    • r: number

    Returns Circle

clear

  • clear(): void
  • Removes all child elements from this element.

    Returns void

clipPath

  • Constructs and appends a clipPath within this element

    Returns ClipPath

constrain

  • constrain(_oldPosition: Point, newPosition: Point): Point
  • Modifying the transform function allows for the control to be constrained to a path or constrained to the region enclosed in a path.

    Parameters

    • _oldPosition: Point
    • newPosition: Point

    Returns Point

constrainTo

  • Constrains the movement of this control point to the path of the provided element.

    Parameters

    Returns void

constrainToCircle

  • constrainToCircle(cx: number, cy: number, r: number): void
  • Constrains the control to follow the path of the circle specified by the arguments. TODO: add a method to constrain the control to a path

    Parameters

    • cx: number
    • cy: number
    • r: number

    Returns void

constrainToX

  • constrainToX(minX?: number, maxX?: number): void
  • Constrain this control to only move left and right along its current x position.

    Parameters

    • Default value minX: number = -Infinity
    • Default value maxX: number = Infinity

    Returns void

constrainToY

  • constrainToY(): void
  • Constrain this control to only move up and down along its current y position.

    Returns void

constrainWithin

  • Constrains the movement of this control point to the path of the provided element.

    Parameters

    Returns void

constrainWithinBox

  • constrainWithinBox(x1: number, y1: number, x2: number, y2: number): void
  • Constrains the control to the box defined by the points (x1, y1) and (x2, y2). The first point defines the top-left corner of the box, the second the bottom-right corner of the box.

    Parameters

    • x1: number
    • y1: number
    • x2: number
    • y2: number

    Returns void

constrainWithinRange

  • constrainWithinRange(minX: number, maxX: number): void
  • Parameters

    • minX: number
    • maxX: number

    Returns void

contains

  • contains(element: Element): boolean
  • Returns true if this element contains the argument element.

    Parameters

    Returns boolean

defs

  • defs(): Defs

description

ellipse

  • ellipse(cx: number, cy: number, rx: number, ry: number): Ellipse
  • Parameters

    • cx: number
    • cy: number
    • rx: number
    • ry: number

    Returns Ellipse

getAttribute

getBoundingBox

  • getBoundingBox(): SVGRect
  • Returns the bounding box of this element. Note, this is different from the getBoundingClientRect method since the bounding box is affected by the current viewPort.

    If this element's root is not a SVGGraphics element as is the case for the marker, title, and more element, then null is returned instead of a DOMRect.

    Returns SVGRect

group

handleMouseDown

  • handleMouseDown(event: MouseEvent): void
  • Handle when a user mouses down over a Control's handle. Stores the error in the user's click as well as stores which Control the user is clicking.

    Parameters

    • event: MouseEvent

    Returns void

handleMouseOut

  • handleMouseOut(event: MouseEvent): void
  • When a user mouses out of a control handle and when there is no active control, remove the "highlight" class from the event target.

    Parameters

    • event: MouseEvent

    Returns void

handleTouchStart

  • handleTouchStart(event: TouchEvent): void
  • Handle when a user touches over a Control's handle. Stores the error in the user's input as well as stores which Control the user is clicking.

    Parameters

    • event: TouchEvent

    Returns void

line

  • line(x1: number, y1: number, x2: number, y2: number): Line
  • Parameters

    • x1: number
    • y1: number
    • x2: number
    • y2: number

    Returns Line

metadata

path

  • path(d: string): Path
  • Parameters

    • d: string

    Returns Path

polygon

  • Parameters

    • points: string

    Returns Polygon

prependChild

  • prependChild<T>(child: T): T

rectangle

  • rectangle(x: number, y: number, width: number, height: number): Rectangle
  • Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns Rectangle

remove

  • remove(): void

setAttribute

svg

  • svg(x: number, y: number, width: number, height: number): SVG
  • Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns SVG

symbol

text

  • text(x: number, y: number, str: string): Text
  • Constructs and appends a text element within this element.

    Parameters

    • x: number
    • y: number
    • str: string

    Returns Text

title

translate

  • translate(x: number, y: number): void
  • Moves the control to a new location

    Parameters

    • x: number
    • y: number

    Returns void

updateDependents

  • updateDependents(): void

use

  • use(x: number, y: number, width: number, height: number): Use
  • Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns Use

Static clear

  • clear(disable?: boolean): void
  • Clears the static data structures holding elements and resets the count.

    Parameters

    • Default value disable: boolean = false

    Returns void

Static handleInputEnd

  • handleInputEnd(event: TouchEvent | MouseEvent): void
  • Handles when a use mouses up over the window or ends their touch event.

    Parameters

    • event: TouchEvent | MouseEvent

    Returns void

Static handleMouseMove

  • handleMouseMove(event: MouseEvent): void
  • Handles when the user moves their mouse over the window. If there is an active control, the control's position is updated.

    Parameters

    • event: MouseEvent

    Returns void

Static handleMouseOver

  • handleMouseOver(event: MouseEvent): void
  • When a user mouses over a control, add the class "highlight" to the control handle.

    Parameters

    • event: MouseEvent

    Returns void

Static handleMoveTo

  • handleMoveTo(clientX: number, clientY: number): void
  • Moves the active control to the new (x,y) position.

    Parameters

    • clientX: number
    • clientY: number

    Returns void

Static handleTouchMove

  • handleTouchMove(event: TouchEvent): void
  • Handles a touch move event. If there is an active control, the control's position is updated.

    Parameters

    • event: TouchEvent

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • 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