From 7781b1425d130ef49d7aea89748bd818fc8a4698 Mon Sep 17 00:00:00 2001 From: k1-801 Date: Wed, 19 Aug 2020 10:03:00 +0400 Subject: [PATCH] Ctrl-held selection fix --- qt/DeviceView.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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); + } } }