<commit_before>/* global define:true */
define([
    'experience/circle',
    'experience/responsive',
    'pixi',
    'signals',
    'gs'
], function (
    Circle,
    Responsive,
    PIXI,
    signals,
    gs
) {
    'use strict';

    var Issue = function (index, canvasSize) {
        this._index = index;
        this._canvasSize = canvasSize;
        this.elm = new PIXI.DisplayObjectContainer();

        this.mouseOverS = new signals.Signal();
        this.mouseOutS = new signals.Signal();
        this.pressS = new signals.Signal();
        this.tapS = new signals.Signal();

        this._tagStyle = {font: '400 8px "Fira Sans", sans-serif', fill: '#222222'};
        this._tagTitleStyle = {font: '400 14px "Fira Sans", sans-serif', fill: '#FFFFFF'};
        this._titleOverStyle = {font: '400 14px "Fira Sans", sans-serif', fill: '#222222'};
        this._topicStyle = {font: '200 12px "Fira Sans", sans-serif', fill: '#222222'};
        this._issuesStyle = {font: '200 20px "Fira Sans", sans-serif', fill: '#222222'};
        this._tagIssuesStyle = {font: '200 20px "Fira Sans", sans-serif', fill: '#FFFFFF'};
        this._detailStyle = {font: '400 14px "Fira Sans", sans-serif', fill: '#FFFFFF'};

        return this;
    };

    Issue.prototype = new Circle();
    Issue.prototype.constructor = Issue;

    Issue.MODE_EXPLORE = 'explore';
    Issue.MODE_TAG = 'tag';
    Issue.MODE_TAG_TITLE = 'tagTitle';
    Issue.MODE_TOPICS = 'topics';
    Issue.MODE_ISSUES = 'issues';
    Issue.MODE_TAG_ISSUES = 'tagIssues';
    Issue.MODE_DETAIL = 'detail';
    Issue.MODE_INTRO = 'intro';
    Issue.MODES = [
        Issue.MODE_EXPLORE,
        Issue.MODE_TOPICS,
        Issue.MODE_ISSUES,
        Issue.MODE_TAG_ISSUES,
        Issue.MODE_DETAIL
    ];

    Issue.prototype.setData = function (data) {
        this.mode = Issue.MODE_EXPLORE;
        Circle.prototype.setData.call(this, data);

        var colors = [0x6bb94e, 0xf6c925, 0xdb3f33];
        this.color = colors[this.data._status];

        this._textAlwaysVisible = false;
    };

    /**
     * Draws an issue circle
     * @param  {number} radius desired radius
     * @param  {number} x x position
     * @param  {number} y y position
     */
    Issue.prototype.draw = function (radius, x, y) {
        x = Math.round(x);
        y = Math.round(y);

        Circle.prototype.draw.call(this, radius, x, y);
        this.elm.interactive = true;
        this.elm.buttonMode = true;
        this.isInteractive = true;
        this.elm.index = this._index;

        var biggestSize = Math.max(this._canvasSize.x, this._canvasSize.y);
        this._openCircle = new PIXI.Graphics();
        this._openCircle.beginFill(this.color);
        this._openCircle.drawCircle(0, 0, biggestSize);
        this._openCircle.scale = {x: 0, y: 0};
        this._openCircle.endFill();
        this.elm.addChild(this._openCircle);

        this.elm.mouseover = this._onMouseOver.bind(this);
        this.elm.mouseout = this._onMouseOut.bind(this);
        this.elm.mousedown = this._onPress.bind(this);
        this.elm.tap = this._onTap.bind(this);
    };

    Issue.prototype._onMouseOver = function () {
        this.mouseOverS.dispatch(this);
    };

    Issue.prototype._onMouseOut = function () {
        this.mouseOutS.dispatch(this);
    };

    Issue.prototype._onPress = function () {
        this.pressS.dispatch(this);
    };

    Issue.prototype._onTap = function () {
        this.tapS.dispatch(this);
    };

    Issue.prototype.setMode = function (mode) {
        var lastMode = this.mode;
        this.mode = mode;

        switch (mode) {
            case Issue.MODE_EXPLORE: {
                this.setTextAlwaysVisible(false);
                this.setIsInteractive(true);
                this.setRadiusChange(true);
                this._title.setStyle(this._titleStyle);
                this._title.hitArea = new PIXI.Rectangle(
                    0,
                    0,
                    this._title.width / Responsive.RATIO,
                    this._title.height / Responsive.RATIO
                );
                this._title.y = Math.round(-(this._title.height / Responsive.RATIO) / 2);
                this._drawCircle(0x222222);
            } break;
            case Issue.MODE_TAG: {
                this.setTextAlwaysVisible(false);
                this.setIsInteractive(false);
                this.setRadiusChange(false);
                this.radius = this.initRadius;
                this._title.setStyle(this._tagStyle);
                this._title.hitArea = new PIXI.Rectangle(
                    0,
                    0,
                    this._title.width / Responsive.RATIO,
                    this._title.height / Responsive.RATIO
                );
                this._title.x = this.leftSided ? -(this._title.width * Responsive.RATIO) - 10 : 10;
                this._title.y = Math.round(-(this._title.height / Responsive.RATIO) / 2);
                this._drawCircle(0x222222);
            } break;
            case Issue.MODE_TAG_TITLE: {
                this.setTextAlwaysVisible(true);
                this.setIsInteractive(false);
                this.setRadiusChange(false);
                this.radius = this.initRadius;
                this.elm.addChild(this._tagTitle);
                var tagTitleText = this.data.getRelated().length;
                tagTitleText += ' issues related to';
                this._tagTitle.setText(tagTitleText.toUpperCase());
                this._title.setStyle(this._tagTitleStyle);
                this._title.hitArea = new PIXI.Rectangle(
                    0,
                    0,
                    this._title.width / Responsive.RATIO,
                    this._title.height / Responsive.RATIO
                );
                this._title.x = 10;
                this._title.y = Math.round(-(this._title.height / Responsive.RATIO) / 2);
                this._drawCircle(0xFFFFFF);<commit_msg>removed tag title when  going back from tag mode<commit_after>/* global define:true */
define([
    'experience/circle',
    'experience/responsive',
    'pixi',
    'signals',
    'gs'
], function (
    Circle,
    Responsive,
    PIXI,
    signals,
    gs
) {
    'use strict';

    var Issue = function (index, canvasSize) {
        this._index = index;
        this._canvasSize = canvasSize;
        this.elm = new PIXI.DisplayObjectContainer();

        this.mouseOverS = new signals.Signal();
        this.mouseOutS = new signals.Signal();
        this.pressS = new signals.Signal();
        this.tapS = new signals.Signal();

        this._tagStyle = {font: '400 8px "Fira Sans", sans-serif', fill: '#222222'};
        this._tagTitleStyle = {font: '400 14px "Fira Sans", sans-serif', fill: '#FFFFFF'};
        this._titleOverStyle = {font: '400 14px "Fira Sans", sans-serif', fill: '#222222'};
        this._topicStyle = {font: '200 12px "Fira Sans", sans-serif', fill: '#222222'};
        this._issuesStyle = {font: '200 20px "Fira Sans", sans-serif', fill: '#222222'};
        this._tagIssuesStyle = {font: '200 20px "Fira Sans", sans-serif', fill: '#FFFFFF'};
        this._detailStyle = {font: '400 14px "Fira Sans", sans-serif', fill: '#FFFFFF'};

        return this;
    };

    Issue.prototype = new Circle();
    Issue.prototype.constructor = Issue;

    Issue.MODE_EXPLORE = 'explore';
    Issue.MODE_TAG = 'tag';
    Issue.MODE_TAG_TITLE = 'tagTitle';
    Issue.MODE_TOPICS = 'topics';
    Issue.MODE_ISSUES = 'issues';
    Issue.MODE_TAG_ISSUES = 'tagIssues';
    Issue.MODE_DETAIL = 'detail';
    Issue.MODE_INTRO = 'intro';
    Issue.MODES = [
        Issue.MODE_EXPLORE,
        Issue.MODE_TOPICS,
        Issue.MODE_ISSUES,
        Issue.MODE_TAG_ISSUES,
        Issue.MODE_DETAIL
    ];

    Issue.prototype.setData = function (data) {
        this.mode = Issue.MODE_EXPLORE;
        Circle.prototype.setData.call(this, data);

        var colors = [0x6bb94e, 0xf6c925, 0xdb3f33];
        this.color = colors[this.data._status];

        this._textAlwaysVisible = false;
    };

    /**
     * Draws an issue circle
     * @param  {number} radius desired radius
     * @param  {number} x x position
     * @param  {number} y y position
     */
    Issue.prototype.draw = function (radius, x, y) {
        x = Math.round(x);
        y = Math.round(y);

        Circle.prototype.draw.call(this, radius, x, y);
        this.elm.interactive = true;
        this.elm.buttonMode = true;
        this.isInteractive = true;
        this.elm.index = this._index;

        var biggestSize = Math.max(this._canvasSize.x, this._canvasSize.y);
        this._openCircle = new PIXI.Graphics();
        this._openCircle.beginFill(this.color);
        this._openCircle.drawCircle(0, 0, biggestSize);
        this._openCircle.scale = {x: 0, y: 0};
        this._openCircle.endFill();
        this.elm.addChild(this._openCircle);

        this.elm.mouseover = this._onMouseOver.bind(this);
        this.elm.mouseout = this._onMouseOut.bind(this);
        this.elm.mousedown = this._onPress.bind(this);
        this.elm.tap = this._onTap.bind(this);
    };

    Issue.prototype._onMouseOver = function () {
        this.mouseOverS.dispatch(this);
    };

    Issue.prototype._onMouseOut = function () {
        this.mouseOutS.dispatch(this);
    };

    Issue.prototype._onPress = function () {
        this.pressS.dispatch(this);
    };

    Issue.prototype._onTap = function () {
        this.tapS.dispatch(this);
    };

    Issue.prototype.setMode = function (mode) {
        var lastMode = this.mode;
        this.mode = mode;

        switch (mode) {
            case Issue.MODE_EXPLORE: {
                this.setTextAlwaysVisible(false);
                this.setIsInteractive(true);
                this.setRadiusChange(true);
                this._title.setStyle(this._titleStyle);
                this._title.hitArea = new PIXI.Rectangle(
                    0,
                    0,
                    this._title.width / Responsive.RATIO,
                    this._title.height / Responsive.RATIO
                );
                this._title.y = Math.round(-(this._title.height / Responsive.RATIO) / 2);
                this._drawCircle(0x222222);
            } break;
            case Issue.MODE_TAG: {
                this.setTextAlwaysVisible(false);
                this.setIsInteractive(false);
                this.setRadiusChange(false);
                this.radius = this.initRadius;
                this._title.alpha = 0;
                this._title.setStyle(this._tagStyle);
                this._title.hitArea = new PIXI.Rectangle(
                    0,
                    0,
                    this._title.width / Responsive.RATIO,
                    this._title.height / Responsive.RATIO
                );
                this._title.x = this.leftSided ? -(this._title.width * Responsive.RATIO) - 10 : 10;
                this._title.y = Math.round(-(this._title.height / Responsive.RATIO) / 2);
                this._drawCircle(0x222222);
            } break;
            case Issue.MODE_TAG_TITLE: {
                this.setTextAlwaysVisible(true);
                this.setIsInteractive(false);
                this.setRadiusChange(false);
                this.radius = this.initRadius;
                this.elm.addChild(this._tagTitle);
                var tagTitleText = this.data.getRelated().length;
                tagTitleText += ' issues related to';
                this._tagTitle.setText(tagTitleText.toUpperCase());
                this._title.setStyle(this._tagTitleStyle);
                this._title.hitArea = new PIXI.Rectangle(
                    0,
                    0,
                    this._title.width / Responsive.RATIO,
                    this._title.height / Responsive.RATIO
                );
                this._title.x = 10;
                this._title.y = Math.round(-(this._title.height / Responsive.RATIO) / 2);
                this._drawCircle(0xFFFFFF);
{'fraction_non_alphanumeric': 0.12391594396264176, 'fraction_numerical': 0.01759506337558372, 'mean_word_length': 1.8439649039601613, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6517069', 'n_tokens_mistral': 3926, 'n_tokens_neox': 3582, 'n_words': 649}