Built-In Namespace _global_
Field Attributes | Field Name and Description |
---|---|
Holds a wrapper around canvas object
|
|
A variable that tells us if CTRL is pressed
|
|
Current connector.
|
|
Connector type
|
|
the distance by which the connectors will escape Figure's bounds
|
|
Usually an instance of a Command (see /lib/commands/*.js)
|
|
Keeps current figure set id
|
|
Default line width
|
|
Activate or deactivate the undo feature*
|
|
Set on true while we drag
|
|
Toggle grid visible or not
|
|
The identity matrix
|
|
A variable that will tell us if we are in IE
|
|
Just keeps all the codes we need for the application in one place and with name tag
|
|
Keeps last coodinates while dragging
|
|
Stores last mouse position.
|
|
Remembers last move.
|
|
show even the debug messages
|
|
show only errors
|
|
show all up to (and including) info
Setting the log level at info level will slow your browser a lot.
|
|
no debug at all
|
|
keeps track if the MLB is pressed
|
|
A predefined matrix of a 90 degree clockwise rotation
|
|
A predefined matrix of a 90 degree anti-clockwise rotation
|
|
Currently selected ConnectionPoint (if -1 none is selected)
|
|
Current selecte connector (-1 if none selected)
|
|
Current selected figure id ( -1 if none selected)
|
|
Current selected group (-1 if none selected)
|
|
The (current) selection area
|
|
A variable that tells us if SHIFT is pressed
|
|
It will accumulate the changes on either X or Y coordinates for snap effect.
|
|
Makes figure snap to grid
|
|
Keeps current state
|
|
move a connection point of a connector
|
|
we are selecting the start of a connector
|
|
we are selecting the end of a connector
|
|
we selected a connector (for further editing for example)
|
|
we have figure to be created*
|
|
we selected a figure (for further editing for example)
|
|
we have a group selected (either temporary or permanent)
|
|
the default application state
|
|
we are dragging the mouse over a group of figures.
|
|
Thinking to use name spaces more
TODO: avoid colision
|
Method Attributes | Method Name and Description |
---|---|
action(action)
Dispatch actions.
|
|
connectorPickFirst(x, y, ev)
Pick the first connector we can get at (x,y) position
|
|
connectorPickSecond(x, y, ev)
Pick the second connector we can get at (x,y) position
|
|
createFigure(fFunction)
Setup the creation function (that -later, upon calling - will create the actual {Figure}
Note: It will also set the current state to STATE_FIGURE_CREATE
|
|
draw()
Draws all the stuff on the canvas
|
|
figure_CanvasImage(x, y)
|
|
figure_Circle(x, y)
|
|
figure_Diamond(x, y)
|
|
figure_Ellipse(x, y)
|
|
figure_Hexagon(x, y)
|
|
figure_Octogon(x, y)
|
|
figure_Page(x, y)
|
|
figure_Parallelogram(x, y)
|
|
figure_Pentagon(x, y)
|
|
figure_Polyline(x, y)
|
|
figure_Rectangle(x, y)
|
|
figure_RightTriangle(x, y)
|
|
figure_RoundedRectangle(x, y)
|
|
figure_SemiCircleDown(x, y)
|
|
figure_SemiCircleUp(x, y)
|
|
figure_Square(x, y)
|
|
figure_Stop(x, y)
".
|
|
figure_Text(x, y)
|
|
figure_Triangle(x, y)
|
|
generateMoveMatrix(fig, x, y)
Creates a moving matrix taking into consideration the snapTo option
The strange stuff is that Dia (http://projects.gnome.org/dia/) is using a top/left align
but OpenOffice's Draw is using something similar to Diagramo
|
|
getBodyXY(ev)
Computes the (x,y) coordinates of an event in page
|
|
Return current canvas.
|
|
Computes the bounds of the canvas
|
|
getCanvasXY(ev)
Extracts the X and Y from an event (for canvas)
|
|
Return the 2D context of current canvas
|
|
This functions detects if a browser supports
|
|
isNumeric(input)
Check if a value is numeric
|
|
modal()
Displays a modal window with information about the browser HTML5 support
Note: requires jquery.simplemodal-1.3.5.min.js to be loaded
|
|
onClick(ev)
Click is disabled because we need to handle mouse down and mouse up.
|
|
onKeyDown(ev)
Receives the key code of keyboard but not the ASCII
Treats the key pressed event
|
|
onKeyPress(ev)
Receives the ASCII character code but not the keyboard code
|
|
onKeyUp(ev)
Treats the key up event
|
|
onMouseDown(ev)
Treats the mouse down event
|
|
onMouseMove(ev)
Treats the mouse move event
|
|
onMouseUp(ev)
Treats the mouse up event
|
|
reset()
Cleans up the canvas
|
|
setFigureSet(id)
Reveals the figure set named by 'name' and hide previously displayed set
|
|
setUpEditPanel(shape)
Setup the editor panel for a special shape.
|
|
showGrid()
Makes grid visible or invisible, depedinding of previous value
|
|
signum(x)
Returns the sign of a number
|
|
Activate snapToGrip option
|
|
stopselection(ev)
Supposelly stop any selection from happening
|
|
touchCancel(event)
Triggered when touch is canceled (iPad/iPhone).
|
|
touchEnd(event)
Triggered when touch ends (iPad/iPhone).
|
|
touchMove(event)
Triggered while touching and moving is in progress (iPad/iPhone).
|
|
touchStart(event)
Triggered when an touch is initiated (iPad/iPhone).
|
|
updateFigure(figureId, property, newValue)
Update an object (Figure or Connector)
|
Field Detail
canvasProps
Holds a wrapper around canvas object
Defined in: main.js.
Defined in: main.js.
CNTRL_PRESSED
A variable that tells us if CTRL is pressed
Defined in: main.js.
Defined in: main.js.
connector
Current connector. It is null if no connector selected
Defined in: main.js.
Defined in: main.js.
connectorType
Connector type
Defined in: main.js.
Defined in: main.js.
createFigureFunction
the distance by which the connectors will escape Figure's bounds
Defined in: main.js.
Defined in: main.js.
currentMoveUndo
Usually an instance of a Command (see /lib/commands/*.js)
Defined in: main.js.
Defined in: main.js.
currentSetId
Keeps current figure set id
Defined in: main.js.
Defined in: main.js.
defaultLineWidth
Default line width
Defined in: main.js.
Defined in: main.js.
doUndo
Activate or deactivate the undo feature*
Defined in: main.js.
Defined in: main.js.
dragging
Set on true while we drag
Defined in: main.js.
Defined in: main.js.
gridVisible
Toggle grid visible or not
Defined in: main.js.
Defined in: main.js.
IDENTITY
The identity matrix
Defined in: primitives.js.
Defined in: primitives.js.
IE
A variable that will tell us if we are in IE
Defined in: main.js.
Defined in: main.js.
KEY
Just keeps all the codes we need for the application in one place and with name tag
Defined in: key.js.
Defined in: key.js.
- See:
- Char codes http://www.cambiaresearch.com/c4/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/Javascript-Char-Codes-Key-Codes.aspx
- Event properties http://www.quirksmode.org/js/events_properties.html
lastClick
Keeps last coodinates while dragging
Defined in: main.js.
Defined in: main.js.
lastMousePosition
Stores last mouse position. Null initially.
Defined in: main.js.
Defined in: main.js.
lastMove
Remembers last move. Initially it's null but once set it's a [x,y] array
Defined in: main.js.
Defined in: main.js.
LOG_LEVEL_DEBUG
show even the debug messages
Defined in: log.js.
Defined in: log.js.
LOG_LEVEL_ERROR
show only errors
Defined in: log.js.
Defined in: log.js.
LOG_LEVEL_INFO
show all up to (and including) info
Setting the log level at info level will slow your browser a lot....so use it carefully
Defined in: log.js.
Defined in: log.js.
LOG_LEVEL_NONE
no debug at all
Defined in: log.js.
Defined in: log.js.
mousePressed
keeps track if the MLB is pressed
Defined in: main.js.
Defined in: main.js.
R90
A predefined matrix of a 90 degree clockwise rotation
Defined in: primitives.js.
Defined in: primitives.js.
R90A
A predefined matrix of a 90 degree anti-clockwise rotation
Defined in: primitives.js.
Defined in: primitives.js.
selectedConnectionPointId
Currently selected ConnectionPoint (if -1 none is selected)
Defined in: main.js.
Defined in: main.js.
selectedConnectorId
Current selecte connector (-1 if none selected)
Defined in: main.js.
Defined in: main.js.
selectedFigureId
Current selected figure id ( -1 if none selected)
Defined in: main.js.
Defined in: main.js.
selectedGroupId
Current selected group (-1 if none selected)
Defined in: main.js.
Defined in: main.js.
selectionArea
The (current) selection area
Defined in: main.js.
Defined in: main.js.
SHIFT_PRESSED
A variable that tells us if SHIFT is pressed
Defined in: main.js.
Defined in: main.js.
snapMonitor
It will accumulate the changes on either X or Y coordinates for snap effect.
As we need to escape the "gravity/attraction" of the grid system we need to "accumulate" more changes
and if those changes become greater than a certain threshold we will initiate a snap action
Zack : "Because of the snap to grid function we need to move more than a certain amount of pixels
so we will not be snapped back to the old location"
Initially it's [0,0] but once more and more changes got added a snap effect will be triggered
and some of it's elements will be reset to 0.
So snapMonitor = [sumOfChagesOnX, sumOfChangesOnY]
Defined in: main.js.
Defined in: main.js.
snapTo
Makes figure snap to grid
Defined in: main.js.
Defined in: main.js.
state
Keeps current state
Defined in: main.js.
Defined in: main.js.
STATE_CONNECTOR_MOVE_POINT
move a connection point of a connector
Defined in: main.js.
Defined in: main.js.
STATE_CONNECTOR_PICK_FIRST
we are selecting the start of a connector
Defined in: main.js.
Defined in: main.js.
STATE_CONNECTOR_PICK_SECOND
we are selecting the end of a connector
Defined in: main.js.
Defined in: main.js.
STATE_CONNECTOR_SELECTED
we selected a connector (for further editing for example)
Defined in: main.js.
Defined in: main.js.
STATE_FIGURE_CREATE
we have figure to be created*
Defined in: main.js.
Defined in: main.js.
STATE_FIGURE_SELECTED
we selected a figure (for further editing for example)
Defined in: main.js.
Defined in: main.js.
STATE_GROUP_SELECTED
we have a group selected (either temporary or permanent)
Defined in: main.js.
Defined in: main.js.
STATE_NONE
the default application state
Defined in: main.js.
Defined in: main.js.
STATE_SELECTING_MULTIPLE
we are dragging the mouse over a group of figures.
Defined in: main.js.
Defined in: main.js.
testNS
Thinking to use name spaces more
TODO: avoid colision
Defined in: main.js.
Defined in: main.js.
- See:
- http://michaux.ca/articles/javascript-namespacing
- http://www.dustindiaz.com/namespace-your-javascript/
Method Detail
action(action)
Dispatch actions. Detect the action needed and trigger it.
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {String} action
- - the action name
connectorPickFirst(x, y, ev)
Pick the first connector we can get at (x,y) position
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Number} x
- - the x position
- {Number} y
- - the y position
- {Event} ev
- - the event triggered
connectorPickSecond(x, y, ev)
Pick the second connector we can get at (x,y) position
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Number} x
- - the x position
- {Number} y
- - the y position
- {Event} ev
- - the event triggered
createFigure(fFunction)
Setup the creation function (that -later, upon calling - will create the actual {Figure}
Note: It will also set the current state to STATE_FIGURE_CREATE
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Function} fFunction
- - the function used to create the figure
draw()
Draws all the stuff on the canvas
Defined in: main.js.
Defined in: main.js.
figure_CanvasImage(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Circle(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Diamond(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Ellipse(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Hexagon(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Octogon(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Page(x, y)
Defined in: secondary.js.
- Parameters:
- x
- y
figure_PageLowerCornerFolded(x, y)
Defined in: secondary.js.
- Parameters:
- x
- y
figure_PageUpperCornerFolded(x, y)
Defined in: secondary.js.
- Parameters:
- x
- y
figure_Parallelogram(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Pentagon(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Polyline(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Rectangle(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_RightTriangle(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_RoundedRectangle(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_SemiCircleDown(x, y)
Defined in: secondary.js.
- Parameters:
- x
- y
figure_SemiCircleUp(x, y)
Defined in: secondary.js.
- Parameters:
- x
- y
figure_Square(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Stop(x, y)
"..i have changed in the basic.js file and added the following function
its for creating the icon stop..."
Defined in: experimental.js.
Author: Nour Al-Harake.
Defined in: experimental.js.
Author: Nour Al-Harake
- Parameters:
- x
- y
figure_Text(x, y)
Defined in: basic.js.
- Parameters:
- x
- y
figure_Triangle(x, y)
Defined in: secondary.js.
- Parameters:
- x
- y
{Matrix}
generateMoveMatrix(fig, x, y)
Creates a moving matrix taking into consideration the snapTo option
The strange stuff is that Dia (http://projects.gnome.org/dia/) is using a top/left align
but OpenOffice's Draw is using something similar to Diagramo
Defined in: main.js.
Author: Zack Newsham, Alex Gheorghiu.
Defined in: main.js.
Author: Zack Newsham, Alex Gheorghiu.
- Parameters:
- {Object} fig
- - could be a figure, or a Connector
- {Number} x
- - mouse position
- {Number} y
- - mouse position
- Returns:
- {Matrix} - translation matrix
getBodyXY(ev)
Computes the (x,y) coordinates of an event in page
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} ev
- - the event
getCanvas()
Return current canvas.
Current canvas will ALWAYS have the 'a' as DOM id
Defined in: main.js.
Author: Alex Gheorghiu.
Defined in: main.js.
Author: Alex Gheorghiu
getCanvasBounds()
Computes the bounds of the canvas
Defined in: main.js.
Defined in: main.js.
getCanvasXY(ev)
Extracts the X and Y from an event (for canvas)
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} ev
- - the event
getContext()
{Number}
isBrowserReady()
This functions detects if a browser supports
- Returns:
- {Number} 0 - means no support at all, 1-means simulated support IE 2-means full support
isNumeric(input)
- Parameters:
- {String} input
- - a numeric value
modal()
Displays a modal window with information about the browser HTML5 support
Note: requires jquery.simplemodal-1.3.5.min.js to be loaded
Defined in: browserReady.js.
Defined in: browserReady.js.
onClick(ev)
Click is disabled because we need to handle mouse down and mouse up....etc etc etc
Defined in: main.js.
Defined in: main.js.
- Parameters:
- ev
onKeyDown(ev)
Receives the key code of keyboard but not the ASCII
Treats the key pressed event
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} ev
- - the event generated when key is down
onKeyPress(ev)
Receives the ASCII character code but not the keyboard code
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} ev
- - the event generated when kay is pressed
onKeyUp(ev)
Treats the key up event
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} ev
- - the event generated when key is up
onMouseDown(ev)
Treats the mouse down event
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} ev
- - the event generated when key is up
onMouseMove(ev)
Treats the mouse move event
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} ev
- - the event generated when key is up
onMouseUp(ev)
Treats the mouse up event
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} ev
- - the event generated when key is up
reset()
Cleans up the canvas
Defined in: main.js.
Defined in: main.js.
setFigureSet(id)
Reveals the figure set named by 'name' and hide previously displayed set
Defined in: main.js.
Author: Alex.
Defined in: main.js.
Author: Alex.
- Parameters:
- {String} id
- - the (div) id value of the set
setUpEditPanel(shape)
Setup the editor panel for a special shape.
Defined in: main.js.
Defined in: main.js.
- Parameters:
- shape
- - can be either Connector or Figure. If null is provided the editor panel will be disabled
showGrid()
Makes grid visible or invisible, depedinding of previous value
Defined in: main.js.
Defined in: main.js.
{Number}
signum(x)
- Parameters:
- {Number} x
- - the number
- Returns:
- {Number}
snapToGrid()
Activate snapToGrip option
Defined in: main.js.
Defined in: main.js.
stopselection(ev)
Supposelly stop any selection from happening
Defined in: main.js.
Defined in: main.js.
- Parameters:
- ev
touchCancel(event)
Triggered when touch is canceled (iPad/iPhone).
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} event
- - the event triggered
touchEnd(event)
Triggered when touch ends (iPad/iPhone).
Simply forward to onMouseUp
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} event
- - the event triggered
touchMove(event)
Triggered while touching and moving is in progress (iPad/iPhone).
Simply forward to onMouseMove
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} event
- - the event triggered
touchStart(event)
Triggered when an touch is initiated (iPad/iPhone).
Simply forward to onMouseDown
Defined in: main.js.
Defined in: main.js.
- Parameters:
- {Event} event
- - the event triggered
updateFigure(figureId, property, newValue)
- Parameters:
- {Number} figureId
- - the id of the updating object
- {String} property
- - (or an {Array} of {String}s). The 'id' under which the property is stored TODO: is there any case where we are using property as an array ?
- {String} newValue
- - the new value of the property