Class Connector
Defined in: connections.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Connector(startPoint, endPoint, type, id)
It's a connector between 2 figureConnectionPoints.
|
Field Attributes | Field Name and Description |
---|---|
The {ConnectionPoint}'s id that is currently being dragged
|
|
<static> |
Connector.ARROW_ANGLE
End connector arrow angle
|
<static> |
Connector.ARROW_SIZE
End connector arrow size
|
End style for connector.
|
|
Connector's id
|
|
The text that will appear in the middle of the connector
|
|
Serialization type
|
|
An {Array} of {BuilderProperties} to store exposed properties of the connector
|
|
Start style for connector.
|
|
The {Style} this connector will have
|
|
<static> |
Connector.STYLE_ARROW
Arrow like end connector style
|
<static> |
Connector.STYLE_EMPTY_TRIANGLE
Empty triangle end connector style
|
<static> |
Connector.STYLE_FILLED_TRIANGLE
Filled triangle end connector style
|
<static> |
Connector.STYLE_NORMAL
Normal end connector style
|
An {Array} of {Point}s.
|
|
Type of connector.
|
|
<static> |
Connector.TYPE_JAGGED
Jagged connector type
|
<static> |
Connector.TYPE_STRAIGHT
Straight connector type
|
If true visual debug will be available
|
Method Attributes | Method Name and Description |
---|---|
adjust(matrix, point)
Transform a ConnectionPoint by a matrix.
|
|
connect2Points(p1, p2)
This function simply tries to create all possible intermediate points that can be placed
between 2 points to create a jagged connector
|
|
contains(x, y)
This is really a near type function, we don't want to find out
if we are anywhere within the "bounds" of the Connector
|
|
equals(anotherConnector)
Compares to another Connector
|
|
getArrow(x, y)
Creates an arrow like figure, pointed down \/, at a certain position
|
|
Founds the bounds of the connector
|
|
getTriangle(x, y, fill)
Creates a triangle like figure, pointed down \/, at a certain position
|
|
jagged()
Creates as jagged(zig-zag) line between 2 ConnectionPoints
|
|
A rework of jagged method
Just creates all turning points for Connector that has a StartPoint and an EndPoint
|
|
<static> |
Connector.load(o)
Creates a {Connector} out of JSON parsed object
|
<static> |
Connector.loadArray(v)
Creates a an {Array} of {Connector} out of JSON parsed array
|
middle()
Returns the middle of a connector
Usefull for setting up the middle text
|
|
near(x, y, radius)
Tests if a point defined by (x,y) is within a radius
|
|
paint(context)
Paints the connector
|
|
redraw()
Remove redundant points (we have just ajusted one of the handles of this figure, so)
|
|
toString()
String representation
|
|
toSVG()
SVG representation of the connector
|
|
transform(matrix)
Apply a transformation to this Connector
|
|
Updates the middle text of the connector
|
Class Detail
Connector(startPoint, endPoint, type, id)
It's a connector between 2 figureConnectionPoints.
Author: Zack Newsham, Alex Gheorghiu .
Author: Zack Newsham
- Parameters:
- {Point} startPoint
- - the start of the line, where a ConnectionPoint will be added
- {Point} endPoint
- - the end of the line, where a ConnectionPoint will be added
- {String} type
- - the type of the Connector. It can be 'straight' or 'jagged'
- {Number} id
- - the unique (at least among other Connectors) id this connnector will have
Field Detail
activeConnectionPointId
The {ConnectionPoint}'s id that is currently being dragged
<static>
Connector.ARROW_ANGLE
End connector arrow angle
<static>
Connector.ARROW_SIZE
End connector arrow size
endStyle
End style for connector. Ex: Connector.STYLE_NORMAL
id
Connector's id
middleText
The text that will appear in the middle of the connector
oType
Serialization type
properties
An {Array} of {BuilderProperties} to store exposed properties of the connector
startStyle
Start style for connector. Ex: Connector.STYLE_NORMAL
style
The {Style} this connector will have
<static>
Connector.STYLE_ARROW
Arrow like end connector style
<static>
Connector.STYLE_EMPTY_TRIANGLE
Empty triangle end connector style
<static>
Connector.STYLE_FILLED_TRIANGLE
Filled triangle end connector style
<static>
Connector.STYLE_NORMAL
Normal end connector style
turningPoints
An {Array} of {Point}s. They will be used to draw the connector
type
Type of connector. Ex. TYPE_STRAIGHT
<static>
Connector.TYPE_JAGGED
Jagged connector type
<static>
Connector.TYPE_STRAIGHT
Straight connector type
visualDebug
If true visual debug will be available
Method Detail
adjust(matrix, point)
Transform a ConnectionPoint by a matrix. Usually called only by ConnectionManager.connectionPointTransform(),
when a figure is being moved, so it's more or less start point or end point of a connector.
Important to remember is that by moving and edge turning point all ther might be cases when more than one
points need to change
Once a figure is changed its ConnectionPoints got tranformed...so the glued Connector must
change...it's like a cascade change
- Parameters:
- {Matrix} matrix
- - the transformation to be used
- {Point} point
- - the point to start from (could be end or start). It is the point that triggered the adjustement
connect2Points(p1, p2)
This function simply tries to create all possible intermediate points that can be placed
between 2 points to create a jagged connector
contains(x, y)
This is really a near type function, we don't want to find out
if we are anywhere within the "bounds" of the Connector
- Parameters:
- {Number} x
- - coordinate
- {Number} y
- - coordinate
equals(anotherConnector)
Compares to another Connector
- Parameters:
- {Connector} anotherConnector
- - the other connector
{Path}
getArrow(x, y)
Creates an arrow like figure, pointed down \/, at a certain position
Author: Zack.
Author: Zack.
- Parameters:
- {Number} x
- - the X coordinates of the point
- {Number} y
- - the X coordinates of the point
- Returns:
- {Path} the arrow as a {Path} object
{Array}
getBounds()
Founds the bounds of the connector
- Returns:
- {Array} - the [minX, minY, maxX, maxY]
{Path}
getTriangle(x, y, fill)
Creates a triangle like figure, pointed down \/, at a certain position
Author: Zack, Alex.
Author: Zack, Alex.
- Parameters:
- {Number} x
- - the X coordinates of the point
- {Number} y
- - the X coordinates of the point
- {Boolean} fill
- - if true fill the triangle
- Returns:
- {Path} the arrow as a {Path} object
jagged()
Creates as jagged(zig-zag) line between 2 ConnectionPoints
Author: Zack Newsham.
Author: Zack Newsham
jaggedReloaded()
A rework of jagged method
Just creates all turning points for Connector that has a StartPoint and an EndPoint
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
<static>
{Connector}
Connector.load(o)
Creates a {Connector} out of JSON parsed object
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
- Parameters:
- {JSONObject} o
- - the JSON parsed object
- Returns:
- {Connector} a newly constructed Connector
<static>
{Array}
Connector.loadArray(v)
Creates a an {Array} of {Connector} out of JSON parsed array
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
- Parameters:
- {JSONObject} v
- - the JSON parsed {Array}
- Returns:
- {Array} of newly loaded {Connector}s
{Array}
middle()
Returns the middle of a connector
Usefull for setting up the middle text
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
- Returns:
- {Array} of 2 {Number}s - the x and y of the point
near(x, y, radius)
Tests if a point defined by (x,y) is within a radius
- Parameters:
- {Number} x
- - x coordinates of the point
- {Number} y
- - y coordinates of the point
- {Number} radius
- - the radius to seach within
paint(context)
Paints the connector
Author: Alex, Zack.
Author: Alex, Zack.
- Parameters:
- {Context} context
- - the 2D context of the canvas
redraw()
Remove redundant points (we have just ajusted one of the handles of this figure, so)
toString()
String representation
{String}
toSVG()
SVG representation of the connector
- Returns:
- {String} - the SVG part
transform(matrix)
Apply a transformation to this Connector
- Parameters:
- {Matrix} matrix
- - a matrix of numbers
updateMiddleText()
Updates the middle text of the connector
Author: Alex Gheorghiu.
Author: Alex Gheorghiu