<commit_before>BR.NogoAreas = L.Control.extend({
    options: {
        shortcut: {
            draw: {
                enable: 78, // char code for 'n'
                disable: 27, // char code for 'ESC'
            },
        },
    },

    statics: {
        MSG_BUTTON: 'Draw no-go area (circle)',
        MSG_BUTTON_CANCEL: 'Cancel drawing no-go area',
        MSG_CREATE: 'Click and drag to draw circle',
        MSG_DISABLED: 'Click to edit',
        MSG_ENABLED:
            '&square; = move / resize, <span class="fa fa-trash-o"></span> = delete,<br>click nogo to quit editing',
        STATE_CREATE: 'no-go-create',
        STATE_CANCEL: 'cancel-no-go-create',
    },

    style: {
        color: '#f06eaa',
        weight: 4,
        opacity: 0.5,
        fillColor: null, //same as color by default
        fillOpacity: 0.2,
        dashArray: null,
    },

    editStyle: {
        color: '#fe57a1',
        opacity: 0.6,
        dashArray: '10, 10',
        fillOpacity: 0.1,
    },

    polylineOptions: {
        smoothFactor: 0.5,
    },

    initialize: function () {
        this._wasRouteDrawing = false;
    },

    onAdd: function (map) {
        var self = this;

        $('#submitNogos').on('click', L.bind(this.uploadNogos, this));

        this.drawnItems = new L.FeatureGroup().addTo(map);
        this.drawnItems.on('click', function (e) {
            L.DomEvent.stop(e);
            e.layer.toggleEdit();
        });

        var editTools = (this.editTools = map.editTools = new BR.Editable(map, {
            circleEditorClass: BR.DeletableCircleEditor,
            // FeatureGroup instead of LayerGroup to propagate events to members
            editLayer: new L.FeatureGroup().addTo(map),
            featuresLayer: this.drawnItems,
        }));

        this.startDrawing = function (control) {
            // initial radius of 0 to detect click, see DeletableCircleEditor.onDrawingMouseUp
            var opts = L.extend({ radius: 0 }, self.style);
            editTools.startCircle(null, opts);

            control.state('cancel-no-go-create');
        };

        this.stopDrawing = function (control) {
            editTools.stopDrawing();
            control.state('no-go-create');
        };

        this.button = L.easyButton({
            states: [
                {
                    stateName: BR.NogoAreas.STATE_CREATE,
                    icon: 'fa-ban',
                    title: BR.NogoAreas.MSG_BUTTON,
                    onClick: this.startDrawing,
                },
                {
                    stateName: BR.NogoAreas.STATE_CANCEL,
                    icon: 'fa-ban active',
                    title: BR.NogoAreas.MSG_BUTTON_CANCEL,
                    onClick: this.stopDrawing,
                },
            ],
        });

        // prevent instant re-activate when turning off button by both Pointer and Click
        // events firing in Chrome mobile while L.Map.Tap enabled for circle drawing
        L.DomEvent.addListener(this.button.button, 'pointerdown', L.DomEvent.stop);

        L.DomEvent.addListener(document, 'keydown', this._keydownListener, this);

        this.editTools.on(
            'editable:drawing:end',
            function (e) {
                self.button.state(BR.NogoAreas.STATE_CREATE);

                setTimeout(
                    L.bind(function () {
                        // turn editing off after create; async to still fire 'editable:vertex:dragend'
                        e.layer.disableEdit();
                    }, this),
                    0
                );
            },
            this
        );

        this.editTools.on(
            'editable:vertex:dragend editable:deleted',
            function (e) {
                this._fireUpdate();
            },
            this
        );

        this.editTools.on(
            'editable:enable',
            function (e) {
                e.layer.setStyle(this.editStyle);
            },
            this
        );
        this.editTools.on(
            'editable:disable',
            function (e) {
                e.layer.setStyle(this.style);
            },
            this
        );

        this.tooltip = new BR.EditingTooltip(map, editTools, this.button);
        this.tooltip.enable();
<commit_msg>Handle editable:vertex:deleted event<commit_after>BR.NogoAreas = L.Control.extend({
    options: {
        shortcut: {
            draw: {
                enable: 78, // char code for 'n'
                disable: 27, // char code for 'ESC'
            },
        },
    },

    statics: {
        MSG_BUTTON: 'Draw no-go area (circle)',
        MSG_BUTTON_CANCEL: 'Cancel drawing no-go area',
        MSG_CREATE: 'Click and drag to draw circle',
        MSG_DISABLED: 'Click to edit',
        MSG_ENABLED:
            '&square; = move / resize, <span class="fa fa-trash-o"></span> = delete,<br>click nogo to quit editing',
        STATE_CREATE: 'no-go-create',
        STATE_CANCEL: 'cancel-no-go-create',
    },

    style: {
        color: '#f06eaa',
        weight: 4,
        opacity: 0.5,
        fillColor: null, //same as color by default
        fillOpacity: 0.2,
        dashArray: null,
    },

    editStyle: {
        color: '#fe57a1',
        opacity: 0.6,
        dashArray: '10, 10',
        fillOpacity: 0.1,
    },

    polylineOptions: {
        smoothFactor: 0.5,
    },

    initialize: function () {
        this._wasRouteDrawing = false;
    },

    onAdd: function (map) {
        var self = this;

        $('#submitNogos').on('click', L.bind(this.uploadNogos, this));

        this.drawnItems = new L.FeatureGroup().addTo(map);
        this.drawnItems.on('click', function (e) {
            L.DomEvent.stop(e);
            e.layer.toggleEdit();
        });

        var editTools = (this.editTools = map.editTools = new BR.Editable(map, {
            circleEditorClass: BR.DeletableCircleEditor,
            // FeatureGroup instead of LayerGroup to propagate events to members
            editLayer: new L.FeatureGroup().addTo(map),
            featuresLayer: this.drawnItems,
        }));

        this.startDrawing = function (control) {
            // initial radius of 0 to detect click, see DeletableCircleEditor.onDrawingMouseUp
            var opts = L.extend({ radius: 0 }, self.style);
            editTools.startCircle(null, opts);

            control.state('cancel-no-go-create');
        };

        this.stopDrawing = function (control) {
            editTools.stopDrawing();
            control.state('no-go-create');
        };

        this.button = L.easyButton({
            states: [
                {
                    stateName: BR.NogoAreas.STATE_CREATE,
                    icon: 'fa-ban',
                    title: BR.NogoAreas.MSG_BUTTON,
                    onClick: this.startDrawing,
                },
                {
                    stateName: BR.NogoAreas.STATE_CANCEL,
                    icon: 'fa-ban active',
                    title: BR.NogoAreas.MSG_BUTTON_CANCEL,
                    onClick: this.stopDrawing,
                },
            ],
        });

        // prevent instant re-activate when turning off button by both Pointer and Click
        // events firing in Chrome mobile while L.Map.Tap enabled for circle drawing
        L.DomEvent.addListener(this.button.button, 'pointerdown', L.DomEvent.stop);

        L.DomEvent.addListener(document, 'keydown', this._keydownListener, this);

        this.editTools.on(
            'editable:drawing:end',
            function (e) {
                self.button.state(BR.NogoAreas.STATE_CREATE);

                setTimeout(
                    L.bind(function () {
                        // turn editing off after create; async to still fire 'editable:vertex:dragend'
                        e.layer.disableEdit();
                    }, this),
                    0
                );
            },
            this
        );

        this.editTools.on(
            'editable:vertex:dragend editable:vertex:deleted editable:deleted',
            function (e) {
                this._fireUpdate();
            },
            this
        );

        this.editTools.on(
            'editable:enable',
            function (e) {
                e.layer.setStyle(this.editStyle);
            },
            this
        );
        this.editTools.on(
            'editable:disable',
            function (e) {
                e.layer.setStyle(this.style);
            },
            this
        );

        this.tooltip = new BR.EditingTooltip(map, editTools, this.button);
        this.tooltip.enable();

{'fraction_non_alphanumeric': 0.11455072463768116, 'fraction_numerical': 0.006260869565217392, 'mean_word_length': 1.4519613416714041, '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': '2845205', 'n_tokens_mistral': 2506, 'n_tokens_neox': 2383, 'n_words': 505}