Interface zebkit.ui.event.TrackInputEventState | <zebkit.ui.event> |
Input events state handler interface. The interface implements pointer and key events handler to track the current state where State can have one of the following value:
- over the pointer cursor is inside the component
- out the pointer cursor is outside the component
- pressed.over the pointer cursor is inside the component and an action pointer button or key is pressed
- pressed.out the pointer cursor is outside the component and an action pointer button or key is pressed
Every time a state has been updated "stateUpdated" method is called (if it implemented). The interface can be handy way to track typical states. For instance to implement a component that changes its view depending its state the following code can be used:
// create panel
var pan = new zebkit.ui.Panel();
// let's track the panel input events state and update
// the component background view depending the state
pan.extend(zebkit.ui.event.TrackInputEventState, [
function stateUpdate(o, n) {
if (n === "over") {
this.setBackround("orange");
} else if (n === "out") {
this.setBackround("red");
} else {
this.setBackround(null);
}
}
]);
public | void | keyPressed (e) |
public | void | keyReleased (e) |
public | void | pointerDragged (e) |
public | void | pointerEntered (e) |
public | void | pointerExited (e) |
public | void | pointerPressed (e) |
public | void | pointerReleased (e) |
public | void | setState (s) |
public
void
keyPressed (e )
Define key pressed events handler Parameters:
|
public
void
keyReleased (e )
Define key released events handler Parameters:
|
public
void
pointerDragged (e )
Define pointer dragged events handler Parameters:
|
public
void
pointerEntered (e )
Define pointer entered events handler Parameters:
|
public
void
pointerExited (e )
Define pointer exited events handler Parameters:
|
public
void
pointerPressed (e )
Define pointer pressed events handler Parameters:
|
public
void
pointerReleased (e )
Define pointer released events handler Parameters:
|