handle touch

by Darby Rathbone

HTML

<span>adfs</span>
    <br /><span>asdf</span>

CSS

span{
    outline:solid black 1px;
    position:absolute;
}

JavaScript

var handle = function () {
    var a = [];
    return {
        Start: function (b) {
            b.preventDefault(), /*console.log(b),*/
            [].forEach.call(b.changedTouches, function (b) {
                a[b.identifier] = [{
                    toString: function () {
                        return "[" + this.x + "," + this.y + ", target : " + b.target + "]";
                    },
                    t: Number(Date.now()),
                    x: parseFloat(b.pageX),
                    y: parseFloat(b.pageY),
                    target: b.target
                }] //console.log("start " + b.identifier + " : ", a[b.identifier].join())
            });
        },
        End: function (b) {
            b.preventDefault(), [].forEach.call(b.changedTouches, function (b) {

                //console.log("end " + b.identifier + " : ", a[b.identifier].join()),
                var t = a[b.identifier][a[b.identifier].length - 1];
                t.target.style.transform = '';
                t.target.style.top = parseFloat(t.target.getBoundingClientRect().top) + parseFloat(a[b.identifier][0].y)+"px";
                t.target.style.left = parseFloat(t.target.getBoundingClientRect().left) + parseFloat(a[b.identifier][0].x)+"px";
                console.log(t.target.style.top,t.target.getBoundingClientRect().left);
                a[b.identifier] = []
                })
            },
            Cancel: function (b) {
                b.preventDefault(), [].forEach.call(b.changedTouches, function (b) {
                    // console.log("cancel " + b.identifier + " : ", a[b.identifier].join()), 
                    a[b.identifier] = [];
                })
            },
            Move: function (b) {
                b.preventDefault(), [].forEach.call(b.changedTouches, function (b) {
                    //console.log(a[b.identifier][0]);
                    a[b.identifier].unshift({
                        toString: function () {
                           ...