added NaN check on pinch event (#476)

This commit is contained in:
Tony Li 2021-12-31 04:42:56 -05:00 committed by GitHub
parent bc37947d5e
commit e7a2f5d6d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,6 +77,7 @@ export abstract class BaseTool<T extends string = any> extends TDEventHandler {
onPinch: TLPinchEventHandler = (info, e) => {
if (this.status !== 'pinching') return
if (isNaN(info.delta[0]) || isNaN(info.delta[1])) return
this.app.pinchZoom(info.point, info.delta, info.delta[2])
this.onPointerMove?.(info, e as unknown as React.PointerEvent)
}