mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
add interface for HTML Touch events
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/// <reference path="touch-events.d.ts"/>
|
||||
|
||||
var touchEvent:TouchEvent;
|
||||
var list:TouchList;
|
||||
var touch:Touch;
|
||||
|
||||
list = touchEvent.touches;
|
||||
list = touchEvent.targetTouches;
|
||||
list = touchEvent.changedTouches;
|
||||
|
||||
var flag:boolean;
|
||||
flag = touchEvent.altKey;
|
||||
flag = touchEvent.metaKey;
|
||||
flag = touchEvent.ctrlKey;
|
||||
flag = touchEvent.shiftKey;
|
||||
|
||||
var len:number = list.length;
|
||||
touch = list.item(0);
|
||||
|
||||
var x: number;
|
||||
var y: number;
|
||||
var id: number;
|
||||
|
||||
id = touch.identifier;
|
||||
x = touch.screenX;
|
||||
y = touch.screenY;
|
||||
x = touch.clientX;
|
||||
y = touch.clientY;
|
||||
x = touch.pageX;
|
||||
y = touch.pageY;
|
||||
|
||||
var target:EventTarget;
|
||||
target = touch.target;
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for HTML Touch Events
|
||||
// Project: http://www.w3.org/TR/touch-events/
|
||||
// Definitions by: Kevin Barabash https://github.com/kevinb7
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface TouchEvent extends UIEvent {
|
||||
touches: TouchList;
|
||||
targetTouches: TouchList;
|
||||
changedTouches: TouchList;
|
||||
altKey: boolean;
|
||||
metaKey: boolean;
|
||||
ctrlKey: boolean;
|
||||
shiftKey: boolean;
|
||||
}
|
||||
|
||||
interface TouchList {
|
||||
length: number;
|
||||
item: (index: number) => Touch;
|
||||
}
|
||||
|
||||
interface Touch {
|
||||
identifier: number;
|
||||
target: EventTarget;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
Reference in New Issue
Block a user