Skip to content

Commit

Permalink
fix: cast type instead of global namespace (#773)
Browse files Browse the repository at this point in the history
Co-authored-by: Michel Gabriel <mg@triarc-labs.com>
  • Loading branch information
HackingMinion and Michel Gabriel authored Jun 10, 2024
1 parent d5a72a5 commit caf901b
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/signature_pad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ import { BasicPoint, Point } from './point';
import { SignatureEventTarget } from './signature_event_target';
import { throttle } from './throttle';

declare global {
interface CSSStyleDeclaration {
msTouchAction: string | null;
}
}

export interface SignatureEvent {
event: MouseEvent | TouchEvent | PointerEvent;
type: string;
Expand Down Expand Up @@ -193,7 +187,7 @@ export default class SignaturePad extends SignatureEventTarget {
public on(): void {
// Disable panning/zooming when touching canvas element
this.canvas.style.touchAction = 'none';
this.canvas.style.msTouchAction = 'none';
(this.canvas.style as CSSStyleDeclaration & { msTouchAction: string | null }).msTouchAction = 'none';
this.canvas.style.userSelect = 'none';

const isIOS =
Expand All @@ -217,7 +211,7 @@ export default class SignaturePad extends SignatureEventTarget {
public off(): void {
// Enable panning/zooming when touching canvas element
this.canvas.style.touchAction = 'auto';
this.canvas.style.msTouchAction = 'auto';
(this.canvas.style as CSSStyleDeclaration & { msTouchAction: string | null }).msTouchAction = 'auto';
this.canvas.style.userSelect = 'auto';

this.canvas.removeEventListener('pointerdown', this._handlePointerDown);
Expand Down

0 comments on commit caf901b

Please sign in to comment.