Namespace SpiderGL.UserInterface
The SpiderGL.UserInterface namespace.
- Defined in: ui.js
Constructor Attributes | Constructor Name and Description |
---|---|
The SpiderGL.UserInterface namespace.
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
<static> |
SpiderGL.UserInterface.handleCanvas(canvas, handler, options)
Sets up a WebGL context and canvas event handling.
|
<static> |
SpiderGL.UserInterface.handleCanvasOnLoad(canvas, handler, options)
Sets up a WebGL context and canvas event handling after window loading.
|
Namespace Detail
SpiderGL.UserInterface
The SpiderGL.UserInterface namespace.
Method Detail
-
<static> SpiderGL.UserInterface.handleCanvas(canvas, handler, options)Sets up a WebGL context and canvas event handling. The WebGLRenderingContext is created and hijacked using SpiderGL.WebGL.Context.getHijacked. A SpiderGL.UserInterface.CanvasHandler is created to handle the canvas events and dispatch them to the provided handler. The canvas handler will be installed in the handler object as a named property.
- Parameters:
- {HTMLCanvasElement|string} canvas
- The canvas used for rendering and from which event will be received.
- {object} handler
- The event handler.
- {function()} handler.onInitialize Optional
- onInitialize event handler.
- {function()} handler.onTerminate Optional
- onTerminate event handler.
- {function(keyCode|event)} handler.onKeyUp Optional
- onKeyUp event handler.
- {function(keyCode|event)} handler.onKeyDown Optional
- onKeyDown event handler.
- {function(keyCode|event)} handler.onKeyPress Optional
- onKeyPress event handler.
- {function(button|cursorX|cursorY|event)} handler.onMouseButtonDown Optional
- onMouseButtonDown event handler.
- {function(button|cursorX|cursorY|event)} handler.onMouseButtonUp Optional
- onMouseButtonUp event handler.
- {function(cursorX|cursorY|event)} handler.onMouseMove Optional
- onMouseMove event handler.
- {function(wheelDelta|cursorX|cursorY|event)} handler.onMouseWheel Optional
- onMouseWheel event handler.
- {function(button|cursorX|cursorY|event)} handler.onClick Optional
- onClick event handler.
- {function(button|cursorX|cursorY|event)} handler.onDoubleClick Optional
- onDoubleClick event handler.
- {function(button|cursorX|cursorY)} handler.onDragStart Optional
- onDragStart event handler.
- {function(button|cursorX|cursorY)} handler.onDragEnd Optional
- onDragEnd event handler.
- {function(button|cursorX|cursorY)} handler.onDrag Optional
- onDrag event handler.
- {function(canvasWidth|canvasHeight)} handler.onResize Optional
- onResize event handler.
- {function(deltaTimeSecs)} handler.onAnimate Optional
- onAnimate event handler.
- {function()} handler.onDraw Optional
- onDraw event handler.
- {object} options
- Optional parameters (see SpiderGL.UserInterface.CanvasHandler).
- {string} options.uiName Optional, Default: SpiderGL.UserInterface.CanvasHandler.DEFAULT_PROPERTY_NAME
- The name of the property to install in the handler object for accessing the canvas handler.
-
<static> SpiderGL.UserInterface.handleCanvasOnLoad(canvas, handler, options)Sets up a WebGL context and canvas event handling after window loading. When the window fires the onload event, SpiderGL.UserInterface.handleCanvas is called.
- Parameters:
- {HTMLCanvasElement|string} canvas
- The canvas used for rendering and from which event will be received.
- {object} handler
- The event handler (see SpiderGL.UserInterface.handleCanvas).
- {object} options
- Optional parameters (see SpiderGL.UserInterface.handleCanvas).