<commit_before>l.touches = new Object() // Group the touch-related functions

l.touches.database = new Array() // Keep track of where we're touching on the screen

l.touches.enable = function()
{
    document.addEventListener('touchstart', function(event) { l.touches.touches(event) })
    document.addEventListener('touchmove', function(event) { l.touches.touches(event) })
    document.addEventListener('touchend', function() { l.touches.cancel() })
    document.addEventListener('touchcancel', function() { l.touches.cancel() })
}

l.touches.touches = function(event)
{
    if (event)
    {
        l.touches.database = event.touches
        l.touches.debug()
    }
}

l.touches.cancel = function(event)
{
    l.touches.database.length = 0
    l.touches.debug()
}

l.touches.touched = function(name)
{
    if (l.touches.database.length > 0)
    {
        for (var i = 0; i < l.touches.database.length; i++)
        {
            if (l.touches.database[i].pageX < l.entities[name].bounding.x + l.entities[name].bounding.width && l.touches.database[i].pageX > l.entities[name].bounding.x &&
            l.touches.database[i].pageY < l.entities[name].bounding.y + l.entities[name].bounding.height && l.touches.database[i].pageY > l.entities[name].bounding.y)
            {
                if (l.debug.all || l.debug.touches)
                {
                    console.log(name + ' was touched')
                }
                return true
                break
            }
            else
            {
                return false
            }
        }
    }
}
<commit_msg>Made touches more intuitive and less buggy.<commit_after>l.touches = new Object() // Group the touch-related functions

l.touches.database = new Array() // Keep track of where we're touching on the screen

l.touches.enable = function()
{
    document.addEventListener('touchstart', function(event) { l.touches.touches(event) })
    document.addEventListener('touchmove', function(event) { l.touches.touches(event) })
    document.addEventListener('touchend', function(event) { l.touches.touches(event) })
    document.addEventListener('touchcancel', function(event) { l.touches.touches(event) })
}

l.touches.touches = function(event)
{
    if (event)
    {
        l.touches.database = event.touches
        l.touches.debug()
    }
    else
    {
        l.touches.database.length = 0
    }
}

l.touches.touched = function(name)
{
    if (l.touches.database.length > 0)
    {
        for (var i = 0; i < l.touches.database.length; i++)
        {
            if (l.touches.database[i].pageX < l.entities[name].bounding.x + l.entities[name].bounding.width && l.touches.database[i].pageX > l.entities[name].bounding.x &&
            l.touches.database[i].pageY < l.entities[name].bounding.y + l.entities[name].bounding.height && l.touches.database[i].pageY > l.entities[name].bounding.y)
            {
                if (l.debug.all || l.debug.touches)
                {
                    console.log(name + ' was touched')
                }
                return true
                break
            }
            else
            {
                if (i == l.touches.database.length - 1)
                {
                    return false
                }
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.13906678865507777, 'fraction_numerical': 0.0021347971942665446, 'mean_word_length': 2.020257826887661, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '609421', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1070, 'n_words': 168}