GP-430 - Graph - fixed broken 'drag to select nodes'

This commit is contained in:
dragonmacher 2020-11-23 20:41:08 -05:00
parent d7dbcfebf5
commit 2cc6e2633e
2 changed files with 14 additions and 13 deletions

View file

@ -257,16 +257,7 @@ public class JungPickingGraphMousePlugin<V, E> extends AbstractGraphMousePlugin
@SuppressWarnings("unchecked")
public void mouseReleased(MouseEvent e) {
VisualizationViewer<V, E> vv = (VisualizationViewer<V, E>) e.getSource();
if (e.getModifiersEx() == modifiers) {
if (down != null) {
Point2D out = e.getPoint();
if (vertex == null && heyThatsTooClose(down, out, 5) == false) {
pickContainedVertices(vv, down, out, true);
}
}
}
else if (e.getModifiersEx() == this.addToSelectionModifiers) {
if (e.getModifiersEx() == this.addToSelectionModifiers) {
if (down != null) {
Point2D out = e.getPoint();
@ -275,6 +266,19 @@ public class JungPickingGraphMousePlugin<V, E> extends AbstractGraphMousePlugin
}
}
}
else {
// Mouse released without the 'add to selection' modifiers. See if we have been dragging
if (down != null) {
// check to see if we were dragging (no vertex picked and a large enough rectangle)
Point2D out = e.getPoint();
if (vertex == null && heyThatsTooClose(down, out, 5) == false) {
pickContainedVertices(vv, down, out, true);
}
}
}
down = null;
vertex = null;
edge = null;

View file

@ -151,9 +151,6 @@ public class VisualGraphPickingGraphMousePlugin<V extends VisualVertex, E extend
@Override
public void mouseReleased(MouseEvent e) {
if (!checkModifiers(e)) {
return;
}
// We overrode this method here to clear the picked state of edges and vertices if we
// ever get a released event when the user is clicking somewhere that is not an edge or