<commit_before>angular.module('mrlapp.service.InMoov2Gui', []).controller('InMoov2GuiCtrl', ['$scope', 'mrl', function($scope, mrl) {
    console.info('InMoov2GuiCtrl')
    var _self = this
    var msg = this.msg

    let numCircularButtons = 0
    // this is circle center - it needs to be
    // dynamically calculated from size of background and radius
    let centerX = 238
    let centerY = 226
    let radius = 230

    $scope.servos = []
    $scope.sliders = []

    $scope.mrl = mrl

    // text published from InMoov2 service
    $scope.onText = null
    $scope.languageSelected = null
    $scope.speakText = null
    $scope.toggleValue = true

    $scope.activePanel = 'settings'

    $scope.speechTypes = null
    $scope.mouth = null

    $scope.selectedButton = {}

    $scope.selectedGesture = null

    // inmoov "all" buttons
    $scope.buttons = []

    // add a generalized button
    let addButton = function(name, type, x, y) {

        let button = {
            name: name,
            type: type,
            translate: "0px,0px",
            img: "../InMoov2/img/" + name + "_off.png",
            hover: "../InMoov2/img/" + name + "_hover.png"
        }

        if (type == 'absolute') {
            button.translate = x + "px," + y +"px"
        }

        if (type == 'circular') {
            numCircularButtons++
        }

        $scope.buttons.push(button)
    }

    $scope.filterPeers = function(peerName) {
        if (peerName) {
            mrl.search($scope.service.name + '.' + peerName)
        } else {
            mrl.search("")
        }
    }

    let calculatButtonPos = function() {
        let angle = 234.5 * (Math.PI / 180)
        // (360 - 90) * (Math.PI / 180)
        let dangle = (360 / numCircularButtons) * (Math.PI / 180)
        for (i = 0; i < $scope.buttons.length; i++) {
            if ($scope.buttons[i].type == 'circular') {
                angle += dangle
                // $scope.buttons[i].rotate = angle + "deg"
                let x = Math.round(centerX + radius * Math.cos(angle));
                let y = Math.round(centerY + radius * Math.sin(angle));
                $scope.buttons[i].translate = x + "px," + y + "px"
            }
        }
    }

    let buttonsOff = function() {
        for (i = 0; i < $scope.buttons.length; i++) {
            $scope.selectedButton.name = name
            $scope.selectedButton.translate = $scope.buttons[i].translate
            $scope.selectedButton.img = "../InMoov2/img/" + name + "_off.png"
        }
    }

    let buttonOn = function(name) {
        buttonsOff()
        for (i = 0; i < $scope.buttons.length; i++) {
            if ($scope.buttons[i].name == name) {
                $scope.selectedButton.name = name
                $scope.selectedButton.translate = $scope.buttons[i].translate
                $scope.selectedButton.img = "../InMoov2/img/" + name + "_on.png"
                break
            }
        }<commit_msg>Swapping buttons _on.png to _Activ.png<commit_after>angular.module('mrlapp.service.InMoov2Gui', []).controller('InMoov2GuiCtrl', ['$scope', 'mrl', function($scope, mrl) {
    console.info('InMoov2GuiCtrl')
    var _self = this
    var msg = this.msg

    let numCircularButtons = 0
    // this is circle center - it needs to be
    // dynamically calculated from size of background and radius
    let centerX = 238
    let centerY = 226
    let radius = 230

    $scope.servos = []
    $scope.sliders = []

    $scope.mrl = mrl

    // text published from InMoov2 service
    $scope.onText = null
    $scope.languageSelected = null
    $scope.speakText = null
    $scope.toggleValue = true

    $scope.activePanel = 'settings'

    $scope.speechTypes = null
    $scope.mouth = null

    $scope.selectedButton = {}

    $scope.selectedGesture = null

    // inmoov "all" buttons
    $scope.buttons = []

    // add a generalized button
    let addButton = function(name, type, x, y) {

        let button = {
            name: name,
            type: type,
            translate: "0px,0px",
            img: "../InMoov2/img/" + name + "_off.png",
            hover: "../InMoov2/img/" + name + "_hover.png"
        }

        if (type == 'absolute') {
            button.translate = x + "px," + y +"px"
        }

        if (type == 'circular') {
            numCircularButtons++
        }

        $scope.buttons.push(button)
    }

    $scope.filterPeers = function(peerName) {
        if (peerName) {
            mrl.search($scope.service.name + '.' + peerName)
        } else {
            mrl.search("")
        }
    }

    let calculatButtonPos = function() {
        let angle = 234.5 * (Math.PI / 180)
        // (360 - 90) * (Math.PI / 180)
        let dangle = (360 / numCircularButtons) * (Math.PI / 180)
        for (i = 0; i < $scope.buttons.length; i++) {
            if ($scope.buttons[i].type == 'circular') {
                angle += dangle
                // $scope.buttons[i].rotate = angle + "deg"
                let x = Math.round(centerX + radius * Math.cos(angle));
                let y = Math.round(centerY + radius * Math.sin(angle));
                $scope.buttons[i].translate = x + "px," + y + "px"
            }
        }
    }

    let buttonsOff = function() {
        for (i = 0; i < $scope.buttons.length; i++) {
            $scope.selectedButton.name = name
            $scope.selectedButton.translate = $scope.buttons[i].translate
            $scope.selectedButton.img = "../InMoov2/img/" + name + "_off.png"
        }
    }

    let buttonOn = function(name) {
        buttonsOff()
        for (i = 0; i < $scope.buttons.length; i++) {
            if ($scope.buttons[i].name == name) {
                $scope.selectedButton.name = name
                $scope.selectedButton.translate = $scope.buttons[i].translate
                $scope.selectedButton.img = "../InMoov2/img/" + name + "_Activ.png"
                break
            }
        }
{'fraction_non_alphanumeric': 0.14324233232221098, 'fraction_numerical': 0.01482979440512302, 'mean_word_length': 1.7312471237919926, 'pattern_counts': {'":': 0, '<': 9, '<?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': '2560311', 'n_tokens_mistral': 1926, 'n_tokens_neox': 1806, 'n_words': 412}