CGSGScene Class
Represent the scene of the application. It encapsulates the scene graph itself and several methods to track mouse and touch events, ...
Constructor
Item Index
Methods
- _clickOnScene
- _dblClickOnScene
- _doDragSelect
- _getDeltaOnMove
- _moveOnScene
- _updateFramerate
- _updateFramerateContainer
- _upOnScene
- deleteSelected
- deselectAll
- getDisplayRatio
- invalidate
- onKeyDownHandler
- onKeyUpHandler
- onMouseDblClick
- onMouseDown
- onMouseMove
- onMouseUp
- onTouchEnd
- onTouchMove
- onTouchStart
- render
- setCanvasDimension
- setDisplayRatio
- showFPS
- startPlaying
- stopPlaying
Properties
- _frameContainer Handler to the HTML Element displaying the FPS
- _isRunning
- _keyDownedCtrl
- _listCursors List of the names for the cursor when overring a handlebox
- _mousePosition
- _selectedNode The current last selected node
- _timerDblTouch
- allowMultiSelect
- cgsgGlobalRenderingTimer
- context
- dblTouchDelay
- dragSelectAlpha
- dragSelectFillColor
- dragSelectStrokeColor
- fps
- onRenderEnd
- onRenderStart
- onSceneClickEnd
- onSceneClickStart
- onSceneDblClickEnd
- onSceneDblClickStart
- sceneGraph
- selectedNodes
Methods
-
event -
mustPickNode
-
eventEventMouseEvent or TouchEvent
-
mustPickNodeBoolean
-
event
-
eventEvent
Select the nodes under the drag select rectangle
-
delta -
nodeOffsetX -
nodeOffsetY -
w -
h -
signeX -
signeY
-
event
-
eventEventMouseEvent or TouchEvent
Update the current framerate
Update the innerHTML of the HTMLElement passed as parameter of the "showFPS" function
-
event
-
eventEventMouseEvent or TouchEvent
Remove the nodes selected in the scene graph
-
excludedArray
Deselect all nodes
-
excludedArrayArrayCGSGNodes not to deselect
Inform the SceneGraph that a new render is needed
-
event
mouse double click Event handler function
-
eventMouseEvent
-
event
click mouse Event handler function
-
eventMouseEvent
-
event
mouse move Event handler function
-
eventMouseEvent
-
event
mouse up Event handler function
-
eventMouseEvent
-
event
touch up Event handler function
-
eventEvent
-
event
touch move Event handler function
-
eventEvent
-
event
touch down Event handler function
-
eventEvent
the main rendering loop
-
newDimension
Change the dimension of the canvas. Does not really change the dimension of the rendering canvas container, but is used by the different computations
-
newDimensionCGSGDimension
-
newRatio
Set the new value for the display ratio. The display ratio is used to resize all the elements on the graph to be adapted to the screen, depending on the reference screen size. You can compute the ratio like this: x = canvas.width/reference.width ; y = canvas.height/reference.height
-
newRatioCGSGScalea CGSGScale value
-
elt
-
eltHTMLElementan HTML element to receive the FPS. Can be null if you want to remove the framerate
Call this to start the update of the scene
Call this to stop the rendering (and so animation) update
Properties
The delay between 2 touches to be considered as a dbl touch event. To remove the double touch, just set it to 0
Default: CGSG_DEFAULT_DBLTOUCH_DELAY
Stroke color for the drag selection selection rectangle
Default: "#808080"
Callback on end rendering event
Default: null
this.onRenderEnd = function () { //... }
Callback on start rendering event
Default: null
this.onSceneClickStart = function () { //... }
Callback on click up on scene event
Default: null
this.onSceneClickEnd = function (event) { event.position; //Array of CGSGPosition event.event; //Event }
Callback on click down on scene event.
Default: null
this.onSceneClickStart = function (event) { event.position; //Array of CGSGPosition event.event; //Event }
Callback on double click up on scene event
Default: null
this.onSceneDblClickEnd = function (event) { event.position; //Array of CGSGPosition event.event; //Event }
Callback on double click start on scene event
Default: null
this.onSceneDblClickStart = function (event) { event.position; //Array of CGSGPosition event.event; //Event }