WireItLibrary

WireIt  0.6.0

WireItLibrary > WireIt > WireIt.Wire
Search:
 
Filters

Class WireIt.Wire - extends WireIt.CanvasElement

Known Subclasses:
WireIt.ArrowWire WireIt.LeftSquareArrow WireIt.RightSquareArrow WireIt.BezierWire WireIt.StepWire
The wire widget that uses a canvas to render

Constructor

WireIt.Wire ( terminal1 , terminal2 , parentEl , options )
Parameters:
terminal1 <WireIt.Terminal> Source terminal
terminal2 <WireIt.Terminal> Target terminal
parentEl <HTMLElement> Container of the CANVAS tag
options <Obj> Wire configuration (see options property)

Properties

bordercap - String

TODO
Default Value: "round"

bordercolor - String

Border color
Default Value: '#0000ff'

borderwidth - Integer

Border width
Default Value: 1

cap - String

TODO
Default Value: "round"

className - String

CSS class name for the wire element
Default Value: "WireIt-Wire"

color - String

Wire color
Default Value: 'rgb(173, 216, 230)'

label - String

Wire label
Default Value: null

labelEditor - Object

inputEx field definition for the label editor
Default Value: null

labelStyle - Object

Wire label style
Default Value: null

parentEl - HTMLElement

Reference to the parent dom element

terminal1 - WireIt.Terminal

Source terminal

terminal2 - WireIt.Terminal || WireIt.TerminalProxy

Target terminal

width - Integer

Wire width
Default Value: 3

xtype - String

String representing this class for exporting as JSON
Default Value: "WireIt.Wire"

Properties inherited from WireIt.CanvasElement:

Methods

draw

void draw ( )
Drawing method

getConfig

void getConfig ( )
Return the config of this Wire

getOtherTerminal

WireIt.Terminal getOtherTerminal ( terminal )
This function returns terminal1 if the first argument is terminal2 and vice-versa
Parameters:
terminal <WireIt.Terminal>
Returns: WireIt.Terminal
terminal the terminal that is NOT passed as argument

onClick

void onClick ( x , y )
When the mouse clicked on the canvas Note: this will only work within a layer
Parameters:
x <Integer> left position of the mouse (relative to the canvas)
y <Integer> top position of the mouse (relative to the canvas)

onMouseMove

void onMouseMove ( x , y )
Called by the Layer when the mouse moves over the canvas element. Note: the event is not listened directly, to receive the event event if the wire is behind another wire
Parameters:
x <Integer> left position of the mouse (relative to the canvas)
y <Integer> top position of the mouse (relative to the canvas)

onWireClick

void onWireClick ( x , y )
When the mouse clicked on the wire Note: this will only work within a layer
Parameters:
x <Integer> left position of the mouse (relative to the canvas)
y <Integer> top position of the mouse (relative to the canvas)

onWireIn

void onWireIn ( x , y )
When the mouse comes into the wire Note: this will only work within a layer
Parameters:
x <Integer> left position of the mouse (relative to the canvas)
y <Integer> top position of the mouse (relative to the canvas)

onWireMove

void onWireMove ( x , y )
When the mouse moves over a wire Note: this will only work within a layer
Parameters:
x <Integer> left position of the mouse (relative to the canvas)
y <Integer> top position of the mouse (relative to the canvas)

onWireOut

void onWireOut ( x , y )
When the mouse comes out of the wire Note: this will only work within a layer
Parameters:
x <Integer> left position of the mouse (relative to the canvas)
y <Integer> top position of the mouse (relative to the canvas)

positionLabel

void positionLabel ( )
Position the label element to the center

redraw

void redraw ( )
Redraw the wire and label

remove

void remove ( )
Remove a Wire from the Dom

renderLabel

void renderLabel ( )
Render the label container

setLabel

void setLabel ( )
Set the label

setOptions

void setOptions ( )
Set the options by putting them in this (so it overrides the prototype default)

wireDrawnAt

Boolean wireDrawnAt ( )
Determine if the wire is drawn at position (x,y) relative to the canvas element. This is used for mouse events.
Returns: Boolean
true if the wire is drawn at position (x,y) relative to the canvas element

Events

eventMouseClick

eventMouseClick ( )
Event that is fired when a wire is clicked (on the wire, not the canvas) You can register this event with myWire.eventWireClick.subscribe(function(e,params) { var wire = params[0], xy = params[1];}, scope);

eventMouseIn

eventMouseIn ( )
Event that is fired when the mouse enter the wire You can register this event with myWire.eventMouseIn.subscribe(function(e,params) { var wire = params[0], xy = params[1];}, scope);

eventMouseMove

eventMouseMove ( )
Event that is fired when the mouse moves inside the wire You can register this event with myWire.eventMouseMove.subscribe(function(e,params) { var wire = params[0], xy = params[1];}, scope);

eventMouseOut

eventMouseOut ( )
Event that is fired when the mouse exits the wire You can register this event with myWire.eventMouseOut.subscribe(function(e,params) { var wire = params[0], xy = params[1];}, scope);


Copyright © 2010 Eric Abouaf All rights reserved.