Skip to content

Commit 2c31ed7

Browse files
committed
Add TODO to drag when not selecting anything
1 parent 7c26f77 commit 2c31ed7

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/painttools/tools/SelectTool.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,15 @@ public void mouseExited(MouseEvent e) {
166166
@Override
167167
public void mouseDragged(MouseEvent e) {
168168

169-
//do nothing if dragged empty
170-
if(!canDrag) return;
171-
// if it is the first time in our move, and only one selected before the
172-
// start of dragging, i.e. two items selected after mouse press
173-
if (!moved && !movingComponentOriginallySelected) {
174-
if (selectedComponents.size() == 2) {
175-
//deselect the bottom component
169+
// do nothing if dragged empty
170+
// TODO GROUP SELECTION WHEN CANNOT DRAG
171+
if (!canDrag)
172+
return;
173+
// if it is the first time in our move, and the moving component is not
174+
// originally selected, deselect all bottom components
175+
if (!moved && !movingComponentOriginallySelected) {
176+
// deselect the bottom components, by removing all until
177+
while (selectedComponents.size() != 1) {
176178
deselectComponent(selectedComponents.get(0));
177179
}
178180
}
@@ -203,7 +205,7 @@ public void mouseDragged(MouseEvent e) {
203205

204206
@Override
205207
public void mouseMoved(MouseEvent e) {
206-
208+
207209
// shows a left arrow if cursor hits something
208210
PaintComponent comp = panel.componentUnderPoint(e.getX(), e.getY());
209211
if (comp != null) {

0 commit comments

Comments
 (0)