Detailed Description

This class manages input such as clicking, hovering and keypresses.

Static Public Member Functions

static void Setup ()
 Sets up the mouse and drag info. More...
 
static void AddSystemMouse ()
 Adds the system mouse if one is needed. More...
 
static void OnScrollWheel (Vector2 delta)
 Called when a scrollwheel changes by the given delta amount. More...
 
static void OnKeyPress (bool down, char character, int keyCode)
 Tells the UI a key was pressed. More...
 
static HtmlDocument MapToUIPanel (ref Vector2 screenPos)
 
static bool AcceptsInput (Element e)
 True if the given element should accept an input event. Html and body don't accept input in PowerUI (the event has to pass through) unless they have a background. More...
 
static Element ElementFromPoint (ref float x, ref float y)
 Finds an element from the given screen location. This fires a ray into the scene if the point isn't on the main UI and caches the hit in the given pointer. X and Y are updated with the document-relative point if it's on a WorldUI/ on the Unity UI. More...
 
static Element ElementFromPoint (ref float x, ref float y, InputPointer pointer)
 Finds an element from the given screen location. This fires a ray into the scene if the point isn't on the main UI and caches the hit in the given pointer. X and Y are updated with the document-relative point if it's on a WorldUI/ on the Unity UI. More...
 
static Element GetDraggable (Element current)
 Looks for any element with the 'draggable' attribute. More...
 
static IEventTarget ResolveTarget (GameObject toResolve)
 Attempts to resolve a Gameobject to an event target. Prefers to use Input.TargetResolver but falls back searching for a script on the gameobject which implements it. Will search up the hierarchy too. More...
 
static void Update ()
 Updates mouse overs, touches and the mouse position. More...
 

Static Public Attributes

static EventTarget Unhandled =new EventTarget()
 Clicks, taps and keypresses that pass through the UI and don't hit any WorldUI's will end up being received here. Note that PowerUI already does raycasting so use the MouseEvent.rayHit property. More...
 
static float MinimumDragStartDistance =20f
 Varies based on DPI. On a 96dpi screen, this is 20px. (0.2777 * DPI). More...
 
static MousePointer SystemMouse
 The system mouse pointer if there is one. Edit this to e.g. fix the mouse in a particular position. More...
 
static HtmlDocument LastFocusedDocument
 The latest document that got focused. More...
 
static bool CreateSystemMouse =true
 True if a system mouse should be created when on desktops. More...
 
static
UnityEngine.UI.GraphicRaycaster 
UnityUICaster
 True if the input searcher should also hit the Unity UI. More...
 
static float ScrollWheelMultiplier =150f
 Scrollwheel deltas are typically either -1 or 1. Those values are multiplied by this. More...
 
static TargetResolveDelegate TargetResolver
 Used to resolve GameObjects to an IEventTarget. This typically happens if you have e.g. some instance that represents items/ players and you want that object to receive the event. More...
 

Static Package Attributes

static bool PointersInvalid =true
 True if the pointers are invalid. The things underneath them all will be recomputed on the next update. More...
 

Properties

static int PointerCount [get]
 The raw pointer count. See InputPointer.AllRaw for more info. More...
 
static InputPointer[] PointersRaw [get]
 The raw set of all current pointing devices. See InputPointer.AllRaw for more info. More...
 
static Camera CameraFor3DInput [get, set]
 The camera used for 3D input. Defaults to Camera.main if this is null. More...
 
static EventTarget ActiveReceiver [get]
 Either a focused node or the Input.Unhandled set, depending on if anything is actually focused. More...
 

Static Private Attributes

static Camera CameraFor3DInput_
 The camera used for 3D input. Defaults to Camera.main if this is null. More...
 

Member Function Documentation

static bool PowerUI.Input.AcceptsInput ( Element  e)
inlinestatic

True if the given element should accept an input event. Html and body don't accept input in PowerUI (the event has to pass through) unless they have a background.

static void PowerUI.Input.AddSystemMouse ( )
inlinestatic

