Class: RectangleElement

RectangleElement

new RectangleElement(elementUseopt)

todoc
Parameters:
Name Type Attributes Description
elementUse Object <optional>
Source:

Extends

Members

allowDrop :Boolean

If the element allows drop on it
Inherited From:
Type:
  • Boolean
Default Value:
  • false
Source:
To Do:
  • Implement allowDrop

angle :Number

The clockwise rotation of the entry
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:

background :String

The background of the element
Inherited From:
Type:
  • String
Default Value:
  • ''
Source:

border :String

The border of the element
Inherited From:
Type:
  • String
Source:

borderBottom :String

The bottom border of the element
Inherited From:
Type:
  • String
Source:

borderBottomColor :String

The bottom border color of the element
Inherited From:
Type:
  • String
Default Value:
  • 'none'
Source:

borderBottomStyle :String

The bottom border style of the element
Inherited From:
Type:
  • String
Default Value:
  • 'none'
Source:

borderBottomWidth :String|Number

The bottom border width of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

borderColor :String

The color of the element's border
Inherited From:
Type:
  • String
Source:

borderLeft :String

The left border of the element
Inherited From:
Type:
  • String
Source:

borderLeftColor :String

The left border color of the element
Inherited From:
Type:
  • String
Default Value:
  • 'none'
Source:

borderLeftStyle :String

The left border style of the element
Inherited From:
Type:
  • String
Default Value:
  • 'none'
Source:

borderLeftWidth :String|Number

The left border width of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

borderRight :String

The right border of the element
Inherited From:
Type:
  • String
Source:

borderRightColor :String

The right border color of the element
Inherited From:
Type:
  • String
Default Value:
  • 'none'
Source:

borderRightStyle :String

The right border style of the element
Inherited From:
Type:
  • String
Default Value:
  • 'none'
Source:

borderRightWidth :String|Number

The right border width of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

borderStyle :String

The style of the element's border
Inherited From:
Type:
  • String
Source:

borderTop :String

The top border of the element
Inherited From:
Type:
  • String
Source:

borderTopColor :String

The top border color of the element
Inherited From:
Type:
  • String
Default Value:
  • 'none'
Source:

borderTopStyle :String

The top border style of the element
Inherited From:
Type:
  • String
Default Value:
  • 'none'
Source:

borderTopWidth :String|Number

The top border width of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

borderWidth :String

The width of the element's border
Inherited From:
Type:
  • String
Source:

(readonly) bottom :Number

The bottom position of the element on the screen, including margin
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:

(readonly) className :String

The classes of the element
Inherited From:
Type:
  • String
Source:

cursor :String

The cursor type of the element
Inherited From:
Type:
  • String
Default Value:
  • 'default'
Source:
To Do:
  • Implement cursor

draggable :Boolean

Allows the element to be moved using the mouse
Inherited From:
Type:
  • Boolean
Default Value:
  • false
Source:

dragState :Boolean

The dragging status of the element
Inherited From:
Type:
  • Boolean
Default Value:
  • false
Source:
To Do:
  • Implement dragState

(readonly) elementName :String

The name of the element
Overrides:
Type:
  • String
Default Value:
  • 'Rectangle'
Source:

(readonly) elementType :String

The type of the element
Overrides:
Type:
  • String
Default Value:
  • 'RectangleElement'
Source:

fill :String

The fill color of the polygon
Inherited From:
Type:
  • String
Default Value:
  • ''
Source:

flipX :Boolean

If the element should be mirrored horizontally
Inherited From:
Type:
  • Boolean
Default Value:
  • false
Source:

flipY :Boolean

If the element should be mirrored vertically
Inherited From:
Type:
  • Boolean
Default Value:
  • false
Source:

flow :'none'|'horizontal'|'vertical'

The flow of the element
Inherited From:
Type:
  • 'none' | 'horizontal' | 'vertical'
Default Value:
  • 'none'
Source:

height :Number|String

The height of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 0
Source:

horizontalAlign :'left'|'center'|'right'

The horizontal align of the element
Inherited From:
Type:
  • 'left' | 'center' | 'right'
Default Value:
  • 'left'
Source:

(readonly) id :String

The id of the element
Inherited From:
Type:
  • String
Default Value:
  • null
Source:

isBlock :Boolean

