public class LineSlider extends PointElement {

  PointElement A,B;
  double initx, inity;


  LineSlider (LineElement L, double xVal, double yVal) {
    dimension = 0;
    dragable = true;
    A = L.A;   B = L.B;
    initx = x = xVal;
    inity = y = yVal;
  }

  LineSlider (PointElement Aval, PointElement Bval, double xVal, double yVal) {
    dimension = 0;
    dragable = true;
    A = Aval;  B = Bval;
    initx = x = xVal;
    inity = y = yVal;
  }

  protected void reset() {
    x = initx; y = inity;
    toFoot(this,A,B);
  }

  protected void update() {
    if (!defined()) {
      x = initx;
      y = inity;
    }
    toFoot(this,A,B);
  }

  protected void drag (double tox, double toy) {
    x = tox; y = toy;
    toFoot(this,A,B);
  }
}
