fix: fix pinch to zoom (#6544)

* fix: fix pinch to zoom

* chore: format
This commit is contained in:
Maribeth Bottorff
2022-10-13 18:05:42 -07:00
committed by Christopher Allen
parent a7bff66dc0
commit 5cdcd02580
3 changed files with 103 additions and 7 deletions

View File

@@ -158,20 +158,20 @@ export function shouldHandleEvent(e: Event|PseudoEvent): boolean {
* Get the touch identifier from the given event. If it was a mouse event, the
* identifier is the string 'mouse'.
*
* @param e Mouse event or touch event.
* @returns The touch identifier from the first changed touch, if defined.
* Otherwise 'mouse'.
* @param e Pointer event, mouse event, or touch event.
* @returns The pointerId, or touch identifier from the first changed touch, if
* defined. Otherwise 'mouse'.
* @alias Blockly.Touch.getTouchIdentifierFromEvent
*/
export function getTouchIdentifierFromEvent(e: Event|PseudoEvent): string {
if (e instanceof MouseEvent) {
return 'mouse';
}
if (e instanceof PointerEvent) {
return String(e.pointerId);
}
if (e instanceof MouseEvent) {
return 'mouse';
}
/**
* TODO(#6097): Fix types. This is a catch-all for everything but mouse
* and pointer events.