Revision of Events from Fri, 06/23/2017 - 21:01
XSeen uses DOM-style events. This allows easy cross over from regular HTML to XSeen and back as well as dealling with events solely within XSeen.
Some events are indicated just by their action (e.g., click, mouseenter). In XSeen these events deliver a TRUE value to their target when the specified event happens.
Other events are issued continuously while the event happens (e.g., mouseover). These events have other data associated with them (frequently position). It is the responsibility of the event handler to correctly deal with the event contents. It is the relation between the event type and the target field that determines what needs to be done.
For example a trigger event (e.g., mouseenter) can easily be sent to a field that controls a simple (true/false) behavior. In this case, the act of generating the event is sufficient information to determine what happens. If XSeen needs to track mouse motion in/over an object and changing coordinates are fed to a field, then the event handler needs to access the event object and inspect the position coordinates. It may be necessary to perform a coordinate transformation on those coordinates to correctly go from 2D to 3D or vice-versa.
Event routing starts with identifying the emitter of the event (by element ID) [note: it may be possible to handle multiple elements through a class value], and the event type (any one of the allowed HTML/DOM or XSeen events). The terminal of the event route is the target element (specified by element ID) and field for XSeen nodes. For HTML elements, it is necessary to specify a JavaScript function. That function is the developers responsibility.
This table summarizes the requirements and steps for execution. Note that HTML events may be generated by XSeen elements (e.g., click). These are treated as 'From HTML Element' events.
From HTML Element | From XSeen Element | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
To HTML | Out of scope of XSeen | Input: XSeen element & field that generates output Output: JavaScript function written by developer |
||||||||||||||||||
To XSeen |
Input: HTML element & event type
|
Input: XSeen element & field that generates output
|
It is necessary to provide some feature so that developers can customize event handling. This needs the capability to calling a developer-provided hook in the event processing chain.