<commit_before>(function ($) {
    "use strict";
    /**
     * @param {ol.layer.Vector} layer
     * @param {Mapbender.Digitizer.DigitizingControlFactory} controlFactory
     *
     * @constructor
     */
    Mapbender.Digitizer.FeatureEditor = function(layer, controlFactory) {
        this.layer = layer;
        this.controlFactory = controlFactory;
        this.activeInteraction = null;
    };

    Object.assign(Mapbender.Digitizer.FeatureEditor.prototype, {
        registerSchemaEvents: function(schema) {
            this.layer.getSource().on(ol.source.VectorEventType.ADDFEATURE, function (event) {
                var feature = event.feature;

                feature.on('Digitizer.ModifyFeature', function (event) {

                    if (schema.deactivateControlAfterModification) {
                        toolSet.activeInteraction && toolSet.activeInteraction.setActive(false);
                        toolSet.activeInteraction = null;
                    }

                    feature.changed();

                });
            });

            $(schema).on("Digitizer.StartFeatureSave",function(event){
                toolSet.activeInteraction.setActive(false);
            });

            $(schema).on("Digitizer.EndFeatureSave",function(event){
                toolSet.activeInteraction.setActive(true);
            });
        }
    });

    Mapbender.Digitizer.Toolset = function (schema) {

        var toolSet = this;
        toolSet.schema = schema;

        toolSet.buttons = schema.toolset;

        toolSet.element = $("<div />").addClass('digitizing-tool-set').addClass('left');
        toolSet.createToolbar();


    };

    Mapbender.Digitizer.Toolset.prototype = {


        createPlainControlButton_: function (rawButton) {
            var toolSet = this;

            var schema = toolSet.schema;
            var geomType = schema.getGeomType();

            var $button = $("<button class='button' type='button'/>");

            $button.addClass(rawButton.type);

            $button.attr('title', Mapbender.trans('mb.digitizer.toolset.' + geomType + '.' + rawButton.type));<commit_msg>Extract toolset pause / resume methods<commit_after>(function ($) {
    "use strict";
    /**
     * @param {ol.layer.Vector} layer
     * @param {Mapbender.Digitizer.DigitizingControlFactory} controlFactory
     *
     * @constructor
     */
    Mapbender.Digitizer.FeatureEditor = function(layer, controlFactory) {
        this.layer = layer;
        this.controlFactory = controlFactory;
        this.activeInteraction = null;
        this.paused_ = false;
    };

    Object.assign(Mapbender.Digitizer.FeatureEditor.prototype, {
        pause: function() {
            if (!this.paused_ && this.activeInteraction && this.activeInteraction.getActive()) {
                this.activeInteraction.setActive(false);
                this.paused_ = true;
            }
        },
        resume: function() {
            if (this.paused_ && this.activeInteraction) {
                this.activeInteraction.setActive(true);
            }
            this.paused_ = false;
        },
        registerSchemaEvents: function(schema) {
            var editor = this;
            this.layer.getSource().on(ol.source.VectorEventType.ADDFEATURE, function (event) {
                var feature = event.feature;

                feature.on('Digitizer.ModifyFeature', function (event) {

                    if (schema.deactivateControlAfterModification) {
                        toolSet.activeInteraction && toolSet.activeInteraction.setActive(false);
                        toolSet.activeInteraction = null;
                    }

                    feature.changed();

                });
            });

            $(schema).on("Digitizer.StartFeatureSave",function(event){
                editor.pause();
            });

            $(schema).on("Digitizer.EndFeatureSave",function(event){
                editor.resume();
            });
        }
    });

    Mapbender.Digitizer.Toolset = function (schema) {

        var toolSet = this;
        toolSet.schema = schema;

        toolSet.buttons = schema.toolset;

        toolSet.element = $("<div />").addClass('digitizing-tool-set').addClass('left');
        toolSet.createToolbar();


    };

    Mapbender.Digitizer.Toolset.prototype = {


        createPlainControlButton_: function (rawButton) {
            var toolSet = this;

            var schema = toolSet.schema;
            var geomType = schema.getGeomType();

            var $button = $("<button class='button' type='button'/>");

            $button.addClass(rawButton.type);

            $button.attr('title', Mapbender.trans('mb.digitizer.toolset.' + geomType + '.' + rawButton.type));
{'fraction_non_alphanumeric': 0.12315166877904521, 'fraction_numerical': 0.0, 'mean_word_length': 1.9649342517219788, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5801862', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1237, 'n_words': 183}