<commit_before>angular.module('npact')
  .directive('npactGraphContainer', function() {
    'use strict';
    return {
      restrict: 'A',
      scope: true,
      controller: 'npactGraphContainerCtrl as ctrl'
    };
  })
  .controller('npactGraphContainerCtrl', function($scope, $element, $window, $log, $timeout,
                                           npactConstants, Utils, GraphConfig, Evt,
                                           GraphingCalculator) {
    'use strict';
    var $win = angular.element($window),
        getWidth =  function() { return $element.width(); },
        baseOpts = {
          width: null,
          m: null,
          tracks: null,
          onDragMove: function (dx) {
          $scope.$broadcast('offset', dx);
          },
          onDragEnd: function (dx) {
          $scope.$evalAsync(function () {
            GraphConfig.offset += dx;
            $log.log("Finished dragging, new offset is", GraphConfig.offset);
          });
          },
          onRegionSelected: function (data) { $scope.$emit('region-selected', data); },
          onOrfSelected: function (data) {  $scope.$emit('ORF-selected', data); },
          onHitSelected: function (data) {  $scope.$emit('hit-selected', data); }
        },
        updateMetrics = function () {
          baseOpts.width = getWidth();
          baseOpts.m = GraphingCalculator.chart(baseOpts);
          $scope.graphHeight = baseOpts.m.height;
        },
        redraw = function () { $scope.$broadcast(Evt.REDRAW); };

    $scope.baseOpts = baseOpts;
    this.winHeight = $win.height();

    var onResize = _.throttle(_.bind(function () {
      this.winHeight = $win.height();
      if(getWidth() !== baseOpts.width) {
        updateMetrics();
        redraw();
      }
      $scope.$applyAsync();
    }, this), 1000/30);
    $win.on('resize', onResize);
    $scope.$on('$destroy', function () { $win.off('resize', onResize); });
    $timeout(onResize, 100);

    $scope.$watch(function () { return GraphConfig.basesPerGraph; }, updateMetrics);
    $scope.$watchCollection(GraphConfig.activeTracks, function (val, old) {
      //Find headers and headerY<commit_msg>Make sure the offset gets rounded when dragging<commit_after>angular.module('npact')
  .directive('npactGraphContainer', function() {
    'use strict';
    return {
      restrict: 'A',
      scope: true,
      controller: 'npactGraphContainerCtrl as ctrl'
    };
  })
  .controller('npactGraphContainerCtrl', function($scope, $element, $window, $log, $timeout,
                                           npactConstants, Utils, GraphConfig, Evt,
                                           GraphingCalculator) {
    'use strict';
    var $win = angular.element($window),
        getWidth =  function() { return $element.width(); },
        baseOpts = {
          width: null,
          m: null,
          tracks: null,
          onDragMove: function (dx) {
          $scope.$broadcast('offset', dx);
          },
          onDragEnd: function (dx) {
            $scope.$evalAsync(function () {
              GraphConfig.offset += Math.round(dx);
              $log.log("Finished dragging, new offset is", GraphConfig.offset);
          });
          },
          onRegionSelected: function (data) { $scope.$emit('region-selected', data); },
          onOrfSelected: function (data) {  $scope.$emit('ORF-selected', data); },
          onHitSelected: function (data) {  $scope.$emit('hit-selected', data); }
        },
        updateMetrics = function () {
          baseOpts.width = getWidth();
          baseOpts.m = GraphingCalculator.chart(baseOpts);
          $scope.graphHeight = baseOpts.m.height;
        },
        redraw = function () { $scope.$broadcast(Evt.REDRAW); };

    $scope.baseOpts = baseOpts;
    this.winHeight = $win.height();

    var onResize = _.throttle(_.bind(function () {
      this.winHeight = $win.height();
      if(getWidth() !== baseOpts.width) {
        updateMetrics();
        redraw();
      }
      $scope.$applyAsync();
    }, this), 1000/30);
    $win.on('resize', onResize);
    $scope.$on('$destroy', function () { $win.off('resize', onResize); });
    $timeout(onResize, 100);

    $scope.$watch(function () { return GraphConfig.basesPerGraph; }, updateMetrics);
    $scope.$watchCollection(GraphConfig.activeTracks, function (val, old) {
      //Find headers and headerY
{'fraction_non_alphanumeric': 0.15112025605852766, 'fraction_numerical': 0.00411522633744856, 'mean_word_length': 2.2479584261321457, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7581720', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1247, 'n_words': 246}