Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PointerEvent to have default width / height set to 1 #1224

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/event/createEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ const eventInitializer: {
ClipboardEvent: [initClipboardEvent],
Event: [],
InputEvent: [initUIEvent, initInputEvent],
MouseEvent: [initUIEvent, initUIEventModififiers, initMouseEvent],
MouseEvent: [initUIEvent, initUIEventModifiers, initMouseEvent],
PointerEvent: [
initUIEvent,
initUIEventModififiers,
initUIEventModifiers,
initMouseEvent,
initPointerEvent,
],
KeyboardEvent: [initUIEvent, initUIEventModififiers, initKeyboardEvent],
KeyboardEvent: [initUIEvent, initUIEventModifiers, initKeyboardEvent],
}

export function createEvent<K extends EventType>(
Expand Down Expand Up @@ -135,7 +135,7 @@ function initUIEvent(event: UIEvent, {view, detail}: UIEventInit) {
})
}

function initUIEventModififiers(
function initUIEventModifiers(
Copy link
Author

@chuganzy chuganzy Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected as I thought this is typo?

event: KeyboardEvent | MouseEvent,
{
altKey,
Expand Down Expand Up @@ -243,8 +243,8 @@ function initPointerEvent(
) {
assignProps(event, {
pointerId: sanitizeNumber(pointerId),
width: sanitizeNumber(width),
height: sanitizeNumber(height),
width: width ?? 1,
height: height ?? 1,
pressure: sanitizeNumber(pressure),
tangentialPressure: sanitizeNumber(tangentialPressure),
tiltX: sanitizeNumber(tiltX),
Expand Down