<commit_before>define([
    'Underscore',
    'Easel',
    'io/snapnote/graphics/elements/Handle',
    'io/snapnote/graphics/elements/Handles'],
  function(_, Easel, Handle, Handles) {
    var ImageHandles = function() {
      this.initialize();
    }

    ImageHandles.prototype = _.extend(new Handles('rectangle.Handles'), {
    });

    var initialize =
      ImageHandles.prototype.initialize;

    ImageHandles.prototype.initialize = function() {
      initialize.call(this);

      var nwHandle = new Handle();
      nwHandle.addEventListener('move', _.bind(function(event) {
        var width = this.target.width * this.target.scale;
        var scale = (width - event.delta.x)/width;

        this.target.scale *= scale;
        this.target.x += event.delta.x;
        this.target.y += event.delta.y;
      }, this));
      this.addChild(nwHandle);

      var neHandle = new Handle();
      neHandle.addEventListener('move', _.bind(function(event) {
        var width = this.target.width * this.target.scale;
        var scale = width/(width - event.delta.x);

        this.target.scale *= scale;
        this.target.x += event.delta.x - (width * scale - width);
        this.target.y += event.delta.y;
      }, this));
      this.addChild(neHandle);

      var swHandle = new Handle();
      swHandle.addEventListener('move', _.bind(function(event) {
        var width = this.target.width * this.target.scale;
        var height = this.target.height * this.target.scale;
        var scale = (width - event.delta.x)/width;

        this.target.scale *= scale;
        this.target.x += event.delta.x;
        this.target.y += event.delta.y + (height - (height * scale));
      }, this));
      this.addChild(swHandle);

      var seHandle = new Handle();
      seHandle.addEventListener('move', _.bind(function(event) {
        var width = this.target.width * this.target.scale;
        var height = this.target.height * this.target.scale;

        var scale = (width + event.delta.x)/width;

        this.target.scale *= scale;
        this.target.y += event.delta.y + (height - (height * scale));
      }, this));
      this.addChild(seHandle);

      this.addEventListener('tick', _.bind(function(event) {
        nwHandle.x = 0;
        nwHandle.y = 0;

        neHandle.x = (this.target.width * this.target.scale) - neHandle.width;
        neHandle.y = 0;

        swHandle.x = 0;
        swHandle.y = (this.target.height * this.target.scale) - swHandle.height;

        seHandle.x = (this.target.width * this.target.scale) - seHandle.width;<commit_msg>changing image scaling. abandoning the want to keep the handle on the cursor<commit_after>define([
    'Underscore',
    'Easel',
    'io/snapnote/graphics/elements/Handle',
    'io/snapnote/graphics/elements/Handles'],
  function(_, Easel, Handle, Handles) {
    var ImageHandles = function() {
      this.initialize();
    }

    ImageHandles.prototype = _.extend(new Handles('rectangle.Handles'), {
    });

    var initialize =
      ImageHandles.prototype.initialize;

    ImageHandles.prototype.initialize = function() {
      initialize.call(this);

      var nwHandle = new Handle();
      nwHandle.addEventListener('move', _.bind(function(event) {
        var width = this.target.width * this.target.scale;
        var height = this.target.height * this.target.scale;
        var scale = (width - event.delta.x)/width;

        this.target.scale *= scale;
        this.target.x -= ((width * scale) - width) ;
        this.target.y -= ((height * scale) - height) ;
      }, this));
      this.addChild(nwHandle);

      var neHandle = new Handle();
      neHandle.addEventListener('move', _.bind(function(event) {
        var width = this.target.width * this.target.scale;
        var height = this.target.height * this.target.scale;
        var scale = width/(width - event.delta.x);

        this.target.scale *= scale;
        this.target.y -= ((height * scale) - height) ;
      }, this));
      this.addChild(neHandle);

      var swHandle = new Handle();
      swHandle.addEventListener('move', _.bind(function(event) {
        var width = this.target.width * this.target.scale;
        var height = this.target.height * this.target.scale;
        var scale = (width - event.delta.x)/width;

        this.target.scale *= scale;
        this.target.x += event.delta.x;
      }, this));
      this.addChild(swHandle);

      var seHandle = new Handle();
      seHandle.addEventListener('move', _.bind(function(event) {
        var width = this.target.width * this.target.scale;
        var scale = (width + event.delta.x)/width;
        this.target.scale *= scale;
      }, this));
      this.addChild(seHandle);

      this.addEventListener('tick', _.bind(function(event) {
        nwHandle.x = 0;
        nwHandle.y = 0;

        neHandle.x = (this.target.width * this.target.scale) - neHandle.width;
        neHandle.y = 0;

        swHandle.x = 0;
        swHandle.y = (this.target.height * this.target.scale) - swHandle.height;

        seHandle.x = (this.target.width * this.target.scale) - seHandle.width;
{'fraction_non_alphanumeric': 0.14580467675378267, 'fraction_numerical': 0.0015720180782078995, 'mean_word_length': 2.4024064171122994, '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': '1882832', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1512, 'n_words': 300}