<commit_before>(function(undefined){
    'use strict';
    var orignalMouseMove = L.Draw.Polyline.prototype._onMouseMove, straightline, dragging;

    window.onkeydown = function(e){
        straightline = e.ctrlKey;
    };

    window.onkeyup = function(e){
        straightline = false;
    };

    L.Draw.Polyline.prototype._onMouseMove = function(e){
        orignalMouseMove.call(this, e);

        if(!straightline || dragging) return;

        var currentMarker = getLayerOfType(L.Marker);
        if(currentMarker)
        {
            var currentPosition = currentMarker.getLatLng();
            var currentPoint = map.latLngToLayerPoint(currentPosition);

            if(isHorizontal(e.latlng, currentPosition)){
                e.layerPoint.y = currentPoint.y;
            }
            else{
                e.layerPoint.x = currentPoint.x;
            }

            this._updateGuide(e.layerPoint);
        }
    };

    L.Map.prototype.initStraightLines = function(){
        var map = this;
        map.on('dragstart', function(){
            dragging = true;
        });
        map.on('dragend', function(){
            dragging = false;
        });
        map.on('mouseup', function(e){

            setTimeout(function(){
                if(!straightline || dragging) return;

                var currentLine = getLayerOfType(L.Polyline);
                if(currentLine){
                    var latLngs = currentLine.getLatLngs();
                    var lastPosition = latLngs[latLngs.length - 1];
                    var previousPosition = latLngs[latLngs.length - 2];

                    if(isHorizontal(lastPosition, previousPosition)){
                        lastPosition.lat = previousPosition.lat;
                    }<commit_msg>Map reference needs to shared<commit_after>(function(undefined){
    'use strict';
    var orignalMouseMove = L.Draw.Polyline.prototype._onMouseMove, straightline, dragging, map;

    window.onkeydown = function(e){
        straightline = e.ctrlKey;
    };

    window.onkeyup = function(e){
        straightline = false;
    };

    L.Draw.Polyline.prototype._onMouseMove = function(e){
        orignalMouseMove.call(this, e);

        if(!straightline || dragging) return;

        var currentMarker = getLayerOfType(L.Marker);
        if(currentMarker)
        {
            var currentPosition = currentMarker.getLatLng();
            var currentPoint = map.latLngToLayerPoint(currentPosition);

            if(isHorizontal(e.latlng, currentPosition)){
                e.layerPoint.y = currentPoint.y;
            }
            else{
                e.layerPoint.x = currentPoint.x;
            }

            this._updateGuide(e.layerPoint);
        }
    };

    L.Map.prototype.initStraightLines = function(){
        map = this;
        map.on('dragstart', function(){
            dragging = true;
        });
        map.on('dragend', function(){
            dragging = false;
        });
        map.on('mouseup', function(e){

            setTimeout(function(){
                if(!straightline || dragging) return;

                var currentLine = getLayerOfType(L.Polyline);
                if(currentLine){
                    var latLngs = currentLine.getLatLngs();
                    var lastPosition = latLngs[latLngs.length - 1];
                    var previousPosition = latLngs[latLngs.length - 2];

                    if(isHorizontal(lastPosition, previousPosition)){
                        lastPosition.lat = previousPosition.lat;
                    }
{'fraction_non_alphanumeric': 0.10810047981936212, 'fraction_numerical': 0.0011289867344058708, 'mean_word_length': 1.7883556254917388, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '649196', 'n_tokens_mistral': 1002, 'n_tokens_neox': 948, 'n_words': 162}