MouseEvent
The MouseEvent
interface represents events that occur due to the user interacting with a pointing device (such as a mouse). Common events using this interface include click
, dblclick
, mouseup
, mousedown
.
Documentation MouseEvent by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Instance Members
screenX: Int
The X coordinate of the mouse pointer in global (screen) coordinates.
screenY: Int
The Y coordinate of the mouse pointer in global (screen) coordinates.
clientX: Int
The X coordinate of the mouse pointer in local (DOM content) coordinates.
clientY: Int
The Y coordinate of the mouse pointer in local (DOM content) coordinates.
x: Int
Alias for MouseEvent.clientX
.
y: Int
Alias for MouseEvent.clientY
offsetX: Int
The X coordinate of the mouse pointer relative to the position of the padding edge of the target node.
offsetY: Int
The Y coordinate of the mouse pointer relative to the position of the padding edge of the target node.
ctrlKey: Bool
Returns true
if the control key was down when the mouse event was fired.
shiftKey: Bool
Returns true
if the shift key was down when the mouse event was fired.
altKey: Bool
Returns true
if the alt key was down when the mouse event was fired.
metaKey: Bool
Returns true
if the meta key was down when the mouse event was fired.
button: Int
The button number that was pressed (if applicable) when the mouse event was fired.
buttons: Int
The buttons being depressed (if any) when the mouse event was fired.
The secondary target for the event, if there is one.
region: String
Returns the id of the hit region affected by the event. If no hit region is affected, null
is returned.
movementX: Int
The X coordinate of the mouse pointer relative to the position of the last mousemove
event.
movementY: Int
The Y coordinate of the mouse pointer relative to the position of the last mousemove
event.
initMouseEvent(typeArg: String, ?canBubbleArg: Bool = false, ?cancelableArg: Bool = false, ?viewArg: Window, ?detailArg: Int = 0, ?screenXArg: Int = 0, ?screenYArg: Int = 0, ?clientXArg: Int = 0, ?clientYArg: Int = 0, ?ctrlKeyArg: Bool = false, ?altKeyArg: Bool = false, ?shiftKeyArg: Bool = false, ?metaKeyArg: Bool = false, ?buttonArg: Int = 0, ?relatedTargetArg: EventTarget): Void
Initializes the value of a MouseEvent
created. If the event has already being dispatched, this method does nothing.
Name | Type | Default |
---|---|---|
typeArg |
String | |
canBubbleArg |
Bool | false |
cancelableArg |
Bool | false |
viewArg |
Window | (optional) |
detailArg |
Int | 0 |
screenXArg |
Int | 0 |
screenYArg |
Int | 0 |
clientXArg |
Int | 0 |
clientYArg |
Int | 0 |
ctrlKeyArg |
Bool | false |
altKeyArg |
Bool | false |
shiftKeyArg |
Bool | false |
metaKeyArg |
Bool | false |
buttonArg |
Int | 0 |
relatedTargetArg |
EventTarget | (optional) |
Returns the current state of the specified modifier key. See the KeyboardEvent.getModifierState
() for details.
Name | Type |
---|---|
keyArg |
String |
Returns |
---|
Bool |
initNSMouseEvent(typeArg: String, ?canBubbleArg: Bool = false, ?cancelableArg: Bool = false, ?viewArg: Window, ?detailArg: Int = 0, ?screenXArg: Int = 0, ?screenYArg: Int = 0, ?clientXArg: Int = 0, ?clientYArg: Int = 0, ?ctrlKeyArg: Bool = false, ?altKeyArg: Bool = false, ?shiftKeyArg: Bool = false, ?metaKeyArg: Bool = false, ?buttonArg: Int = 0, ?relatedTargetArg: EventTarget, ?pressure: Float = 0.0, ?inputSourceArg: Int = 0): Void
Name | Type | Default |
---|---|---|
typeArg |
String | |
canBubbleArg |
Bool | false |
cancelableArg |
Bool | false |
viewArg |
Window | (optional) |
detailArg |
Int | 0 |
screenXArg |
Int | 0 |
screenYArg |
Int | 0 |
clientXArg |
Int | 0 |
clientYArg |
Int | 0 |
ctrlKeyArg |
Bool | false |
altKeyArg |
Bool | false |
shiftKeyArg |
Bool | false |
metaKeyArg |
Bool | false |
buttonArg |
Int | 0 |
relatedTargetArg |
EventTarget | (optional) |
pressure |
Float | 0.0 |
inputSourceArg |
Int | 0 |
new(typeArg: String, ?mouseEventInitDict: Null<MouseEventInit>): Void
Name | Type | Default |
---|---|---|
typeArg |
String | |
mouseEventInitDict |
Null<MouseEventInit> | (optional) |