Adds the system mouse if one is needed.

static Element PowerUI.Input.ElementFromPoint ( ref float  x,
ref float  y 
)
inlinestatic

Finds an element from the given screen location. This fires a ray into the scene if the point isn't on the main UI and caches the hit in the given pointer. X and Y are updated with the document-relative point if it's on a WorldUI/ on the Unity UI.

static Element PowerUI.Input.ElementFromPoint ( ref float  x,
ref float  y,
InputPointer  pointer 
)
inlinestatic

Finds an element from the given screen location. This fires a ray into the scene if the point isn't on the main UI and caches the hit in the given pointer. X and Y are updated with the document-relative point if it's on a WorldUI/ on the Unity UI.

static Element PowerUI.Input.GetDraggable ( Element  current)
inlinestatic

Looks for any element with the 'draggable' attribute.

static HtmlDocument PowerUI.Input.MapToUIPanel ( ref Vector2  screenPos)
inlinestatic
static void PowerUI.Input.OnKeyPress ( bool  down,
char  character,
int  keyCode 
)
inlinestatic

Tells the UI a key was pressed.

Parameters
downTrue if the key is now down.
keyCodeThe keycode of the key
characterThe character entered.
Returns
True if the UI consumed the keypress.
static void PowerUI.Input.OnScrollWheel ( Vector2  delta)
inlinestatic

Called when a scrollwheel changes by the given delta amount.

static IEventTarget PowerUI.Input.ResolveTarget ( GameObject  toResolve)
inlinestatic

Attempts to resolve a Gameobject to an event target. Prefers to use Input.TargetResolver but falls back searching for a script on the gameobject which implements it. Will search up the hierarchy too.

static void PowerUI.Input.Setup ( )
inlinestatic

Sets up the mouse and drag info.

static void PowerUI.Input.Update ( )
inlinestatic

Updates mouse overs, touches and the mouse position.

Member Data Documentation

Camera PowerUI.Input.CameraFor3DInput_
staticprivate

The camera used for 3D input. Defaults to Camera.main if this is null.

bool PowerUI.Input.CreateSystemMouse =true
static

True if a system mouse should be created when on desktops.

HtmlDocument PowerUI.Input.LastFocusedDocument
static

The latest document that got focused.

float PowerUI.Input.MinimumDragStartDistance =20f
static

Varies based on DPI. On a 96dpi screen, this is 20px. (0.2777 * DPI).

bool PowerUI.Input.PointersInvalid =true
staticpackage

True if the pointers are invalid. The things underneath them all will be recomputed on the next update.

float PowerUI.Input.ScrollWheelMultiplier =150f
static

Scrollwheel deltas are typically either -1 or 1. Those values are multiplied by this.

MousePointer PowerUI.Input.SystemMouse
static

The system mouse pointer if there is one. Edit this to e.g. fix the mouse in a particular position.

TargetResolveDelegate PowerUI.Input.TargetResolver
static

Used to resolve GameObjects to an IEventTarget. This typically happens if you have e.g. some instance that represents items/ players and you want that object to receive the event.

EventTarget PowerUI.Input.Unhandled =new EventTarget()
static

Clicks, taps and keypresses that pass through the UI and don't hit any WorldUI's will end up being received here. Note that PowerUI already does raycasting so use the MouseEvent.rayHit property.

UnityEngine.UI.GraphicRaycaster PowerUI.Input.UnityUICaster
static

True if the input searcher should also hit the Unity UI.

Property Documentation

EventTarget PowerUI.Input.ActiveReceiver
staticget

Either a focused node or the Input.Unhandled set, depending on if anything is actually focused.

Camera PowerUI.Input.CameraFor3DInput
staticgetset

The camera used for 3D input. Defaults to Camera.main if this is null.

int PowerUI.Input.PointerCount
staticget

The raw pointer count. See InputPointer.AllRaw for more info.

InputPointer [] PowerUI.Input.PointersRaw
staticget

The raw set of all current pointing devices. See InputPointer.AllRaw for more info.