diff --git a/qt/DeviceView.cpp b/qt/DeviceView.cpp index 64dbb42b..216e85fc 100644 --- a/qt/DeviceView.cpp +++ b/qt/DeviceView.cpp @@ -347,7 +347,8 @@ void DeviceView::paintEvent(QPaintEvent * /* event */) void DeviceView::updateSelection() { selectedLeds.clear(); - selectionFlags.resize(controller->leds.size()); // Could this change? + selectionFlags.clear(); + selectionFlags.resize(controller->leds.size()); QRect sel = selectionRect.normalized(); std::vector& leds = controller->leds; @@ -368,12 +369,16 @@ void DeviceView::updateSelection() if(sel.intersects(rect)) { - selectedLeds.push_back(led_idx); selectionFlags[led_idx] = 1; } if(ctrlDown) { selectionFlags[led_idx] ^= previousFlags[led_idx]; + + if(selectionFlags[led_idx]) + { + selectedLeds.push_back(led_idx); + } } }