Options
All
  • Public
  • Public/Protected
  • All
Menu

A shape is a basic geometric element. Describes methods for creating structural elements.

Hierarchy

Index

Constructors

constructor

  • new Shape(root: SVGGeometryElement): Shape
  • Constructs a shape element with the provided root.

    Parameters

    • root: SVGGeometryElement

    Returns Shape

Properties

classList

classList: DOMTokenList

Class attribute for the root element.

root

root: SVGGeometryElement

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

id

id:

Returns the unique generated identifier associated with this element.

Methods

addDependency

appendChild

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

circle

  • circle(cx: number, cy: number, r: number): Circle
  • Constructs and appends a circle within this element.

    Parameters

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

    Returns Circle

clear

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

    Returns void

contains

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

    Parameters

    Returns boolean

ellipse

  • ellipse(cx: number, cy: number, rx: number, ry: number): Ellipse
  • Constructs and appends an ellipse within this element.

    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

getPointAtLength

  • getPointAtLength(x: number): DOMPoint
  • Returns the location of the point on the path.

    Parameters

    • x: number

    Returns DOMPoint

getTotalLength

  • getTotalLength(): number
  • Returns the total length of this path.

    Returns number

isPointInFill

  • isPointInFill(point: DOMPoint): boolean
  • Returns true if the point is contained within this shapes fill

    Parameters

    • point: DOMPoint

    Returns boolean

isPointInStroke

  • isPointInStroke(point: DOMPoint): boolean
  • Returns true if the point is contained within this shapes stroke

    Parameters

    • point: DOMPoint

    Returns boolean

line

  • line(x1: number, y1: number, x2: number, y2: number): Line
  • Constructs and appends a line within this element.

    Parameters

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

    Returns Line

path

  • path(d: string): Path
  • Constructs and appends a path within this element.

    Parameters

    • d: string

    Returns Path

polygon

  • constructs and appends a polygon within this element

    Parameters

    • points: string

    Returns Polygon

prependChild

  • prependChild<T>(child: T): T
  • Inserts the element before the first child within this element.

    Type parameters

    Parameters

    • child: T

    Returns T

rectangle

  • rectangle(x: number, y: number, width: number, height: number): Rectangle
  • Constructs and appends a rectangle within this element

    Parameters

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

    Returns Rectangle

remove

  • remove(): void
  • Removes this element from the DOM and from the Element controller.

    Returns void

setAttribute

updateDependents

  • updateDependents(): void

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

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