Button Events: Difference between revisions
Added initial version of Button Events page, this isn't final yet, I'll refine this tomorrow. |
Fixes, rewording & adding SHORTDESC. |
||
Line 1: | Line 1: | ||
Button events provide a generalized system for '''''buttons''''' and '''''actions triggered by buttons''''' within [[Resonite]]. This abstraction allows components to define behaviors as responses to common button interactions without having to | Button events provide a generalized system for '''''buttons''''' and '''''actions triggered by buttons''''' within [[Resonite]]. This abstraction allows components to define behaviors as responses to common button interactions without having to know the specific button the interaction originates from. When a button event sender component triggers an event, it will call all corresponding button event receiver components on a single target [[Slot|slot]], which is usually the same one it is attached to. Button events '''do not''' traverse hierarchies in the same way [[Dynamic Impulses]] do. | ||
You can use button events in [[ProtoFlux]] by using the [[Button Events (ProtoFlux)|Button Events node]]. | |||
{{Note|The order in which multiple button event handler components on the same slot are executed is not defined, as the order of components on a slot themselves isn't defined and may change. If order of execution is important, consider using ProtoFlux instead!|danger}} | |||
== Event Types == | |||
Button events are separated into two categories, each defining 3 event types: | Button events are separated into two categories, each defining 3 event types: | ||
;Hover Events | ;Hover Events | ||
Line 15: | Line 16: | ||
: Released | : Released | ||
Components that act as receivers for either or both of those event categories implement | Components that act as receivers for either or both of those event categories implement [[Type:IButtonPressReceiver|IButtonPressReceiver]] and [[Type:IButtonHoverReceiver|IButtonHoverReceiver]] respectively. | ||
== Button Event Data == | == Button Event Data == | ||
Each button event carries event data with information about the interaction | Each button event carries event data with information about the interaction event originated from. | ||
{| class="wikitable" style="margin:left" | {| class="wikitable" style="margin:left" | ||
|- | |- | ||
! Property Name !! Property Type | ! Property Name !! Property Type | ||
|- | |- | ||
| Source || [[Type:Component]] | | Source || [[Type:Component|Component]] | ||
|- | |- | ||
| Global Press Point || [[Type:Float3]] | | Global Press Point || [[Type:Float3|Float3]] | ||
|- | |- | ||
| Local Press Point || [[Type:Float2]] | | Local Press Point || [[Type:Float2|Float2]] | ||
|- | |- | ||
| Normalized Press Point || [[Type:Float2]] | | Normalized Press Point || [[Type:Float2|Float2]] | ||
|} | |} | ||
== Button Event | == Button Event Senders == | ||
{| class="wikitable" style="margin:left" | {| class="wikitable" style="margin:left" | ||
|- | |- | ||
Line 41: | Line 40: | ||
| [[Button (Component)]] || Yes || Yes || | | [[Button (Component)]] || Yes || Yes || | ||
|- | |- | ||
| [[ButtonHoverEventRelay (Component)]] || Yes || No || Relays button hover events to a specifiable slot instead of its own | | [[ButtonHoverEventRelay (Component)]] || Yes || No || Relays button hover events to a specifiable slot instead of its own. | ||
|- | |- | ||
| [[ButtonPressEventRelay (Component)]] || No || Yes || Relays button press events to a specifiable slot instead of its own | | [[ButtonPressEventRelay (Component)]] || No || Yes || Relays button press events to a specifiable slot instead of its own. | ||
|- | |- | ||
| [[LegacyButton (Component)]] || No || Yes || Only supports '''Pressed''' and '''Released''', not '''Pressing''' | | [[LegacyButton (Component)]] || No || Yes || Only supports '''Pressed''' and '''Released''', not '''Pressing'''. | ||
|- | |- | ||
| [[PhysicalButton (Component)]] || No || Yes || | | [[PhysicalButton (Component)]] || No || Yes || | ||
Line 129: | Line 128: | ||
| [[ContextMenuItem (Component)]] || Yes || Yes || | | [[ContextMenuItem (Component)]] || Yes || Yes || | ||
|- | |- | ||
| [[ContextMenuItemSource (Component)]] || Yes || Yes || Despite not being a button event | | [[ContextMenuItemSource (Component)]] || Yes || Yes || Despite not being a button event sender itself, it implements [[Type:IButton|IButton]] and can therefore be used with [[Button Events (ProtoFlux)|the Button Events ProtoFlux node]]. (It will proxy all button events it receives.) | ||
|- | |- | ||
| [[ContextMenuSubmenu (Component)]] || No || Yes || | | [[ContextMenuSubmenu (Component)]] || No || Yes || | ||
Line 179: | Line 178: | ||
| [[WorldThumbnailItem (Component)]] || Yes || Yes || | | [[WorldThumbnailItem (Component)]] || Yes || Yes || | ||
|} | |} | ||
{{SHORTDESC:Button events are a generalized event system for all button interactions.}} |
Revision as of 20:04, 18 January 2024
Button events provide a generalized system for buttons and actions triggered by buttons within Resonite. This abstraction allows components to define behaviors as responses to common button interactions without having to know the specific button the interaction originates from. When a button event sender component triggers an event, it will call all corresponding button event receiver components on a single target slot, which is usually the same one it is attached to. Button events do not traverse hierarchies in the same way Dynamic Impulses do.
You can use button events in ProtoFlux by using the Button Events node.
Event Types
Button events are separated into two categories, each defining 3 event types:
- Hover Events
- Hover Enter
- Hover Stay
- Hover Leave
- Press Events
- Pressed
- Pressing
- Released
Components that act as receivers for either or both of those event categories implement IButtonPressReceiver and IButtonHoverReceiver respectively.
Button Event Data
Each button event carries event data with information about the interaction event originated from.
Property Name | Property Type |
---|---|
Source | Component |
Global Press Point | Float3 |
Local Press Point | Float2 |
Normalized Press Point | Float2 |
Button Event Senders
Component | Hover Events | Press Events | Notes |
---|---|---|---|
Button (Component) | Yes | Yes | |
ButtonHoverEventRelay (Component) | Yes | No | Relays button hover events to a specifiable slot instead of its own. |
ButtonPressEventRelay (Component) | No | Yes | Relays button press events to a specifiable slot instead of its own. |
LegacyButton (Component) | No | Yes | Only supports Pressed and Released, not Pressing. |
PhysicalButton (Component) | No | Yes | |
TouchButton (Component) | No | Yes |
Button Event Handlers