<commit_before>var ButtonFactory = (function () {
    "use strict";

    function ButtonFactory(stage, input, timer, font, playSoundCallback, primaryColor, primaryTextColor,
        primaryTextSize, primaryWidthFactor, secondaryColor, secondaryTextColor, secondaryTextSize,
        secondaryWidthFactor, zIndex) {
        this.stage = stage;
        this.input = input;
        this.font = font;
        this.playSound = playSoundCallback;
        this.timer = timer;
        this.primaryColor = primaryColor;
        this.primaryTextColor = primaryTextColor;
        this.primaryTextSize = primaryTextSize;
        this.primaryWidthFactor = primaryWidthFactor;
        this.secondaryColor = secondaryColor;
        this.secondaryTextColor = secondaryTextColor;
        this.secondaryTextSize = secondaryTextSize;
        this.secondaryWidthFactor = secondaryWidthFactor;
        this.zIndex = zIndex;
    }

    ButtonFactory.prototype.createPrimaryButton = function (xFn, yFn, msg, callback, multiSubmit) {
        function pressPrimaryButton(text, background) {
            background.alpha = 1;
        }

        function resetPrimaryButton(text, background) {
            background.alpha = 0.5;
        }

        return this.__createButton(xFn, yFn, msg, this.primaryTextSize, this.primaryColor, this.primaryTextColor, 1,
            callback, true, undefined, this.primaryWidthFactor, pressPrimaryButton, resetPrimaryButton, multiSubmit);
    };

    ButtonFactory.prototype.createSecondaryButton = function (xFn, yFn, msg, callback, multiSubmit) {
        function pressSecondaryButton(text, background) {
            text.alpha = 1;
            background.data.filled = true;
        }

        function resetSecondaryButton(text, background) {
            text.alpha = 0.5;
            background.data.filled = false;
        }

        return this.__createButton(xFn, yFn, msg, this.secondaryTextSize, this.secondaryColor, this.secondaryTextColor,
            0.5, callback, false, function () {
                return 1;
            }, this.secondaryWidthFactor, pressSecondaryButton, resetSecondaryButton, multiSubmit);
    };

    ButtonFactory.prototype.__createButton = function (xFn, yFn, msg, txtSizeFn, color, textColor, textAlpha, callback,
        backgroundFilled, lineWidthFn, widthMultiplier, pressButton, resetButton, multiSubmit) {

        var isMultiSubmitOn = multiSubmit !== undefined ? multiSubmit : false;

        var textDrawable = this.stage.drawText(xFn, yFn, msg, txtSizeFn, this.font, textColor, this.zIndex + 1,
            undefined, undefined,
            textAlpha);

        function getWidth() {
            return textDrawable.getWidth() * widthMultiplier;
        }

        function getHeight() {
            return textDrawable.getHeight() * 2;
        }

        var backgroundWrapper = this.stage.drawRectangleWithInput(xFn, yFn, getWidth, getHeight, color,
            backgroundFilled, lineWidthFn, this.zIndex, 0.5, undefined, undefined, [textDrawable]);

        var touchable = backgroundWrapper.input;
        var backgroundDrawable = backgroundWrapper.drawable;

        var returnObject = {
            text: textDrawable,
            background: backgroundDrawable,
            input: touchable,
            used: false,
            reset: true
        };

        var self = this;
        var extendedCallback = function () {
            if (!isMultiSubmitOn && returnObject.used)
                return;

            returnObject.used = true;
            pressButton(textDrawable, backgroundDrawable);
<commit_msg>button max with refs #69 #core (cherry picked from commit 05791ff)<commit_after>var ButtonFactory = (function () {
    "use strict";

    function ButtonFactory(stage, input, timer, font, playSoundCallback, primaryColor, primaryTextColor,
        primaryTextSize, primaryWidthFactor, secondaryColor, secondaryTextColor, secondaryTextSize,
        secondaryWidthFactor, zIndex) {
        this.stage = stage;
        this.input = input;
        this.font = font;
        this.playSound = playSoundCallback;
        this.timer = timer;
        this.primaryColor = primaryColor;
        this.primaryTextColor = primaryTextColor;
        this.primaryTextSize = primaryTextSize;
        this.primaryWidthFactor = primaryWidthFactor;
        this.secondaryColor = secondaryColor;
        this.secondaryTextColor = secondaryTextColor;
        this.secondaryTextSize = secondaryTextSize;
        this.secondaryWidthFactor = secondaryWidthFactor;
        this.zIndex = zIndex;
    }

    ButtonFactory.prototype.createPrimaryButton = function (xFn, yFn, msg, callback, multiSubmit) {
        function pressPrimaryButton(text, background) {
            background.alpha = 1;
        }

        function resetPrimaryButton(text, background) {
            background.alpha = 0.5;
        }

        return this.__createButton(xFn, yFn, msg, this.primaryTextSize, this.primaryColor, this.primaryTextColor, 1,
            callback, true, undefined, this.primaryWidthFactor, pressPrimaryButton, resetPrimaryButton, multiSubmit);
    };

    ButtonFactory.prototype.createSecondaryButton = function (xFn, yFn, msg, callback, multiSubmit) {
        function pressSecondaryButton(text, background) {
            text.alpha = 1;
            background.data.filled = true;
        }

        function resetSecondaryButton(text, background) {
            text.alpha = 0.5;
            background.data.filled = false;
        }

        return this.__createButton(xFn, yFn, msg, this.secondaryTextSize, this.secondaryColor, this.secondaryTextColor,
            0.5, callback, false, function () {
                return 1;
            }, this.secondaryWidthFactor, pressSecondaryButton, resetSecondaryButton, multiSubmit);
    };

    ButtonFactory.prototype.__createButton = function (xFn, yFn, msg, txtSizeFn, color, textColor, textAlpha, callback,
        backgroundFilled, lineWidthFn, widthMultiplier, pressButton, resetButton, multiSubmit) {

        var isMultiSubmitOn = multiSubmit !== undefined ? multiSubmit : false;

        var textDrawable = this.stage.drawText(xFn, yFn, msg, txtSizeFn, this.font, textColor, this.zIndex + 1,
            undefined, undefined,
            textAlpha);

        function getWidth(width) {
            var max = Width.get(10, 9)(width);
            var myWidth = textDrawable.getWidth() * widthMultiplier;
            return myWidth <= max ? myWidth : max;
        }

        function getHeight() {
            return textDrawable.getHeight() * 2;
        }

        var backgroundWrapper = this.stage.drawRectangleWithInput(xFn, yFn, getWidth, getHeight, color,
            backgroundFilled, lineWidthFn, this.zIndex, 0.5, undefined, undefined, [textDrawable]);

        var touchable = backgroundWrapper.input;
        var backgroundDrawable = backgroundWrapper.drawable;

        var returnObject = {
            text: textDrawable,
            background: backgroundDrawable,
            input: touchable,
            used: false,
            reset: true
        };

        var self = this;
        var extendedCallback = function () {
            if (!isMultiSubmitOn && returnObject.used)
                return;

            returnObject.used = true;
            pressButton(textDrawable, backgroundDrawable);

{'fraction_non_alphanumeric': 0.08610086100861009, 'fraction_numerical': 0.005193385267186005, 'mean_word_length': 2.5784841075794622, 'pattern_counts': {'":': 0, '<': 4, '<?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': '1686176', 'n_tokens_mistral': 1890, 'n_tokens_neox': 1834, 'n_words': 438}