FlightGear Newsletter December 2012: Difference between revisions

Jump to navigation Jump to search
Canvas event handling
(Canvas event handling)
Line 29: Line 29:
=== Canvas System ===
=== Canvas System ===
<!--additions should also be added to:http://wiki.flightgear.org/Changelog_3.0.0#Some_of_the_major_changes_include: -->
<!--additions should also be added to:http://wiki.flightgear.org/Changelog_3.0.0#Some_of_the_major_changes_include: -->
Recently the canvas system has received a basic event system similar to the DOM event handling used by JavaScript and HTML. This is an important step towards a fully canvas based GUI as it allows attaching mouse event handlers directly to any canvas element without a need to take care of any mouse intersection tests. Adding a mouse '''click''' handler to an element is now as simple as:
<syntaxhighlight lang="php">
my_element.addEventListener("click", func print('my_element clicked'));
</syntaxhighlight>
There exist much more event types like '''dblclick''', '''drag''', '''wheel''', '''mouseover''' and '''mouseout'''.
For all non-developers: this update is an important brick in building an improved GUI using the Canvas system :-)


=== High Level Architecture ===
=== High Level Architecture ===
166

edits

Navigation menu