|
|
|
@ -318,13 +318,25 @@ public class GradientBar extends AbstractComponentPopBox implements UIObserver,
|
|
|
|
|
|
|
|
|
|
private void dragAction(MouseEvent e) { |
|
|
|
|
int oldIndex = index; |
|
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
|
int size = list.size(); |
|
|
|
|
for (int i = 0; i < size; i++) { |
|
|
|
|
if (list.get(i).contains(e.getX(), e.getY())) { |
|
|
|
|
index = i; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (OperatingSystem.isLinux() && AssistUtils.equals(oldIndex, index)) { |
|
|
|
|
updateX(oldIndex, index, e); |
|
|
|
|
|
|
|
|
|
GradientBar.this.repaint(); |
|
|
|
|
if (index == 1) { |
|
|
|
|
endLabel.setText(Double.toString(p2.getX())); |
|
|
|
|
} else { |
|
|
|
|
startLabel.setText(Double.toString(p1.getX())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateX(int oldIndex, int newIndex, MouseEvent e) { |
|
|
|
|
if (OperatingSystem.isLinux() && AssistUtils.equals(oldIndex, newIndex)) { |
|
|
|
|
if (Math.abs(p1.getX() - e.getX()) > Math.abs(p2.getX() - e.getX())) { |
|
|
|
|
index = 1; |
|
|
|
|
} else { |
|
|
|
@ -335,9 +347,5 @@ public class GradientBar extends AbstractComponentPopBox implements UIObserver,
|
|
|
|
|
if (x && e.getY() < MAX_VERTICAL) { |
|
|
|
|
list.get(index).setX(e.getX()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GradientBar.this.repaint(); |
|
|
|
|
startLabel.setText(Double.toString(p1.getX())); |
|
|
|
|
endLabel.setText(Double.toString(p2.getX())); |
|
|
|
|
} |
|
|
|
|
} |