MouseEvent Class
https://w3c.github.io/uievents/#mouseevent
public class MouseEvent : UIEvent- Inheritance
UIEventMouseEvent
Constructors
| Name | Description |
|---|---|
| MouseEvent(string, MouseEventInit?) | Creates a mouse event of the given type with the given initialization dictionary. |
MouseEvent(string, MouseEventInit?)
UIEvents.csCreates a mouse event of the given type with the given initialization dictionary.
public MouseEvent(string type, MouseEventInit? eventInitDict = null)Properties
| Name | Description |
|---|---|
| AltKey | Gets a value indicating whether the Alt key was active. |
| Button | Gets the button that changed state: 0 for the main button, 1 for the auxiliary button, 2 for the secondary button. |
| Buttons | Gets the bit mask of the buttons that are pressed. |
| ClientX | Gets the horizontal coordinate of the pointer relative to the viewport. |
| ClientY | Gets the vertical coordinate of the pointer relative to the viewport. |
| CtrlKey | Gets a value indicating whether the Control key was active. |
| LayerX | Gets the horizontal coordinate of the pointer relative to the border box of the nearest positioned inclusive ancestor of the target while the event is dispatched (https://w3c.github.io/uievents/#dom-mouseevent-layerx, a legacy attribute), or MouseEvent.PageX. |
| LayerY | Gets the vertical coordinate of the pointer relative to the nearest positioned ancestor (https://w3c.github.io/uievents/#dom-mouseevent-layery): see MouseEvent.LayerX. |
| MetaKey | Gets a value indicating whether the Meta key was active. |
| MovementX | Gets the horizontal distance of the pointer movement since the previous event. |
| MovementY | Gets the vertical distance of the pointer movement since the previous event. |
| OffsetX | Gets the horizontal coordinate of the pointer relative to the padding edge of the target while the event is dispatched (https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsetx; the outermost svg element for an element of an SVG document fragment, as in the browsers), or MouseEvent.PageX. |
| OffsetY | Gets the vertical coordinate of the pointer relative to the padding edge of the target (https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsety): see MouseEvent.OffsetX. |
| PageX | Gets the horizontal coordinate of the pointer relative to the initial containing block (https://drafts.csswg.org/cssom-view/#dom-mouseevent-pagex): MouseEvent.ClientX plus the horizontal scroll position of the window of the event (the window of the realm it was created in, else UIEvent.View). |
| PageY | Gets the vertical coordinate of the pointer relative to the initial containing block (https://drafts.csswg.org/cssom-view/#dom-mouseevent-pagey): see MouseEvent.PageX. |
| RelatedTarget | Gets the secondary target of the event (for example the element the pointer left), or null. |
| ScreenX | Gets the horizontal coordinate of the pointer relative to the screen. |
| ScreenY | Gets the vertical coordinate of the pointer relative to the screen. |
| ShiftKey | Gets a value indicating whether the Shift key was active. |
| X | Gets the horizontal coordinate of the pointer relative to the viewport (an alias of MouseEvent.ClientX). |
| Y | Gets the vertical coordinate of the pointer relative to the viewport (an alias of MouseEvent.ClientY). |
AltKey
UIEvents.csGets a value indicating whether the Alt key was active.
public bool AltKey { get; }Button
UIEvents.csGets the button that changed state: 0 for the main button, 1 for the auxiliary button, 2 for the secondary button.
public short Button { get; }Buttons
UIEvents.csGets the bit mask of the buttons that are pressed.
public ushort Buttons { get; }ClientX
UIEvents.csGets the horizontal coordinate of the pointer relative to the viewport.
public double ClientX { get; }ClientY
UIEvents.csGets the vertical coordinate of the pointer relative to the viewport.
public double ClientY { get; }CtrlKey
UIEvents.csGets a value indicating whether the Control key was active.
public bool CtrlKey { get; }LayerX
UIEvents.csGets the horizontal coordinate of the pointer relative to the border box of the nearest positioned inclusive ancestor of the target while the event is dispatched (https://w3c.github.io/uievents/#dom-mouseevent-layerx, a legacy attribute), or MouseEvent.PageX.
public int LayerX { get; }LayerY
UIEvents.csGets the vertical coordinate of the pointer relative to the nearest positioned ancestor (https://w3c.github.io/uievents/#dom-mouseevent-layery): see MouseEvent.LayerX.
public int LayerY { get; }MetaKey
UIEvents.csGets a value indicating whether the Meta key was active.
public bool MetaKey { get; }MovementX
UIEvents.csGets the horizontal distance of the pointer movement since the previous event.
public double MovementX { get; }MovementY
UIEvents.csGets the vertical distance of the pointer movement since the previous event.
public double MovementY { get; }OffsetX
UIEvents.csGets the horizontal coordinate of the pointer relative to the padding edge of the target while the event is dispatched (https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsetx; the outermost svg element for an element of an SVG document fragment, as in the browsers), or MouseEvent.PageX.
public double OffsetX { get; }OffsetY
UIEvents.csGets the vertical coordinate of the pointer relative to the padding edge of the target (https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsety): see MouseEvent.OffsetX.
public double OffsetY { get; }PageX
UIEvents.csGets the horizontal coordinate of the pointer relative to the initial containing block (https://drafts.csswg.org/cssom-view/#dom-mouseevent-pagex): MouseEvent.ClientX plus the horizontal scroll position of the window of the event (the window of the realm it was created in, else UIEvent.View).
public double PageX { get; }PageY
UIEvents.csGets the vertical coordinate of the pointer relative to the initial containing block (https://drafts.csswg.org/cssom-view/#dom-mouseevent-pagey): see MouseEvent.PageX.
public double PageY { get; }RelatedTarget
UIEvents.csGets the secondary target of the event (for example the element the pointer left), or null.
public EventTarget? RelatedTarget { get; }ScreenX
UIEvents.csGets the horizontal coordinate of the pointer relative to the screen.
public double ScreenX { get; }ScreenY
UIEvents.csGets the vertical coordinate of the pointer relative to the screen.
public double ScreenY { get; }ShiftKey
UIEvents.csGets a value indicating whether the Shift key was active.
public bool ShiftKey { get; }Gets the horizontal coordinate of the pointer relative to the viewport (an alias of MouseEvent.ClientX).
public double X { get; }Gets the vertical coordinate of the pointer relative to the viewport (an alias of MouseEvent.ClientY).
public double Y { get; }Methods
| Name | Description |
|---|---|
| GetModifierState(string) | Returns whether the given modifier key (such as Shift or CapsLock) was active when the event occurred. |
| InitMouseEvent(string, bool, bool, EventTarget?, int, int, int, int, int, bool, bool, bool, bool, short, EventTarget?) | https://w3c.github.io/uievents/#dom-mouseevent-initmouseevent |
GetModifierState(string)
UIEvents.csReturns whether the given modifier key (such as Shift or CapsLock) was active when the event occurred.
InitMouseEvent(string, bool, bool, EventTarget?, int, int, int, int, int, bool, bool, bool, bool, short, EventTarget?)
UIEvents.cshttps://w3c.github.io/uievents/#dom-mouseevent-initmouseevent
public void InitMouseEvent(string typeArg, bool bubblesArg = false, bool cancelableArg = false, EventTarget? viewArg = null, int detailArg = 0, int screenXArg = 0, int screenYArg = 0, int clientXArg = 0, int clientYArg = 0, bool ctrlKeyArg = false, bool altKeyArg = false, bool shiftKeyArg = false, bool metaKeyArg = false, short buttonArg = 0, EventTarget? relatedTargetArg = null)