If the element allows mouse events through transparent pixel
Inherited From:
Type:
  • Boolean
Default Value:
  • true
Source:
To Do:
  • Implement isBlock

(readonly) left :Number

The left position of the element on the screen, including margin
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:

margin :String

The margin of the element
Inherited From:
Type:
  • String
Source:

marginBottom :String|Number

The bottom margin of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

marginLeft :String|Number

The left margin of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

marginRight :String|Number

The right margin of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

marginTop :String|Number

The top margin of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

mask :String

The mask id of the element
Inherited From:
Type:
  • String
Default Value:
  • ''
Source:

maxHeight :Number|String

The maximum height of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 'none'
Source:

maxWidth :Number|String

The maximum width of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 'none'
Source:

maxX :Number|String

The maximum x position of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 'none'
Source:

maxY :Number|String

The maximum y position of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 'none'
Source:

minHeight :Number|String

The minimum height of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 'none'
Source:

minWidth :Number|String

The minimum width of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 'none'
Source:

minX :Number|String

The minimum x position of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 'none'
Source:

minY :Number|String

The minimum y position of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 'none'
Source:

offsetX :Number|String

The horizontal offset of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 0
Source:

offsetY :Number|String

The vertical offset of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 0
Source:

onFocus :Boolean

The focus status of the element
Inherited From:
Type:
  • Boolean
Default Value:
  • false
Source:
To Do:
  • Implement onFocus

opacity :Number

The transparency of the element
Inherited From:
Type:
  • Number
Default Value:
  • 1
Source:
To Do:
  • Implement opacity

padding :String

The padding of the element
Inherited From:
Type:
  • String
Source:

paddingBottom :String|Number

The bottom padding of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

paddingLeft :String|Number

The left padding of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

paddingRight :String|Number

The right padding of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

paddingTop :String|Number

The top padding of the element
Inherited From:
Type:
  • String | Number
Default Value:
  • 0
Source:

(readonly) parentElement :ContainerElement

The parentElement of the element
Inherited From:
Type:
Default Value:
  • null
Source:

(readonly) parentLayer :Layer

The parentLayer of the element
Inherited From:
Type:
Default Value:
  • null
Source:

(readonly) parentX :Number

The x position of the element, relative to it's parent
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:

(readonly) parentXC :Number

The horizontal center position of the element, relative to it's parent
Inherited From:
Type:
  • Number
Source:

(readonly) parentXE :Number

The horizontal end position of the element, relative to it's parent
Inherited From:
Type:
  • Number
Source:

(readonly) parentY :Number

The y position of the element, relative to it's parent
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:

(readonly) parentYC :Number

The vertical center position of the element, relative to it's parent
Inherited From:
Type:
  • Number
Source:

(readonly) parentYE :Number

The vertical end position of the element, relative to it's parent
Inherited From:
Type:
  • Number
Source:

(readonly) renderHeight :Number

The layout height of the element
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:

(readonly) renderWidth :Number

The layout width of the element
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:
The right position of the element on the screen, including margin
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:

scaleX :Number

The width ratio of the element
Inherited From:
Type:
  • Number
Default Value:
  • 1
Source:

scaleY :Number

The height ratio of the element
Inherited From:
Type:
  • Number
Default Value:
  • 1
Source:

(readonly) screenX :Number

The x position of the element, relative to the scene
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:

(readonly) screenXC :Number

The horizontal center position of the element, relative to the scene
Inherited From:
Type:
  • Number
Source:

(readonly) screenXE :Number

The horizontal end position of the element, relative to the scene
Inherited From:
Type:
  • Number
Source:

(readonly) screenY :Number

The y position of the element, relative to the scene
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:

(readonly) screenYC :Number

The vertical center position of the element, relative to the scene
Inherited From:
Type:
  • Number
Source:

(readonly) screenYE :Number

The vertical end position of the element, relative to the scene
Inherited From:
Type:
  • Number
Source:

strokeColor :String

The stroke color of the polygon
Inherited From:
Type:
  • String
Default Value:
  • '#000000'
Source:

strokeWidth :Number

The stroke width of the polygon
Inherited From:
Type:
  • Number
Default Value:
  • 1
Source:

title :String

The title of the element
Inherited From:
Type:
  • String
Default Value:
  • ''
Source:
To Do:
  • Implement title

