<commit_before>define [], () ->

  class SelectionLayer

    init: (instances) ->
      @graphView = instances.GraphView
      @parent = @graphView.el
      @$parent = $(@parent)

      _.extend this, Backbone.Events
      @_intializeDragVariables()
      @render()

    render: =>
      @canvas = $('<canvas/>').addClass('selectionLayer')
                  .css('position', 'absolute')
                  .css('top', 0)
                  .css('left', 0)
                  .css('pointer-events', 'none')[0]

      @_sizeCanvas()

      @$parent.append @canvas

      @_registerEvents()

    _sizeCanvas: =>
      ctx = @canvas.getContext('2d')
      ctx.canvas.width = $(window).width()
      ctx.canvas.height = $(window).height()

    _intializeDragVariables: =>
      @dragging = false
      @startPoint =
        x: 0
        y: 0
      @prevPoint =
        x: 0
        y: 0
      @currentPoint =
        x: 0
        y: 0

    _setStartPoint: (coord) =>
      @startPoint.x = coord.x
      @startPoint.y = coord.y

    _registerEvents: =>
      $(window).resize (e) =>
        @_sizeCanvas()

      @$parent.mousedown (e) =>
        if e.shiftKey
          @dragging = true;
          _.extend @startPoint, {
            x: e.clientX
            y: e.clientY
          }
          return false;

      @$parent.mousemove (e) =>
        if e.shiftKey
          if @dragging
            _.extend @prevPoint, @currentPoint
            _.extend @currentPoint, {
              x: e.clientX
              y: e.clientY
            }
            @renderRect()
            @determineSelection()
            return false;

      @$parent.mouseup (e) =>
        @dragging = false
        @_clearRect @startPoint, @currentPoint
        _.extend @startPoint, {<commit_msg>unselect nodes on mousedown<commit_after>define [], () ->

  class SelectionLayer

    init: (instances) ->
      @graphView = instances.GraphView
      @parent = @graphView.el
      @$parent = $(@parent)

      _.extend this, Backbone.Events
      @_intializeDragVariables()
      @render()

    render: =>
      @canvas = $('<canvas/>').addClass('selectionLayer')
                  .css('position', 'absolute')
                  .css('top', 0)
                  .css('left', 0)
                  .css('pointer-events', 'none')[0]

      @_sizeCanvas()

      @$parent.append @canvas

      @_registerEvents()

    _sizeCanvas: =>
      ctx = @canvas.getContext('2d')
      ctx.canvas.width = $(window).width()
      ctx.canvas.height = $(window).height()

    _intializeDragVariables: =>
      @dragging = false
      @startPoint =
        x: 0
        y: 0
      @prevPoint =
        x: 0
        y: 0
      @currentPoint =
        x: 0
        y: 0

    _setStartPoint: (coord) =>
      @startPoint.x = coord.x
      @startPoint.y = coord.y

    _registerEvents: =>
      $(window).resize (e) =>
        @_sizeCanvas()

      @$parent.mousedown (e) =>
        if e.shiftKey
          @dragging = true;
          _.extend @startPoint, {
            x: e.clientX
            y: e.clientY
          }

          _.extend @currentPoint, {
            x: e.clientX
            y: e.clientY
          }

          return false;

      @$parent.mousemove (e) =>
        if e.shiftKey
          if @dragging
            _.extend @prevPoint, @currentPoint
            _.extend @currentPoint, {
              x: e.clientX
              y: e.clientY
            }
            @renderRect()
            @determineSelection()
            return false;

      @$parent.mouseup (e) =>
        @dragging = false
        @_clearRect @startPoint, @currentPoint
        _.extend @startPoint, {
{'fraction_non_alphanumeric': 0.13207029104887424, 'fraction_numerical': 0.0054914881933003845, 'mean_word_length': 1.496915695681974, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '6592097', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1068, 'n_words': 225}