<commit_before>'use strict';

angular.module('emuwebApp')
  .directive('ssffTrack', function (ConfigProviderService, viewState) {
    return {
      templateUrl: 'views/ssffTrack.html',
      restrict: 'E',
      link: function postLink(scope, element, attrs) {
        // select the needed DOM elements from the template
        var canvasLength = element.find('canvas').length;
        var ssffCanvas = element.find('canvas')[1];
        var markupCanvas = element.find('canvas')[canvasLength - 1];
        // var context = canvas0.getContext('2d');
        var markupCtx = markupCanvas.getContext('2d');

        var trackName;

        attrs.$observe('trackName', function (val) {
          if (val) {
            trackName = val;
          }
        });


        scope.order = attrs.order;

        scope.enlargeCanvas = {
          'height': 100 / ConfigProviderService.vals.perspectives[viewState.curPerspectiveIdx].signalCanvases.order.length + '%'
        };

        scope.$watch('vs.curPerspectiveIdx', function () {
          scope.updateCSS();
        }, true);
        
        
        scope.redraw = function () {
          drawSsffTrackMarkup(true);
          scope.updateCSS();
        };
        

        scope.$watch('vs.curViewPort', function () {
          if (!$.isEmptyObject(scope.shs)) {
            if (!$.isEmptyObject(scope.shs.wavJSO)) {
              drawSsffTrackMarkup(true);
              scope.updateCSS();
            }
          }
        }, true);

        scope.$watch('ssffds.data.length', function () {
          if (!$.isEmptyObject(scope.shs)) {
            if (!$.isEmptyObject(scope.shs.wavJSO)) {
              drawSsffTrackMarkup(true);
              scope.updateCSS();
            }
          }
        }, true);

        /**
         *
         */
        scope.updateCSS = function () {
          var parts = ConfigProviderService.vals.perspectives[viewState.curPerspectiveIdx].signalCanvases.order.length;
          if (viewState.getenlarge() === -1) {
            scope.enlargeCanvas = {
              'height': 100 / parts + '%'
            };
          } else {
            if (viewState.getenlarge() === scope.order) {
              scope.enlargeCanvas = {
                'height': 3 * 100 / (parts + 2) + '%'
              };
            } else {
              scope.enlargeCanvas = {
                'height': 100 / (parts + 2) + '%'
              };
            }
          }<commit_msg>also drawing moving boundary on ssffTrack<commit_after>'use strict';

angular.module('emuwebApp')
  .directive('ssffTrack', function (ConfigProviderService, viewState) {
    return {
      templateUrl: 'views/ssffTrack.html',
      restrict: 'E',
      link: function postLink(scope, element, attrs) {
        // select the needed DOM elements from the template
        var canvasLength = element.find('canvas').length;
        var ssffCanvas = element.find('canvas')[1];
        var markupCanvas = element.find('canvas')[canvasLength - 1];
        // var context = canvas0.getContext('2d');
        var markupCtx = markupCanvas.getContext('2d');

        var trackName;

        attrs.$observe('trackName', function (val) {
          if (val) {
            trackName = val;
          }
        });


        scope.order = attrs.order;

        scope.enlargeCanvas = {
          'height': 100 / ConfigProviderService.vals.perspectives[viewState.curPerspectiveIdx].signalCanvases.order.length + '%'
        };

        
        
        
        /////////////////////
        // watches

        scope.$watch('vs.curPerspectiveIdx', function () {
          scope.updateCSS();
        }, true);

        scope.$watch('vs.curViewPort', function () {
          if (!$.isEmptyObject(scope.shs)) {
            if (!$.isEmptyObject(scope.shs.wavJSO)) {
              drawSsffTrackMarkup();
              // scope.updateCSS();
            }
          }
        }, true);

        scope.$watch('ssffds.data.length', function () {
          if (!$.isEmptyObject(scope.shs)) {
            if (!$.isEmptyObject(scope.shs.wavJSO)) {
              drawSsffTrackMarkup();
              scope.updateCSS();
            }
          }
        }, true);

        scope.$watch('vs.movingBoundary', function () {
          if (!$.isEmptyObject(scope.shs)) {
            if (!$.isEmptyObject(scope.shs.wavJSO)) {
              drawSsffTrackMarkup();
            }
          }
        }, true);


        scope.$watch('vs.movingBoundarySample', function () {
          if (!$.isEmptyObject(scope.shs)) {
            if (!$.isEmptyObject(scope.shs.wavJSO)) {
              drawSsffTrackMarkup();
            }
          }
        }, true);


        //
        /////////////////////
        
        scope.redraw = function () {
          drawSsffTrackMarkup();
          scope.updateCSS();
        };
        
        /**
         *
         */
        scope.updateCSS = function () {
          var parts = ConfigProviderService.vals.perspectives[viewState.curPerspectiveIdx].signalCanvases.order.length;
          if (viewState.getenlarge() === -1) {
            scope.enlargeCanvas = {
              'height': 100 / parts + '%'
            };
          } else {
            if (viewState.getenlarge() === scope.order) {
              scope.enlargeCanvas = {
                'height': 3 * 100 / (parts + 2) + '%'
              };
            } else {
              scope.enlargeCanvas = {
                'height': 100 / (parts + 2) + '%'
              };
            }
          }
{'fraction_non_alphanumeric': 0.14456956047947694, 'fraction_numerical': 0.007628042135851798, 'mean_word_length': 1.5389580451821117, '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': '346972', 'n_tokens_mistral': 1562, 'n_tokens_neox': 1505, 'n_words': 242}