MCPcopy
hub / github.com/react/react / createPointerEvent

Function createPointerEvent

packages/dom-event-testing-library/domEvents.js:66–137  ·  view source on GitHub ↗
(
  type,
  {
    altKey = false,
    button = buttonType.none,
    buttons = buttonsType.none,
    ctrlKey = false,
    detail = 1,
    height,
    metaKey = false,
    movementX = 0,
    movementY = 0,
    offsetX = 0,
    offsetY = 0,
    pageX,
    pageY,
    pointerId,
    pressure = 0,
    preventDefault = emptyFunction,
    pointerType = 'mouse',
    screenX,
    screenY,
    shiftKey = false,
    tangentialPressure = 0,
    tiltX = 0,
    tiltY = 0,
    timeStamp,
    twist = 0,
    width,
    x = 0,
    y = 0,
  } = {},
)

Source from the content-addressed store, hash-verified

64}
65
66function createPointerEvent(
67 type,
68 {
69 altKey = false,
70 button = buttonType.none,
71 buttons = buttonsType.none,
72 ctrlKey = false,
73 detail = 1,
74 height,
75 metaKey = false,
76 movementX = 0,
77 movementY = 0,
78 offsetX = 0,
79 offsetY = 0,
80 pageX,
81 pageY,
82 pointerId,
83 pressure = 0,
84 preventDefault = emptyFunction,
85 pointerType = 'mouse',
86 screenX,
87 screenY,
88 shiftKey = false,
89 tangentialPressure = 0,
90 tiltX = 0,
91 tiltY = 0,
92 timeStamp,
93 twist = 0,
94 width,
95 x = 0,
96 y = 0,
97 } = {},
98) {
99 const modifierState = {altKey, ctrlKey, metaKey, shiftKey};
100 const isMouse = pointerType === 'mouse';
101
102 return createEvent(type, {
103 altKey,
104 button,
105 buttons,
106 clientX: x,
107 clientY: y,
108 ctrlKey,
109 detail,
110 getModifierState(keyArg) {
111 return createGetModifierState(keyArg, modifierState);
112 },
113 height: isMouse ? 1 : height != null ? height : defaultPointerSize,
114 metaKey,
115 movementX,
116 movementY,
117 offsetX,
118 offsetY,
119 pageX: pageX || x,
120 pageY: pageY || y,
121 pointerId,
122 pointerType,
123 pressure,

Callers 10

gotpointercaptureFunction · 0.85
lostpointercaptureFunction · 0.85
pointercancelFunction · 0.85
pointerdownFunction · 0.85
pointerenterFunction · 0.85
pointerleaveFunction · 0.85
pointermoveFunction · 0.85
pointeroutFunction · 0.85
pointeroverFunction · 0.85
pointerupFunction · 0.85

Calls 1

createEventFunction · 0.70

Tested by

no test coverage detected