public void dragTo(double x){
     if (Math.abs(x-getAendPosition()) < Math.abs(x-getBendPosition()) ){  // A end is closer
       if (a_end!=null)
         detachAend();
       aLoosePosition=x;
     }else {
       if (b_end!=null)
         detachBend();
       bLoosePosition=x;
     }
   }