(readonly) top :Number

The top position of the element on the screen, including margin
Inherited From:
Type:
  • Number
Default Value:
  • 0
Source:

(readonly) uuid :String

The uuid of the element
Inherited From:
Type:
  • String
Default Value:
  • null
Source:

verticalAlign :'top'|'middle'|'bottom'

The vertical align of the element
Inherited From:
Type:
  • 'top' | 'middle' | 'bottom'
Default Value:
  • 'top'
Source:

vertices :Array

The vertices of the element
Inherited From:
Type:
  • Array
Default Value:
  • null
Source:

vX :Number

The horizontal velocity of the element
Inherited From:
Type:
  • Number
Source:

vY :Number

The vertical velocity of the element
Inherited From:
Type:
  • Number
Source:

width :Number|String

The width of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 0
Source:

wrap :Boolean

The wrap of the element
Inherited From:
Type:
  • Boolean
Default Value:
  • true
Source:

x :Number|String

The x position of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 0
Source:

y :Number|String

The y position of the element
Inherited From:
Type:
  • Number | String
Default Value:
  • 0
Source:

Methods

addClass(item, orderIDopt) → {Element}

Adds a class to the element's classList
Parameters:
Name Type Attributes Description
item String
orderID int <optional>
Inherited From:
Source:
See:
Returns:
Element
this

addEventListener(type, listener) → {EventTarget}

Adds a listener to the specified event
Parameters:
Name Type Description
type String
listener function
Inherited From:
Source:
Returns:
EventTarget
this

addProp(propertyKey, primitiveValue, inheritableopt) → {Element}

Adds a property to the Element
Parameters:
Name Type Attributes Description
propertyKey String
primitiveValue *
inheritable Boolean <optional>
Inherited From:
Source:
To Do:
  • Need to rewrite the property handler methods
Returns:
Element
this

addPropSafe(propertyKey, primitiveValue, inheritableopt) → {Element}

Adds a property to the Element if it doesn't has it already
Parameters:
Name Type Attributes Description
propertyKey String
primitiveValue *
inheritable Boolean <optional>
Inherited From:
Source:
Returns:
Element
this

animate(animData, duration, delayopt) → (nullable) {Task}

If the element is in a scene, adds an animation task to the scene's queue
Parameters:
Name Type Attributes Description
animData Object
duration int
delay int <optional>
Inherited From:
Source:
Returns:
Task

animation(animData, duration, delayopt) → {Task}

Creates an animation task
Parameters:
Name Type Attributes Description
animData Object
duration int
delay int <optional>
Inherited From:
Source:
To Do:
  • Handle colors and non-numeric values
Returns:
Task

applyMask(ctx) → {Element}

Applies a mask to the rendering context
Parameters:
Name Type Description
ctx CanvasRenderingContext2D
Inherited From:
Source:
Returns:
Element
this

applyTransform(ctx) → {Element}

Applies transformation to the rendering context
Parameters:
Name Type Description
ctx CanvasRenderingContext2D
Inherited From:
Source:
Returns:
Element
this

clone() → {Element}

Returns a clone of the element
Inherited From:
Source:
Returns:
Element

dispatchEvent(type) → {EventTarget}

Dispatches an Event at the specified EventTarget
Parameters:
Name Type Description
type String
Inherited From:
Source:
Returns:
EventTarget
this

draw(ctx) → {PolygonElement}

Draws the element to the given context
Parameters:
Name Type Description
ctx CanvasRenderingContext2D
Inherited From:
Source:
Returns:
PolygonElement
this

drawBox(ctx) → {Element}

Draws background and border if necessary
Parameters:
Name Type Description
ctx CanvasRenderingContext2D
Inherited From:
Source:
To Do:
  • Implement lineDash
Returns:
Element
this

eachEventListener(type, callback) → {EventTarget}

Executes a provided function once per event listener
Parameters:
Name Type Description
type String
callback function
Inherited From:
Source:
Returns:
EventTarget
this

edit(source) → {Element}

Edits the element
Parameters:
Name Type Description
source Object
Inherited From:
Source:
Returns:
Element
this

emit(type) → {EventTarget}

Dispatches an Event at the specified EventTarget
Parameters:
Name Type Description
type String
Inherited From:
Source:
See:
Returns:
EventTarget
this

