<commit_before><!DOCTYPE html>
<html>
  <head>
    <title>Button Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="../../../Element.js"></script>
    <script type="text/javascript" src="../../../UI.js"></script>
    <script type="text/javascript" src="../../../Button.js"></script>
    <script type="text/javascript" src="../../../wrappers/CanvasDraw.js"></script>
  </head>
  <body>
    <canvas id="plugin" width="300" height="300"></canvas>
    <script type="text/javascript">

        // This should fix "console not defined" problem.
        if (typeof console=="undefined"){console={log:function(A){var B=false;if(B){alert(A)}}}}
        var ui;

        /* INIT */

        var plugin_canvas = document.getElementById("plugin");
        var plugin_context = plugin_canvas.getContext("2d");

        ui = new UI (plugin_canvas);

        var imageDisplayer1 = new CanvasDrawImage (plugin_context);
        var imageDisplayer2 = new CanvasDrawImage (plugin_context);

        /* BUTTON 1 */

        //var button1_img_array = ["button0_1.png", "button0_2.png"];

        //Button
        var button1Args = {
            images : ["button1_1.png", "button1_2.png"]
        };
        button1Args.onValueSet = function () {
            var that = this;
            return function (slot, value) {
                console.log ("onValueSet Button 1 callback: slot is ", slot, " and value is ", value, " while that is ", that);
            };
        }();
        var button1 = new Button("test_button_1", [0, 0], button1Args);

        /* BUTTON 2 */

        //var button1_img_array = ["button0_1.png", "button0_2.png"];

        //Button
        var button2Args = {
            images : ["button2_1.png", "button2_2.png"]
        };
        button2Args.onValueSet = function () {
            var that = this;
            return function (slot, value) {
                console.log ("onValueSet Button 2 callback: slot is ", slot, " and value is ", value, " while that is ", that);
            };
        }();
        var button2 = new Button("test_button_2", [50, 50], button2Args);

        /* ADD UI */
        ui.addElement(button1, imageDisplayer1, {zIndex: 0});
        ui.addElement(button2, imageDisplayer2, {zIndex: 1});
        button1.setValue("buttonvalue", 0);
        button2.setValue("buttonvalue", 0);


    </script>
  </body>
</html><commit_msg>Added a knob to the test. Closes #17<commit_after><!DOCTYPE html>
<html>
  <head>
    <title>Button Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="../../../Element.js"></script>
    <script type="text/javascript" src="../../../UI.js"></script>
    <script type="text/javascript" src="../../../Button.js"></script>
    <script type="text/javascript" src="../../../Knob.js"></script>
    <script type="text/javascript" src="../../../wrappers/CanvasDraw.js"></script>
  </head>
  <body>
    <canvas id="plugin" width="300" height="300"></canvas>
    <script type="text/javascript">

        // This should fix "console not defined" problem.
        if (typeof console=="undefined"){console={log:function(A){var B=false;if(B){alert(A)}}}}
        var ui;

        /* INIT */

        var plugin_canvas = document.getElementById("plugin");
        var plugin_context = plugin_canvas.getContext("2d");

        ui = new UI (plugin_canvas);

        var imageDisplayer1 = new CanvasDrawImage (plugin_context);
        var imageDisplayer2 = new CanvasDrawImage (plugin_context);
        var imageDisplayerKnob = new CanvasDrawImage (plugin_context);

        /* BUTTON 1 */

        //var button1_img_array = ["button0_1.png", "button0_2.png"];

        //Button
        var button1Args = {
            images : ["button1_1.png", "button1_2.png"]
        };
        button1Args.onValueSet = function () {
            var that = this;
            return function (slot, value) {
                console.log ("onValueSet Button 1 callback: slot is ", slot, " and value is ", value, " while that is ", that);
            };
        }();
        var button1 = new Button("test_button_1", [0, 0], button1Args);

        /* BUTTON 2 */

        //var button1_img_array = ["button0_1.png", "button0_2.png"];

        //Button
        var button2Args = {
            images : ["button2_1.png", "button2_2.png"]
        };
        button2Args.onValueSet = function () {
            var that = this;
            return function (slot, value) {
                console.log ("onValueSet Button 2 callback: slot is ", slot, " and value is ", value, " while that is ", that);
            };
        }();
        var button2 = new Button("test_button_2", [50, 50], button2Args);


        // KNOB

        var MAX_KNOB_IMAGE_NUM = 60,
            knobImgLocation = "../../../../demos/voron/images/BigKnob/",
            knobImgArray = [],
            knobArgs;

        // Shared arguments to the Knob constructor.
        (function () {
            for (var i = 0; i <= MAX_KNOB_IMAGE_NUM; i++) {
                var prefix = "";
                if (i < 10) {
                    prefix = "0";
                }
                knobImgArray[i] = knobImgLocation + "BigKnob" + prefix + i + ".png";
            }
        }());

        knobArgs = {
            // onValueSet = undefined,
            images : knobImgArray,
            sensivity : 5000,
            onComplete: this.loadCallback,
            preserveBg: true
        };
        //onValueSet = undefined
        var knob = new Knob("knob", [30, 30], knobArgs);

        /* ADD UI */
        ui.addElement(button1, imageDisplayer1, {zIndex: 0});
        ui.addElement(button2, imageDisplayer2, {zIndex: 5});
        ui.addElement(knob, imageDisplayerKnob , {zIndex: 10});
        button1.setValue("buttonvalue", 0);
        button2.setValue("buttonvalue", 0);
        knob.setValue("knobvalue", 0);


    </script>
  </body>
</html>
{'fraction_non_alphanumeric': 0.1596259809651027, 'fraction_numerical': 0.022541325763900485, 'mean_word_length': 2.0796915167095116, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 49, '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': '4736010', 'n_tokens_mistral': 1854, 'n_tokens_neox': 1749, 'n_words': 413}