Options
All
  • Public
  • Public/Protected
  • All
Menu

A rectangle is a basic element with a position, width, and height. The position refers to the top left corner of the rectangle

Hierarchy

Index

Constructors

constructor

  • new Rectangle(x: number, y: number, width: number, height: number): Rectangle
  • Constructs a rectangle element at the position (x,y)

    Parameters

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

    Returns Rectangle

Properties

classList

classList: DOMTokenList

Class attribute for the root element.

root

root: SVGRectElement

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

fill

fill:

Returns the fill style of this rectangle Sets the fill style of this rectangle

height

height:

Returns the height of the rectangle Sets the height of the rectangle

id

id:

Returns the unique generated identifier associated with this element.

stroke

stroke:

Returns the stroke style of this rectangle Sets the stroke style of this rectangle

width

width:

Returns the width of the rectangle Sets the width of the rectangle

x

x:

Returns the x position of the rectangle Sets the x position of the rectangle

y

y:

Returns the y position of the rectangle Sets the y position of the rectangle

Methods

addDependency

  • Declares this element dependent on the provided element(s).

    Parameters

    Returns void

appendChild

  • appendChild<T>(child: T): T
  • Appends the element as a child within this element.

    Type parameters

    Parameters

    • child: T

    Returns T

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

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

prependChild

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

    Type parameters

    Parameters

    • child: T

    Returns T

remove

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

    Returns void

setAttribute

translate

  • translate(x: number, y: number): void
  • Parameters

    • x: number
    • y: number

    Returns void

updateDependents

  • updateDependents(): void
  • Updates all of the elements that depend on this element.

    Returns 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