[ type ] MouseEvent
Description:
Mouse event received by the onMouseEvents() handler callback.
Type: Object
Properties:
| Name | Type | Description |
|---|---|---|
|
object | The component that triggered the event. |
|
string | One of |
|
number | Button number. One of MouseButton enum values. Present when type is |
|
number | Number of times the button was clicked. Present only when applicable, such as when type is |
|
number | Keyboard modifiers (bitmask or flags). |
|
boolean | Indicates if ALT key was pressed. |
|
boolean | Indicates if SHIFT key was pressed. |
|
boolean | Indicates if CTRL key was pressed. |
|
number | Mouse X position relative to the component. Present when applicable. |
|
number | Mouse Y position relative to the component. Present when applicable. |
|
number | Mouse X position relative to the primary screen. Present when applicable. |
|
number | Mouse Y position relative to the primary screen. Present when applicable. |
Examples:
Detecting a single mouse button left click
const label = new Label("Click Me").addTo(panel).onMouseEvents(e=>{
if(e.type === "click" && e.button === MouseButton.Left && e.clicks === 1)
{
console.log("User clicked this label: " + e.target.text());
}
});
