Open Source Canvas Library

Controller Class

The controller is responsible for user interactions, mostly while an animation is running. So for example the controller could (1) block all mouse clicks during an animation, could (2) terminate an animation on a mouse click, (3) send the mouse clicks to the remaining real HTML elements on the screen, or (4) interpret mouse events to e.g. rotate (part of) the animated scene. Of course you can also add your own methods to the controller to customize the bahaviour. The current version of taccgl™ can, however, not detect mouse clicks on animated elements or objects.

There is only one active controller at a certain point in time. You can however have multiple inactive controller objects and from time to time activate one of them to change the behaviour.

Using forwardingController, blockingController, or transformController you can create a controller object. Then with useController a controller can be activated.

On the rest of this page we discuss some special issues of the controllers. As a first time reader we recommend to first read the documentation about the specific controllers linked above.

Internal working of the Controllers

Technically animations run in an HTML canvas element that usually has the full window size and is located in front of most of the other elements of the page. Because often, however, big parts of the canvas are transparent, the HTML elements behind it appear anyway. Per default, however, HTML routes all mouse events to the animation canvas, regardless if HTML elements behind it are visible or not. It is the task of the controller to processes various events of the animation canvas. Most notably these are the mouse events like onclick etc.

Solving the Mouseover Problem

Browsers usually get confused w.r.t to the mouveover and mouseout events by the taccgl™ 3D canvas: When taccgl™ makes the 3D canvas visible/hidden in front of the HTML page, some browsers think that the mouse moved onto/out of the 3D canvas, although the mouse in fact did not move. This results in extra mouseover and mouseout events. The controllers have some helper methods that can be used to ignore these extra events, Controller.instMouseOverFilterClass, Controller.instMouseOverFilter, and Controller.automaticMouseMoveOut.

Methods of the Controller Class

The following methods are shared among all controllers. In addition some individual controller types have specific methods while others do not have any methods, e.g. the forwardingController and the blockingController.

WebGL™ is a trademark of the Khronos Group Inc.

Next Page:Controller.instMouseOverFilterClass - Install MouseOver Filter for all Elements of a Class
Previous Page: taccgl3DObject.material