getProp(propertyKey) → (nullable) {ElementProperty}

Returns an ElementProperty of the Element by key
Parameters:
Name Type Description
propertyKey String
Inherited From:
Source:
Returns:
ElementProperty

getProps(filteropt) → {Array}

Returns all ElementProperty from the Element (reduced by the given filter)
Parameters:
Name Type Attributes Description
filter function <optional>
Inherited From:
Source:
Returns:
Array

getScene() → (nullable) {Scene}

Returns the element's scene or null
Inherited From:
Source:
To Do:
  • (?)Check Layer contains Element and Scene contains Layer
Returns:
Scene

hasEventListener(type) → {Boolean}

Determines if the eventTarget has eventListeners of the given type
Parameters:
Name Type Description
type String
Inherited From:
Source:
Returns:
Boolean

hasProp(propertyKey) → {Boolean}

Checks if the Element has a specific property
Parameters:
Name Type Description
propertyKey String
Inherited From:
Source:
Returns:
Boolean

isChildOf(container) → {Boolean}

Determines if the element is child of a container
Parameters:
Name Type Description
container ContainerElement
Inherited From:
Source:
Returns:
Boolean

mousedown(callback) → {Element}

Registers a "mousedown" event listener on the element
Parameters:
Name Type Description
callback String | function
Inherited From:
Source:
Returns:
Element
this

mouseenter(callback) → {Element}

Registers a "mouseenter" event listener on the element
Parameters:
Name Type Description
callback String | function
Inherited From:
Source:
Returns:
Element
this

mouseleave(callback) → {Element}

Registers a "mouseleave" event listener on the element
Parameters:
Name Type Description
callback String | function
Inherited From:
Source:
Returns:
Element
this

mousemove(callback) → {Element}

Registers a "mousemove" event listener on the element
Parameters:
Name Type Description
callback String | function
Inherited From:
Source:
Returns:
Element
this

mouseup(callback) → {Element}

Registers a "mouseup" event listener on the element
Parameters:
Name Type Description
callback String | function
Inherited From:
Source:
Returns:
Element
this

off(type, listener) → {EventTarget}

Removes a listener from the specified event
Parameters:
Name Type Description
type String
listener function
Inherited From:
Source:
See:
Returns:
EventTarget
this

offAll() → {EventTarget}

Removes all listeners
Inherited From:
Source:
See:
Returns:
EventTarget
this

on(type, listener) → {EventTarget}

Adds a listener to the specified event
Parameters:
Name Type Description
type String
listener function
Inherited From:
Source:
See:
Returns:
EventTarget
this

removeAllEventListeners() → {EventTarget}

Removes all listeners
Inherited From:
Source:
Returns:
EventTarget
this

removeClass(item) → {Element}

Removes a class from the element's classList
Parameters:
Name Type Description
item String
Inherited From:
Source:
See:
Returns:
Element
this

removeEventListener(type, listener) → {EventTarget}

Removes a listener from the specified event
Parameters:
Name Type Description
type String
listener function
Inherited From:
Source:
Returns:
EventTarget
this

removeProp(propertyKey) → {Element}

Removes a property from the Element
Parameters:
Name Type Description
propertyKey String
Inherited From:
Source:
Returns:
Element
this

scale(widthRatio, heightRatio) → {Element}

Scales the element
Parameters:
Name Type Description
widthRatio int
heightRatio int
Inherited From:
Source:
Returns:
Element
this

setProp(propertyKey, primitiveValue, inheritableopt) → {Element}

Edits a property of the Element
Parameters:
Name Type Attributes Description
propertyKey String
primitiveValue *
inheritable Boolean <optional>
Inherited From:
Source:
Returns:
Element
this

toggle(propertyKey) → {Element}

Toggles a boolean property of the element
Parameters:
Name Type Description
propertyKey String
Inherited From:
Source:
Returns:
Element
this

toggleClass(item, orderIDopt) → {Element}

Toggles a class
Parameters:
Name Type Attributes Description
item String
orderID int <optional>
Inherited From:
Source:
See:
Returns:
Element
this

toString() → {String}

Returns the string value of the element
Inherited From:
Source:
Returns:
String

update() → {Element}

Updates the element (move by it's velocity)
Inherited From:
Source:
Returns:
Element
this