examples/common/touch-emulator.js
function showTouches(ev) {
        var touch, i, el, styles;

        // first all visible touches
        for(i = 0; i < ev.touches.length; i++) {
            touch = ev.touches[i];
            el = touchElements[touch.identifier];
            if(!el) {
                el = touchElements[touch.identifier] = document.createElement("div");
                document.body.appendChild(el);
            }

            styles = TouchEmulator.template(touch);
            for(var prop in styles) {
                el.style[prop] = styles[prop];
            }
        }

        // remove all ended touches
        if(ev.type == 'touchend' || ev.type == 'touchcancel') {
            for(i = 0; i < ev.changedTouches.length; i++) {
                touch = ev.changedTouches[i];
                el = touchElements[touch.identifier];
                if(el) {
                    el.parentNode.removeChild(el);
                    delete touchElements[touch.identifier];
                }
            }
        }
    }
function showTouches(ev) {
        var touch, i, el, styles;

        // first all visible touches
        for(i = 0; i < ev.touches.length; i++) {
            touch = ev.touches[i];
            el = touchElements[touch.identifier];
            if(!el) {
                el = touchElements[touch.identifier] = document.createElement("div");
                document.body.appendChild(el);
            }

            styles = TouchEmulator.template(touch);
            for(var prop in styles) {
                el.style[prop] = styles[prop];
            }
        }

        // remove all ended touches
        if(ev.type == 'touchend' || ev.type == 'touchcancel') {
            for(i = 0; i < ev.changedTouches.length; i++) {
                touch = ev.changedTouches[i];
                el = touchElements[touch.identifier];
                if(el) {
                    el.parentNode.removeChild(el);
                    delete touchElements[touch.identifier];
                }
            }
        }
    }
function showTouches ( ev ) { var touch , i , el , styles ; // first all visible touches for ( i = 0 ; i < ev . touches . length ; i ++ ) { touch = ev . touches [ i ] ; el = touchElements [ touch . identifier ] ; if ( ! el ) { el = touchElements [ touch . identifier ] = document . createElement ( "div" ) ; document . body . appendChild ( el ) ; } styles = TouchEmulator . template ( touch ) ; for ( var prop in styles ) { el . style [ prop ] = styles [ prop ] ; } } // remove all ended touches if ( ev . type == 'touchend' || ev . type == 'touchcancel' ) { for ( i = 0 ; i < ev . changedTouches . length ; i ++ ) { touch = ev . changedTouches [ i ] ; el = touchElements [ touch . identifier ] ; if ( el ) { el . parentNode . removeChild ( el ) ; delete touchElements [ touch . identifier ] ; } } } }
show the touchpoints on the screen
show the touchpoints on the screen