src/ui/canvas.cpp

changeset 107
02f142b399b1
parent 106
128efb9d148b
child 108
94c92c923713
equal deleted inserted replaced
106:128efb9d148b 107:02f142b399b1
89 89
90 void Canvas::mouseReleaseEvent(QMouseEvent* event) 90 void Canvas::mouseReleaseEvent(QMouseEvent* event)
91 { 91 {
92 if (this->totalMouseMove < (2.0 / sqrt(2)) * 5.0) 92 if (this->totalMouseMove < (2.0 / sqrt(2)) * 5.0)
93 { 93 {
94 if (this->highlighted == ldraw::NULL_ID)
95 {
96 this->selection = {};
97 }
98 else
99 {
100 this->selection = {this->highlighted};
101 }
102 this->compiler->setSelectedObjects(this->selection);
103 emit selectionChanged(this->selection);
104 this->update();
105 MouseClickInfo info; 94 MouseClickInfo info;
106 info.worldPosition = this->worldPosition; 95 info.worldPosition = this->worldPosition;
107 info.invoker = this; 96 info.invoker = this;
108 emit mouseClick(info); 97 emit mouseClick(info);
109 } 98 }
295 284
296 Canvas::PreviewLayer& Canvas::modifyPreviewLayer(PreviewLayerName name) 285 Canvas::PreviewLayer& Canvas::modifyPreviewLayer(PreviewLayerName name)
297 { 286 {
298 return previewLayers[static_cast<unsigned int>(name)]; 287 return previewLayers[static_cast<unsigned int>(name)];
299 } 288 }
289
290 void Canvas::clearSelection()
291 {
292 this->selection.clear();
293 this->compiler->setSelectedObjects(this->selection);
294 emit selectionChanged(this->selection);
295 this->update();
296 }
297
298 void Canvas::addToSelection(ldraw::id_t id)
299 {
300 this->selection.insert(id);
301 this->compiler->setSelectedObjects(this->selection);
302 emit selectionChanged(this->selection);
303 this->update();
304 }

mercurial