<commit_before>var Paper = React.createClass({
  mouseDown: function(event) {
    this.isDragging = true;
    this.clickX = event.pageX;
    this.clickY = event.pageY;
    console.log('down');
  },

  mouseUp: function(event) {
    this.isDragging = false;
  },

  mouseMove: function(event) {
    if (this.isDragging) {
      var dx = this.clickX - event.pageX;
      var dy = this.clickY - event.pageY;
      this.paperX = (this.paperX || -5000) - dx;
      this.paperY = (this.paperY || -3000) - dy;
      var paper = document.querySelector('.paper');
      var matrix = 'matrix(1, 0, 0, 1, ' + this.paperX.toFixed() + ', ' +
          this.paperY.toFixed()  + ')';
      paper.style.webkitTransform = matrix;

      this.clickX = event.pageX;
      this.clickY = event.pageY;
    }
  },

  render: function() {
    return (
      <div className="paper"
        onMouseDown={this.mouseDown}
        onMouseUp={this.mouseUp}
        onMouseMove={this.mouseMove}>
        <h1>Hello</h1>
      </div>
    );
  }
});<commit_msg>feat: add bounds checking to paper<commit_after>var Paper = React.createClass({
  mouseDown: function(event) {
    this.isDragging = true;
    this.clickX = event.pageX;
    this.clickY = event.pageY;
    console.log('down');
  },

  mouseUp: function(event) {
    this.isDragging = false;
  },

  mouseMove: function(event) {
    if (this.isDragging) {
      var dx = this.clickX - event.pageX;
      var dy = this.clickY - event.pageY;

      if (this.paperX === undefined) this.paperX = -5000;
      if (this.paperY === undefined) this.paperY = -3000;

      this.paperX = Math.abs((this.paperX) - dx);
      this.paperX = Math.min(10000 - document.body.offsetWidth,
          Math.max(0, this.paperX)) * -1;
      this.paperY = Math.abs((this.paperY) - dy);
      this.paperY = Math.min(6000 - document.body.offsetHeight,
          Math.max(0, this.paperY)) * -1;

      var paper = document.querySelector('.paper');
      var matrix = 'matrix(1, 0, 0, 1, ' + this.paperX.toFixed() + ', ' +
          this.paperY.toFixed()  + ')';
      paper.style.webkitTransform = matrix;

      this.clickX = event.pageX;
      this.clickY = event.pageY;
    }
  },

  render: function() {
    return (
      <div className="paper"
        onMouseDown={this.mouseDown}
        onMouseUp={this.mouseUp}
        onMouseMove={this.mouseMove}>
        <h1>Hello</h1>
      </div>
    );
  }
});
{'fraction_non_alphanumeric': 0.15822259136212624, 'fraction_numerical': 0.0170265780730897, 'mean_word_length': 2.3504867872044506, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1646622', 'n_tokens_mistral': 867, 'n_tokens_neox': 830, 'n_words': 151}