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

fix(Canvas): Improved behavior when using apple pencil #172

Closed
wants to merge 2 commits into from

Conversation

heruiwoniou
Copy link

Fixed bug: Writing on the drawing board with the iPad pen will lose focus and a selection box will pop up

Close #171

Fixed bug: Writing on the drawing board with the iPad pen will lose focus and a selection box will pop up

Close vinothpandian#171
} else {
x = pointerEvent.pageX;
y = pointerEvent.pageY;
}
Copy link

Choose a reason for hiding this comment

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

wouldn't be better if it would be like this?:

let { pageX: x, pageY: y } = pointerEvent;
if(pointerEvent instanceof TouchEvent) {
  x = pointerEvent.touches[0].pageX;
  y = pointerEvent.touches[0].pageY;
}

Copy link
Author

Choose a reason for hiding this comment

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

It will get ts error Property 'pageX' does not exist on type 'TouchEvent | MouseEvent'.ts(2339);
The union type must be determined before it is used

@@ -69,3 +69,7 @@ export interface CanvasPath {
*/
readonly endTimestamp?: number;
}

export interface TouchExtends extends Touch {
touchType: "direct" | " stylus";
Copy link

Choose a reason for hiding this comment

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

" stylus" did you add the whitespace intentionally?

Copy link
Author

Choose a reason for hiding this comment

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

Done

@heruiwoniou heruiwoniou deleted the branch vinothpandian:main September 9, 2024 14:20
@heruiwoniou heruiwoniou closed this Sep 9, 2024
@heruiwoniou heruiwoniou deleted the main branch September 9, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Writing on the drawing board with the iPad pen will lose focus and a selection box will pop up
2 participants