src/ui/canvas.cpp

changeset 52
eee644f88e93
parent 51
1a9eac27698d
child 55
cb81ecb5fb23
--- a/src/ui/canvas.cpp	Fri Feb 07 23:59:06 2020 +0200
+++ b/src/ui/canvas.cpp	Sat Feb 08 00:08:57 2020 +0200
@@ -13,6 +13,7 @@
 
 void Canvas::handleSelectionChange(const QSet<ldraw::Id>& selectedIds, const QSet<ldraw::Id>& deselectedIds)
 {
+	Q_ASSERT(not selectedIds.contains(ldraw::NULL_ID));
 	this->selection.subtract(deselectedIds);
 	this->selection.unite(selectedIds);
 	this->compiler->setSelectedObjects(this->selection);
@@ -40,7 +41,14 @@
 {
 	if (this->totalMouseMove < (2.0 / sqrt(2)) * 5.0)
 	{
-		this->selection = {this->highlighted};
+		if (this->highlighted == ldraw::NULL_ID)
+		{
+			this->selection = {};
+		}
+		else
+		{
+			this->selection = {this->highlighted};
+		}
 		this->compiler->setSelectedObjects(this->selection);
 		emit selectionChanged(this->selection);
 		this->update();

mercurial