iframe-touch-relay
Advanced tools
@@ -0,4 +1,9 @@ | ||
interface AttachRelayOptions { | ||
debug: boolean; | ||
decodeCoordinates: (element: HTMLElement, x: number, y: number) => { clientX: number, clientY: number } | ||
} | ||
export function attachTouchRelay(): void; | ||
export function detachTouchRelay(): void; | ||
export function attachRelayToPage(my_zones: any): void; | ||
export function attachRelayToPage(my_zones: any, options?: Partial<AttachRelayOptions>): void; | ||
export function detachRelayToPage(): void; |
30
index.js
@@ -192,2 +192,3 @@ | ||
export function attachTouchRelay(options) { | ||
options = options || {}; | ||
debug = options.debug || false; | ||
@@ -203,15 +204,18 @@ decodeCoordinatesWorker = options.decodeCoordinates || decodeCoordinates; | ||
let overlay; | ||
export function attachRelayToPage(my_zones) { | ||
const box = document.createElement("div"); | ||
box.style.position = "fixed"; | ||
box.style.width = "100%"; | ||
box.style.height = "100%"; | ||
box.style.zIndex = "1000"; | ||
document.body.insertBefore(box, document.body.children[0]); | ||
box.addEventListener("touchstart", handleStart, false); | ||
box.addEventListener("touchend", handleEnd, false); | ||
box.addEventListener("touchcancel", handleCancel, false); | ||
box.addEventListener("touchmove", handleMove, false); | ||
zones = my_zones; | ||
overlay = box; | ||
export function attachRelayToPage(my_zones, options) { | ||
options = options || {}; | ||
debug = options.debug || false; | ||
decodeCoordinatesWorker = options.decodeCoordinates || decodeCoordinates; | ||
const box = document.createElement("div"); | ||
box.style.position = "fixed"; | ||
box.style.width = "100%"; | ||
box.style.height = "100%"; | ||
box.style.zIndex = "1000"; | ||
document.body.insertBefore(box, document.body.children[0]); | ||
box.addEventListener("touchstart", handleStart, false); | ||
box.addEventListener("touchend", handleEnd, false); | ||
box.addEventListener("touchcancel", handleCancel, false); | ||
box.addEventListener("touchmove", handleMove, false); | ||
zones = my_zones; | ||
overlay = box; | ||
} | ||
@@ -218,0 +222,0 @@ |
{ | ||
"name": "iframe-touch-relay", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Relays touch events inside iframe, to support multi-touch on pages with multiple iframes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
9499
4.25%223
3.72%5
-16.67%