Skip to content

Commit f0468d0

Browse files
authoredJan 21, 2025
fix(pointer): use 1 as default value for PointerEvent.width and PointerEvent.height (#1224)
1 parent 6614f72 commit f0468d0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎src/event/createEvent.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ const eventInitializer: {
2828
Event: [],
2929
FocusEvent: [initUIEvent, initFocusEvent],
3030
InputEvent: [initUIEvent, initInputEvent],
31-
MouseEvent: [initUIEvent, initUIEventModififiers, initMouseEvent],
31+
MouseEvent: [initUIEvent, initUIEventModifiers, initMouseEvent],
3232
PointerEvent: [
3333
initUIEvent,
34-
initUIEventModififiers,
34+
initUIEventModifiers,
3535
initMouseEvent,
3636
initPointerEvent,
3737
],
38-
KeyboardEvent: [initUIEvent, initUIEventModififiers, initKeyboardEvent],
38+
KeyboardEvent: [initUIEvent, initUIEventModifiers, initKeyboardEvent],
3939
}
4040

4141
export function createEvent<K extends EventType>(
@@ -143,7 +143,7 @@ function initUIEvent(event: UIEvent, {view, detail}: UIEventInit) {
143143
})
144144
}
145145

146-
function initUIEventModififiers(
146+
function initUIEventModifiers(
147147
event: KeyboardEvent | MouseEvent,
148148
{
149149
altKey,
@@ -262,8 +262,8 @@ function initPointerEvent(
262262
) {
263263
assignProps(event, {
264264
pointerId: sanitizeNumber(pointerId),
265-
width: sanitizeNumber(width),
266-
height: sanitizeNumber(height),
265+
width: sanitizeNumber(width ?? 1),
266+
height: sanitizeNumber(height ?? 1),
267267
pressure: sanitizeNumber(pressure),
268268
tangentialPressure: sanitizeNumber(tangentialPressure),
269269
tiltX: sanitizeNumber(tiltX),

0 commit comments

Comments
 (0)
Please sign in to comment.