Class MouseEvent
- Namespace
- AngleSharp.Html.Dom.Events
- Assembly
- AngleSharp.dll
Represents the event args for a mouse event.
[DomName("MouseEvent")]
public class MouseEvent : UiEvent
- Inheritance
-
MouseEvent
- Derived
- Inherited Members
- Extension Methods
Constructors
MouseEvent()
Creates a new event.
public MouseEvent()
MouseEvent(string, bool, bool, IWindow?, int, int, int, int, int, bool, bool, bool, bool, MouseButton, IEventTarget?)
Creates a new event and initializes it.
[DomConstructor]
[DomInitDict(1, true)]
public MouseEvent(string type, bool bubbles = false, bool cancelable = false, IWindow? view = null, int detail = 0, int screenX = 0, int screenY = 0, int clientX = 0, int clientY = 0, bool ctrlKey = false, bool altKey = false, bool shiftKey = false, bool metaKey = false, MouseButton button = MouseButton.Primary, IEventTarget? relatedTarget = null)
Parameters
type
stringThe type of the event.
bubbles
boolIf the event is bubbling.
cancelable
boolIf the event is cancelable.
view
IWindowSets the associated view for the UI event.
detail
intSets the detail id for the UI event.
screenX
intSets the screen X coordinate.
screenY
intSets the screen Y coordinate.
clientX
intSets the client X coordinate.
clientY
intSets the client Y coordinate.
ctrlKey
boolSets if the control key was pressed.
altKey
boolSets if the alt key was pressed.
shiftKey
boolSets if the shift key was pressed.
metaKey
boolSets if the meta key was pressed.
button
MouseButtonSets which button has been pressed.
relatedTarget
IEventTargetThe target of the mouse event.
Properties
Button
Gets which button has been pressed.
[DomName("button")]
public MouseButton Button { get; }
Property Value
Buttons
Gets the currently pressed buttons.
[DomName("buttons")]
public MouseButtons Buttons { get; }
Property Value
ClientX
Gets the client X coordinates.
[DomName("clientX")]
public int ClientX { get; }
Property Value
ClientY
Gets the client Y coordinates.
[DomName("clientY")]
public int ClientY { get; }
Property Value
IsAltPressed
Gets if the alt key is pressed.
[DomName("altKey")]
public bool IsAltPressed { get; }
Property Value
IsCtrlPressed
Gets if the control key is pressed.
[DomName("ctrlKey")]
public bool IsCtrlPressed { get; }
Property Value
IsMetaPressed
Gets if the meta key is pressed.
[DomName("metaKey")]
public bool IsMetaPressed { get; }
Property Value
IsShiftPressed
Gets if the shift key is pressed.
[DomName("shiftKey")]
public bool IsShiftPressed { get; }
Property Value
ScreenX
Gets the screen X coordinates.
[DomName("screenX")]
public int ScreenX { get; }
Property Value
ScreenY
Gets the screen Y coordinates.
[DomName("screenY")]
public int ScreenY { get; }
Property Value
Target
Gets the target of the mouse event.
[DomName("relatedTarget")]
public IEventTarget? Target { get; }
Property Value
Methods
GetModifierState(string)
Returns the current state of the specified modifier key.
[DomName("getModifierState")]
public bool GetModifierState(string key)
Parameters
key
stringThe modifier key to lookup.
Returns
- bool
True if the key is currently pressed, otherwise false.
Init(string, bool, bool, IWindow?, int, int, int, int, int, bool, bool, bool, bool, MouseButton, IEventTarget?)
Initializes the mouse event.
[DomName("initMouseEvent")]
public void Init(string type, bool bubbles, bool cancelable, IWindow? view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, MouseButton button, IEventTarget? target)
Parameters
type
stringThe type of event.
bubbles
boolDetermines if the event bubbles.
cancelable
boolDetermines if the event is cancelable.
view
IWindowSets the associated view for the UI event.
detail
intSets the detail id for the UIevent.
screenX
intSets the screen X coordinate.
screenY
intSets the screen Y coordinate.
clientX
intSets the client X coordinate.
clientY
intSets the client Y coordinate.
ctrlKey
boolSets if the control key was pressed.
altKey
boolSets if the alt key was pressed.
shiftKey
boolSets if the shift key was pressed.
metaKey
boolSets if the meta key was pressed.
button
MouseButtonSets which button has been pressed.
target
IEventTargetThe target of the mouse event.