<commit_before>var math = require('../../../lib/pixi/src/core/math'),
    EventData = require('./EventData');

function Mouse(game, preventDefault, checkFrecuency){
    this.game = game;
    this.global = new math.Point();
    this.canvas = this.game.canvas;
    this.resolution = this.game.renderer.resolution || 1;
    this.delta = 0;

    this.tempPoint = new math.Point();
    this.isEnabled = false;
    this.preventDefault = preventDefault;

    this.lastTime = 0;
    this.originalEvent = null;
    this.states = [];
    this.dirty = false;

    this.checkFrecuency = checkFrecuency || 30;

    this._onMouseDown = this._onMouseDown.bind(this);
    this._onMouseUp = this._onMouseUp.bind(this);
    this._onMouseOver = this._onMouseOver.bind(this);
    this._onMouseOut = this._onMouseOut.bind(this);
    this._onMouseMove = this._onMouseMove.bind(this);
    this._onMouseWheel = this._onMouseWheel.bind(this);

    this.stopPropagation = false;

    var evt = null;
    this.event = [];
    if('ontouchstart' in window){
        for(var i = 0; i < 10; i++){
            evt = new EventData(this, i);
            this.event.push(evt);
            this.states.push([]);
        }
    }else{
        evt = new EventData(this);
        this.event.push(evt);
        this.states.push([]);
    }

    //TODO: pixelperfect?, click, dblclick, touches, tap, doubletap
    //TODO: touch y multitouch http://www.html5rocks.com/es/mobile/touch/
}

Mouse.prototype.constructor = Mouse;

Mouse.prototype.enable = function(value){
    value = (value !== false);

    if(value&&!this.isEnabled) {
        this.isEnabled = true;
        this._enableEvents();
    }else if(!value&&this.isEnabled){
        this.isEnabled = false;
        this._disableEvents();
    }

    return this;
};

Mouse.prototype.disable = function(){
    return this.enable(false);
};

Mouse.prototype._enableEvents = function(){
    //Mouse events
    this.canvas.addEventListener('mousedown', this._onMouseDown, true);
    this.canvas.addEventListener('mousemove', this._onMouseMove, true);
    //this.canvas.addEventListener('mouseout', this._onMouseOut, true);
    //this.canvas.addEventListener('mouseover', this._onMouseOver, true);
    window.addEventListener('mouseup', this._onMouseUp, true);<commit_msg>minor update<commit_after>var math = require('../../../lib/pixi/src/core/math'),
    EventData = require('./EventData');

function Mouse(game, preventDefault, checkFrecuency){
    this.game = game;
    this.global = new math.Point();
    this.canvas = this.game.canvas;
    this.resolution = this.game.renderer.resolution || 1;
    this.delta = 0;

    this.tempPoint = new math.Point();
    this.isEnabled = false;
    this.preventDefault = preventDefault;

    this.lastTime = 0;
    this.originalEvent = null;
    this.states = [];
    this.dirty = false;

    this.checkFrecuency = checkFrecuency || 30;

    this._onMouseDown = this._onMouseDown.bind(this);
    this._onMouseUp = this._onMouseUp.bind(this);
    this._onMouseOver = this._onMouseOver.bind(this);
    this._onMouseOut = this._onMouseOut.bind(this);
    this._onMouseMove = this._onMouseMove.bind(this);
    this._onMouseWheel = this._onMouseWheel.bind(this);

    this.stopPropagation = false;

    var evt = null;
    this.event = [];
    if('ontouchstart' in window){
        for(var i = 0; i < 10; i++){
            evt = new EventData(this, i);
            this.event.push(evt);
            this.states.push([]);
        }
    }else{
        evt = new EventData(this);
        this.event.push(evt);
        this.states.push([]);
    }

    //TODO: pixelperfect?, click, dblclick, tap, doubletap?
}

Mouse.prototype.constructor = Mouse;

Mouse.prototype.enable = function(value){
    value = (value !== false);

    if(value&&!this.isEnabled) {
        this.isEnabled = true;
        this._enableEvents();
    }else if(!value&&this.isEnabled){
        this.isEnabled = false;
        this._disableEvents();
    }

    return this;
};

Mouse.prototype.disable = function(){
    return this.enable(false);
};

Mouse.prototype._enableEvents = function(){
    //Mouse events
    this.canvas.addEventListener('mousedown', this._onMouseDown, true);
    this.canvas.addEventListener('mousemove', this._onMouseMove, true);
    //this.canvas.addEventListener('mouseout', this._onMouseOut, true);
    //this.canvas.addEventListener('mouseover', this._onMouseOver, true);
    window.addEventListener('mouseup', this._onMouseUp, true);
{'fraction_non_alphanumeric': 0.1488268156424581, 'fraction_numerical': 0.003798882681564246, 'mean_word_length': 3.0035778175313057, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '4193880', 'n_tokens_mistral': 1422, 'n_tokens_neox': 1392, 'n_words': 254}