<commit_before>class SelectionManager {
  static var mSelectedDrawables:Array=new Array();
  static var isDragging:Boolean=false;
  static var sMaxDepth:Number=16383;
  var mSelectBox:Sprite=null;
  var mMousePressPos:Point;

  function SelectionManager(mc:MovieClip) {
     var sm:SelectionManager=this;
     mc.mouseDown=function():Void {
       sm.mMousePressPos=new Point(_root._xmouse,_root._ymouse)
       if (SelectionManager.mSelectedDrawables.size()&& !Drawable.isDragMode()) {
         SelectionManager.mSelectedDrawables[0].onPress();
       }else {
         sm.mSelectBox=new Sprite(mc,SelectionManager.sMaxDepth);
         sm.mSelectBox.setPosition(sm.mMousePressPos);
       }
     };
     mc.mouseUp=function():Void {
        var endPoint:Point=new Point(_root._xmouse,_root._ymouse);
        if (Point.distance(sm.mMousePressPos)<Drawable.sMinimumDrawDistance) {
            SelectionManager.selectItem(endPoint);
        }else if (sm.mSelectBox) {
            SelectionManager.selectRegion(sm.mMousePressPos,endPoint);
            sm.mSelectBox.remove();
        }
        sm.mMousePressPos=null;
        sm.mSelectBox=null;
     }
     mc.onMouseMove=function() {
       if (sm.mSelectBox) {
        var boxColor=0x3f3f3f;
        sm.mSelectBox.clear();
        var worldPos=new Point(_root._xmouse,_root._ymouse);
        sm.mSelectBox.drawBoxOutline(new Point(0,0),
                              sm.mSelectBox.worldToLocal(new Point(_root._xmouse,_root._ymouse)),
                              1,
                              boxColor,
                              100,
                              boxColor,
                              25);
         
       }
     }
  }
  static function selectItem(where:Point){

  }
  static function selectRegion(topLeft:Point,bottomRight:Point) {
     
  }
  static function addToSelected(drawable:Drawable):Void {
    if (drawable.getSelectedIndex()==-1) {
      drawable.setSelectedIndex(mSelectedDrawables.push(drawable)-1);
      dragDrawable(drawable);<commit_msg>more selection stuff<commit_after>class SelectionManager {
  static var mSelectedDrawables:Array=new Array();
  static var isDragging:Boolean=false;
  static var sMaxDepth:Number=16383;
  var mSelectBox:Sprite=null;
  var mMousePressPos:Point;

  function SelectionManager(mc:MovieClip) {
     var sm:SelectionManager=this;
     mc.mouseDown=function():Void {
       sm.mMousePressPos=new Point(_root._xmouse,_root._ymouse)
       if (SelectionManager.mSelectedDrawables.size()&& !Drawable.isDragMode()) {
         SelectionManager.mSelectedDrawables[0].onPress();
       }else {
         sm.mSelectBox=new Sprite(mc,SelectionManager.sMaxDepth);
         sm.mSelectBox.setPosition(sm.mMousePressPos);
       }
     };
     mc.mouseUp=function():Void {
        var endPoint:Point=new Point(_root._xmouse,_root._ymouse);
        if (Point.distance(sm.mMousePressPos)<Drawable.sMinimumDrawDistance) {
            SelectionManager.selectItem(endPoint);
        }else if (sm.mSelectBox) {
            SelectionManager.selectRegion(sm.mMousePressPos,endPoint);
            sm.mSelectBox.remove();
        }
        sm.mMousePressPos=null;
        sm.mSelectBox=null;
     }
     mc.onMouseMove=function() {
       if (sm.mSelectBox) {
        var boxColor=0x3f3f3f;
        sm.mSelectBox.clear();
        var worldPos=new Point(_root._xmouse,_root._ymouse);
        sm.mSelectBox.drawBoxOutline(new Point(0,0),
                              sm.mSelectBox.worldToLocal(new Point(_root._xmouse,_root._ymouse)),
                              1,
                              boxColor,
                              100,
                              boxColor,
                              25);
         
       }
     }
  }
  static function selectItem(where:Point){
    var i:Number;
    for ( i=0;i<mSelectedDrawables.size();++i) {
      if(mSelectedDrawables[i].within(where)) {
        //mSelectedDrawable[i]
      }
    }
  }
  static function selectRegion(topLeft:Point,bottomRight:Point) {
    var region:Rect=new Rect(topLeft,bottomRight);
    var i:Number;
    for ( i=0;i<mSelectedDrawables.size();++i) {
      if(mSelectedDrawables[i].withinShape(region)) {
        //mSelectedDrawables[i]
      }
    }
     
  }
  static function addToSelected(drawable:Drawable):Void {
    if (drawable.getSelectedIndex()==-1) {
      drawable.setSelectedIndex(mSelectedDrawables.push(drawable)-1);
      dragDrawable(drawable);
{'fraction_non_alphanumeric': 0.11056179775280899, 'fraction_numerical': 0.00943820224719101, 'mean_word_length': 2.4159631619339983, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7533989', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1337, 'n_words': 168}