Deselect entities with Ctrl-LMB.
In other words, Ctrl inverts the normal action of LMB. It is already possible to deselect entities through the context menu, but that can be very awkward on laptop touchpads with a crowded sketch; with Ctrl, a misclick is easily corrected without moving cursor at all.
This commit is contained in:
parent
bd84bc1ae9
commit
6352405206
@ -79,6 +79,7 @@ Other new features:
|
|||||||
* New link to match the on-screen size of the sketch with its actual size,
|
* New link to match the on-screen size of the sketch with its actual size,
|
||||||
"view → set to full scale".
|
"view → set to full scale".
|
||||||
* When zooming to fit, constraints are also considered.
|
* When zooming to fit, constraints are also considered.
|
||||||
|
* Ctrl-clicking entities now deselects them, as the inverse of clicking.
|
||||||
* When clicking on an entity that shares a place with other entities,
|
* When clicking on an entity that shares a place with other entities,
|
||||||
the entity from the current group is selected.
|
the entity from the current group is selected.
|
||||||
* When dragging an entity that shares a place with other entities,
|
* When dragging an entity that shares a place with other entities,
|
||||||
|
@ -894,7 +894,7 @@ bool GraphicsWindow::MouseEvent(Platform::MouseEvent event) {
|
|||||||
|
|
||||||
case MouseEvent::Type::PRESS:
|
case MouseEvent::Type::PRESS:
|
||||||
if(event.button == MouseEvent::Button::LEFT) {
|
if(event.button == MouseEvent::Button::LEFT) {
|
||||||
this->MouseLeftDown(event.x, event.y);
|
this->MouseLeftDown(event.x, event.y, event.shiftDown, event.controlDown);
|
||||||
} else if(event.button == MouseEvent::Button::MIDDLE ||
|
} else if(event.button == MouseEvent::Button::MIDDLE ||
|
||||||
event.button == MouseEvent::Button::RIGHT) {
|
event.button == MouseEvent::Button::RIGHT) {
|
||||||
this->MouseMiddleOrRightDown(event.x, event.y);
|
this->MouseMiddleOrRightDown(event.x, event.y);
|
||||||
@ -909,7 +909,7 @@ bool GraphicsWindow::MouseEvent(Platform::MouseEvent event) {
|
|||||||
|
|
||||||
case MouseEvent::Type::RELEASE:
|
case MouseEvent::Type::RELEASE:
|
||||||
if(event.button == MouseEvent::Button::LEFT) {
|
if(event.button == MouseEvent::Button::LEFT) {
|
||||||
this->MouseLeftUp(event.x, event.y);
|
this->MouseLeftUp(event.x, event.y, event.shiftDown, event.controlDown);
|
||||||
} else if(event.button == MouseEvent::Button::RIGHT) {
|
} else if(event.button == MouseEvent::Button::RIGHT) {
|
||||||
this->MouseRightUp(event.x, event.y);
|
this->MouseRightUp(event.x, event.y);
|
||||||
}
|
}
|
||||||
@ -927,7 +927,7 @@ bool GraphicsWindow::MouseEvent(Platform::MouseEvent event) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
void GraphicsWindow::MouseLeftDown(double mx, double my, bool shiftDown, bool ctrlDown) {
|
||||||
orig.mouseDown = true;
|
orig.mouseDown = true;
|
||||||
|
|
||||||
if(window->IsEditorVisible()) {
|
if(window->IsEditorVisible()) {
|
||||||
@ -1281,8 +1281,12 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||||||
default:
|
default:
|
||||||
ClearPending();
|
ClearPending();
|
||||||
if(!hover.IsEmpty()) {
|
if(!hover.IsEmpty()) {
|
||||||
|
if(!ctrlDown) {
|
||||||
hoverWasSelectedOnMousedown = IsSelected(&hover);
|
hoverWasSelectedOnMousedown = IsSelected(&hover);
|
||||||
MakeSelected(&hover);
|
MakeSelected(&hover);
|
||||||
|
} else {
|
||||||
|
MakeUnselected(&hover, /*coincidentPointTrick=*/true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1303,7 +1307,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsWindow::MouseLeftUp(double mx, double my) {
|
void GraphicsWindow::MouseLeftUp(double mx, double my, bool shiftDown, bool ctrlDown) {
|
||||||
orig.mouseDown = false;
|
orig.mouseDown = false;
|
||||||
hoverWasSelectedOnMousedown = false;
|
hoverWasSelectedOnMousedown = false;
|
||||||
|
|
||||||
@ -1325,7 +1329,7 @@ void GraphicsWindow::MouseLeftUp(double mx, double my) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Pending::NONE:
|
case Pending::NONE:
|
||||||
if(hover.IsEmpty()) {
|
if(hover.IsEmpty() && !ctrlDown) {
|
||||||
ClearSelection();
|
ClearSelection();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
4
src/ui.h
4
src/ui.h
@ -802,8 +802,8 @@ public:
|
|||||||
bool MouseEvent(Platform::MouseEvent event);
|
bool MouseEvent(Platform::MouseEvent event);
|
||||||
void MouseMoved(double x, double y, bool leftDown, bool middleDown,
|
void MouseMoved(double x, double y, bool leftDown, bool middleDown,
|
||||||
bool rightDown, bool shiftDown, bool ctrlDown);
|
bool rightDown, bool shiftDown, bool ctrlDown);
|
||||||
void MouseLeftDown(double x, double y);
|
void MouseLeftDown(double x, double y, bool shiftDown, bool ctrlDown);
|
||||||
void MouseLeftUp(double x, double y);
|
void MouseLeftUp(double x, double y, bool shiftDown, bool ctrlDown);
|
||||||
void MouseLeftDoubleClick(double x, double y);
|
void MouseLeftDoubleClick(double x, double y);
|
||||||
void MouseMiddleOrRightDown(double x, double y);
|
void MouseMiddleOrRightDown(double x, double y);
|
||||||
void MouseRightUp(double x, double y);
|
void MouseRightUp(double x, double y);
|
||||||
|
Loading…
Reference in New Issue
Block a user