<commit_before>window.multigraph.util.namespace("window.multigraph.graphics.canvas", function (ns) {
    "use strict";

    var $ = window.multigraph.jQuery;

    ns.mixin.add(function (ns) {

        ns.Multigraph.hasA("canvas");  // canvas object itself (the '<canvas>' tag itself)
        ns.Multigraph.hasA("context"); // canvas context object
        ns.Multigraph.hasA("width").which.isA("number");
        ns.Multigraph.hasA("height").which.isA("number");

        ns.Multigraph.respondsTo("redraw", function () {
            var that = this;
            window.requestAnimationFrame(function () {
                that.render();
            });
        });

        ns.Multigraph.respondsTo("init", function () {
            this.width($(this.div()).width());
            this.height($(this.div()).height());
            if (this.width() > 0 && this.height() > 0) {
                // create the canvas
                $("<canvas width=\""+this.width()+"\" height=\""+this.height()+"\"/>")
                    .appendTo($(this.div()));

                this.initializeSurface();

                this.busySpinner($('<div style="position: absolute; left:5px; top:5px;"></div>') .
                                  appendTo($(this.div())) .
                                  busy_spinner());
            }
            this.render();
        });

        ns.Multigraph.respondsTo("render", function () {
            var i;
            this.context().setTransform(1, 0, 0, 1, 0, 0);
            this.context().transform(1,0,0,-1,0,this.height());
            this.context().clearRect(0, 0, this.width(), this.height());
            this.initializeGeometry(this.width(), this.height(), {"context" : this.context()});
            for (i=0; i<this.graphs().size(); ++i) {
                this.graphs().at(i).render(this.context(), this.width(), this.height());
            }
        });

        ns.Multigraph.respondsTo("registerEvents", function () {
            this.registerMouseEvents(this.canvas());
            this.registerTouchEvents(this.canvas());
        });

        ns.Multigraph.respondsTo("resizeSurface", function (width, height) {
            this.context().canvas.width  = width;
            this.context().canvas.height = height;
        });

        ns.Multigraph.respondsTo("initializeSurface", function () {<commit_msg>Changed busySpinner div style to center the spinner in the parent div.<commit_after>window.multigraph.util.namespace("window.multigraph.graphics.canvas", function (ns) {
    "use strict";

    var $ = window.multigraph.jQuery;

    ns.mixin.add(function (ns) {

        ns.Multigraph.hasA("canvas");  // canvas object itself (the '<canvas>' tag itself)
        ns.Multigraph.hasA("context"); // canvas context object
        ns.Multigraph.hasA("width").which.isA("number");
        ns.Multigraph.hasA("height").which.isA("number");

        ns.Multigraph.respondsTo("redraw", function () {
            var that = this;
            window.requestAnimationFrame(function () {
                that.render();
            });
        });

        ns.Multigraph.respondsTo("init", function () {
            this.width($(this.div()).width());
            this.height($(this.div()).height());
            if (this.width() > 0 && this.height() > 0) {
                // create the canvas
                $("<canvas width=\""+this.width()+"\" height=\""+this.height()+"\"/>")
                    .appendTo($(this.div()));

                this.initializeSurface();

                this.busySpinner($('<div style="position:absolute;top:50%;left:50%;margin-top:-16px;margin-left:-16px"></div>') .
                                  appendTo($(this.div())) .
                                  busy_spinner());
            }
            this.render();
        });

        ns.Multigraph.respondsTo("render", function () {
            var i;
            this.context().setTransform(1, 0, 0, 1, 0, 0);
            this.context().transform(1,0,0,-1,0,this.height());
            this.context().clearRect(0, 0, this.width(), this.height());
            this.initializeGeometry(this.width(), this.height(), {"context" : this.context()});
            for (i=0; i<this.graphs().size(); ++i) {
                this.graphs().at(i).render(this.context(), this.width(), this.height());
            }
        });

        ns.Multigraph.respondsTo("registerEvents", function () {
            this.registerMouseEvents(this.canvas());
            this.registerTouchEvents(this.canvas());
        });

        ns.Multigraph.respondsTo("resizeSurface", function (width, height) {
            this.context().canvas.width  = width;
            this.context().canvas.height = height;
        });

        ns.Multigraph.respondsTo("initializeSurface", function () {
{'fraction_non_alphanumeric': 0.1785414920368818, 'fraction_numerical': 0.008801341156747695, 'mean_word_length': 2.0018867924528303, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '952636', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1295, 'n_words': 198}