Detailed Description

A UI Event represents a click or keypress. An event object is always provided with any onmousedown/onmouseup/onkeydown etc.

Public Member Functions

 UIEvent (int x, int y, bool down)
 Creates a new UI event for the mouse. More...
 
 UIEvent (int key, char ch, bool down)
 Creates a new UI event for a keypress. More...
 
void stopPropagation ()
 Stops the event bubbling to any other elements. More...
 

Public Attributes

int clientX
 The x location of the mouse, as measured from the left of the screen. More...
 
int clientY
 The y location of the mouse, as measured from the top of the screen. More...
 
int keyCode
 The keycode of the key pressed. More...
 
bool heldDown
 True if the mouse button or key is currently down. More...
 
Element target
 The element that was clicked on or focused. More...
 
char character
 The character that has been typed. More...
 
int bubbleCount
 A counter that tracks how many times this event has bubbled so far. More...
 
Event unityEvent
 The source Unity event. More...
 
bool cancelBubble
 Set to true if you do not want this event to bubble any further. More...
 

Properties

KeyCode unityKeyCode [get]
 Gets the keycode as a UnityEngine.KeyCode. More...
 
int button [get]
 The mouse button that was pressed. See isLeftMouse and isRightMouse for clearer ways of using this value. More...
 
bool leftMouseDown [get]
 Is the left mouse button currently down? More...
 
bool rightMouseDown [get]
 Is the right mouse button currently down? More...
 
bool isLeftMouse [get]
 Mouseup/down only. Was it the left mouse button? More...
 
bool isRightMouse [get]
 Mouseup/down only. Was it the right mouse button? More...
 
bool ctrlKey [get]
 Is a control key down? More...
 
bool shiftKey [get]
 Is a shift key down? More...
 
bool altKey [get]
 Is an alt key down? More...
 
Document document [get]
 The document that this event has come from, if any. More...
 
WorldUI worldUI [get]
 The WorldUI that this event has come from, if any. More...
 
float relativeX [get]
 A 0-1 value of where this event occured relative to the target element. 0 is left edge, 1 is right edge. More...
 
float relativeY [get]
 A 0-1 value of where this event occured relative to the target element. 0 is top edge, 1 is bottom edge. More...
 
int localX [get]
 The position of the event relative to the top left corner of the target element in pixels. More...
 
int localY [get]
 The position of the event relative to the top left corner of the target element in pixels. More...
 

Constructor & Destructor Documentation

PowerUI.UIEvent.UIEvent ( int  x,
int  y,
bool  down 
)
inline

Creates a new UI event for the mouse.

Parameters
xThe x location of the mouse.
yThe y location of the mouse.
downTrue if the button is held down.
PowerUI.UIEvent.UIEvent ( int  key,
char  ch,
bool  down 
)
inline

Creates a new UI event for a keypress.

Parameters
keyThe keycode.
chThe newly typed character.
downTrue if the key is held down.

Member Function Documentation

void PowerUI.UIEvent.stopPropagation ( )
inline

Stops the event bubbling to any other elements.

Member Data Documentation

int PowerUI.UIEvent.bubbleCount

A counter that tracks how many times this event has bubbled so far.

bool PowerUI.UIEvent.cancelBubble

Set to true if you do not want this event to bubble any further.

char PowerUI.UIEvent.character

The character that has been typed.

int PowerUI.UIEvent.clientX

The x location of the mouse, as measured from the left of the screen.

int PowerUI.UIEvent.clientY

The y location of the mouse, as measured from the top of the screen.

bool PowerUI.UIEvent.heldDown

True if the mouse button or key is currently down.

int PowerUI.UIEvent.keyCode

The keycode of the key pressed.

Element PowerUI.UIEvent.target

The element that was clicked on or focused.

Event PowerUI.UIEvent.unityEvent

The source Unity event.

Property Documentation

bool PowerUI.UIEvent.altKey
get

Is an alt key down?

int PowerUI.UIEvent.button
get

The mouse button that was pressed. See isLeftMouse and isRightMouse for clearer ways of using this value.

bool PowerUI.UIEvent.ctrlKey
get

Is a control key down?

Document PowerUI.UIEvent.document
get

The document that this event has come from, if any.

bool PowerUI.UIEvent.isLeftMouse
get

Mouseup/down only. Was it the left mouse button?

bool PowerUI.UIEvent.isRightMouse
get

Mouseup/down only. Was it the right mouse button?

bool PowerUI.UIEvent.leftMouseDown
get

Is the left mouse button currently down?

int PowerUI.UIEvent.localX
get

The position of the event relative to the top left corner of the target element in pixels.

int PowerUI.UIEvent.localY
get

The position of the event relative to the top left corner of the target element in pixels.

float PowerUI.UIEvent.relativeX
get

A 0-1 value of where this event occured relative to the target element. 0 is left edge, 1 is right edge.

float PowerUI.UIEvent.relativeY
get

A 0-1 value of where this event occured relative to the target element. 0 is top edge, 1 is bottom edge.

bool PowerUI.UIEvent.rightMouseDown
get

Is the right mouse button currently down?

bool PowerUI.UIEvent.shiftKey
get

Is a shift key down?

KeyCode PowerUI.UIEvent.unityKeyCode
get

Gets the keycode as a UnityEngine.KeyCode.

WorldUI PowerUI.UIEvent.worldUI
get

The WorldUI that this event has come from, if any.