private void movePoint(java.awt.event.MouseEvent e) {
if ((envelope != null) && (!envelope.isLocked())) {
int lx = e.getX();
int ly = e.getY();
EnvelopeView envelopeView = new EnvelopeView(envelopePanel);
double x = (double) Tools.FTOI(((double) lx + envelopeView.getEnvelopeXTrans())
/ envelopeView.getEnvelopeXScale());
double y = ((double) ly + envelopeView.getEnvelopeYTrans())
/ envelopeView.getEnvelopeYScale();
if (envelope.getSelectedIdx() > 0) {
double xc;
xc = envelope.getX()[envelope.getSelectedIdx() - 1];
if (x <= xc)
x = xc + 1.0;
}
if (envelope.getSelectedIdx() < (envelope.size() - 1)) {
double xc;
xc = envelope.getX()[envelope.getSelectedIdx() + 1];
if (x >= xc)
x = xc - 1.0;
}
if (lx <= envelopeView.getEnvelopeLeft()) {
// int xi = Tools.FTOI(x);
int xi = envelope.getViewXMin() - 1;
if (xi < -100)
xi = -100;
envelope.setViewXMin(xi);
envelope.getX()[envelope.getSelectedIdx()] = xi;
envelope.getY()[envelope.getSelectedIdx()] = y;
notifyValueChange(envelope.getSelectedIdx(), xi, y);
refreshXMinField();
refreshXField();
refreshYField();
envelopePanel.repaint();
}
else if (lx >= envelopeView.getEnvelopeRight()) {
// int xi = Tools.FTOI(x);
int xi = envelope.getViewXMax() + 1;
if (xi > 99999)
xi = 99999;
envelope.setViewXMax(xi);
envelope.getX()[envelope.getSelectedIdx()] = xi;
envelope.getY()[envelope.getSelectedIdx()] = y;
notifyValueChange(envelope.getSelectedIdx(), xi, y);
refreshXMaxField();
refreshXField();
refreshYField();
envelopePanel.repaint();
}
else if (ly <= envelopeView.getEnvelopeTop()) {
int xi = Tools.FTOI(x);
y = envelope.getViewYMax() + 1.0;
if (y > 32000.0)
y = 32000.0;
envelope.setViewYMax(y);
envelope.getX()[envelope.getSelectedIdx()] = xi;
envelope.getY()[envelope.getSelectedIdx()] = y;
notifyValueChange(envelope.getSelectedIdx(), xi, y);
refreshYMaxField();
refreshXField();
refreshYField();
envelopePanel.repaint();
}
else if (ly >= envelopeView.getEnvelopeBottom()) {
int xi = Tools.FTOI(x);
y = envelope.getViewYMin() - 1.0;
if (y < -32000.0)
y = -32000.0;
envelope.setViewYMin(y);