Ctrl-held selection fix

This commit is contained in:
k1-801 2020-08-19 10:03:00 +04:00 committed by Adam Honse
parent 7977a3ef50
commit 7781b1425d

View file

@ -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<led>& 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);
}
}
}