<package> new MouseEvent(relativePos, absolutePos, ctrlKey, shiftKey, altKey, metaKey, button, buttons, eventTimeStamp)
Creates an instance of MouseEvent.
Parameters:
Name | Type | Description |
---|---|---|
relativePos |
olympe.df.Vector2 | Array.<number> | |
absolutePos |
olympe.df.Vector2 | Array.<number> | |
ctrlKey |
olympe.df.OBoolean | |
shiftKey |
olympe.df.OBoolean | |
altKey |
olympe.df.OBoolean | |
metaKey |
olympe.df.OBoolean | |
button |
olympe.df.ONumber | |
buttons |
olympe.df.ONumber | |
eventTimeStamp |
olympe.df.ODateTime |
Extends
Members
-
<static> BUTTON1 :olympe.df.ONumber
-
Primary mouse button.
Type:
-
<static> BUTTON2 :olympe.df.ONumber
-
Secondary mouse button.
Type:
-
<static> BUTTON3 :olympe.df.ONumber
-
Auxiliary mouse button.
Type:
-
<static> BUTTON4 :olympe.df.ONumber
-
Fourth mouse button (Browser back).
Type:
-
<static> BUTTON5 :olympe.df.ONumber
-
Fifth mouse button (Browser forward).
Type:
-
absolutePos :olympe.df.Vector2
-
Type:
-
relativePos :olympe.df.Vector2
-
Type:
Methods
-
altKeyPressed()
-
Checks whether the 'Alt' (Apple's option) key was pressed when the event occurred.
Returns:
true
if the Alt key was pressed.- Type
- olympe.df.OBoolean
-
ctrlKeyPressed()
-
Checks whether the 'Ctrl' key was pressed when the event occurred.
Returns:
true
if the Ctrl key was pressed.- Type
- olympe.df.OBoolean
-
getAbsolutePos()
-
Gets the absolute position of the mouse when the event occurred.
Returns:
Absolute Mouse position.
- Type
- olympe.df.Vector2
-
getButton()
-
Returns which button triggered the event. This is applicable only for certain events, for most events, like MouseEnter, MouseLeave, etc. the value is not meaningful.
Example:
this.onMouseDown( event => { if (event.getButton().equals(MouseEvent.BUTTON1)) { this.pressed.update(olympe.df.OBoolean.TRUE); } } );
Returns:
The button that triggered the event.
- Type
- olympe.df.ONumber
-
getEventTimestamp()
-
Gets the time stamp for that event, that is the date and time of its creation.
- Inherited From:
- Overrides:
Returns:
the creation date and time for this event
- Type
- olympe.df.PODateTime
-
getPressedButtons()
-
Gets an array containing all the buttons that were pressed when the event occurred.
Returns:
- Type
- Array.<olympe.df.ONumber>
-
getRelativePos()
-
Gets the absolute position of the mouse when the event occurred.
Returns:
Mouse position relative to the targeted element.
- Type
- olympe.df.Vector2
-
isButtonPressed(button)
-
Checks whether a button was pressed when the event occurred.
Example:
const pressed = event.isButtonPressed(olympe.ui.events.MouseEvent.BUTTON1);
Parameters:
Name Type Description button
olympe.df.ONumber The button to test.
Returns:
true
if the button was pressed.- Type
- olympe.df.OBoolean
-
metaKeyPressed()
-
Checks whether the 'Meta' (Apple's Command, Windows Key, ...) key was pressed when the event occurred.
Returns:
true
if the Meta key was pressed.- Type
- olympe.df.OBoolean
-
shiftKeyPressed()
-
Checks whether the 'Shift' key was pressed when the event occurred.
Returns:
true
if the Shift key was pressed.- Type
- olympe.df.OBoolean