Source: LAF/widgets/touch_indicator.js

/**
 * Adds a indicator showing active touches
 *
 * @name Lens.LAF.TouchIndicator
 * @namespace
 */
define(["lib/jquery",   "lib/underscore", "common/util/dom_utils",
        "ARCore/embed"],
function($,              _,                DOMUtils,
         Embed) {

    "use strict";

    var enabled = true;

    var touchIndicatorDiv = $("<div class='lens-touch-indicator' />");

    var TouchIndicator = /** @lends Lens.LAF.TouchIndicator */ {
        /**
         * Enables scrollbar styling
         */
        enable: function() {
            DOMUtils.addStylesheet("LAF/widgets/touch_indicator.less");
            enabled = true;
        },

        /**
         * Disabled scrollbar styling
         */
        disable: function() {
            DOMUtils.removeStylesheet("LAF/widgets/touch_indicator.less");
            enabled = false;
        },

        /**
         * Returns true iff this LAF module is enabled
         * @return {Boolean}
         * @memberOf Lens.LAF.TouchIndicator
         */
        enabled: function() {
            return enabled;
        }
    };

    document.addEventListener("lens:touchstart", function(evt) {
        if(!enabled) {
            return;
        }

        _.each(evt.changedTouches, function(touch) {
            var indicator = touchIndicatorDiv.clone();
            indicator.appendTo(document.body)
                .css("left", touch.pageX)
                .css("top", touch.pageY)
                .on("webkitAnimationEnd", function() {
                    indicator.remove();
                });
        });
    });

    // only show touch indicators in the top-level Lens app
    if(!Embed.parentDispatcher) {
        TouchIndicator.enable();
    }
    Lens._addMember(TouchIndicator, "TouchIndicator", Lens.LAF);
    return TouchIndicator;
});