Skip to content

Commit

Permalink
fix(button panel): use previous lasso num to determine the first sele…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
zsliu98 committed Jan 25, 2025
1 parent 1e621e5 commit 2464e1a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace zlPanel {
zlInterface::UIBase &base)
: uiBase(base),
gridPanel(base) {
juce::ignoreUnused(parameters);
juce::ignoreUnused(parameters, parametersNA);
setInterceptsMouseClicks(false, true);
setOpaque(true);
addAndMakeVisible(gridPanel);
Expand All @@ -29,7 +29,6 @@ namespace zlPanel {
}

void BackgroundPanel::resized() {
auto bound = getLocalBounds().toFloat();
gridPanel.setBounds(getLocalBounds());
}
}
4 changes: 3 additions & 1 deletion source/panel/curve_panel/button_panel/button_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ namespace zlPanel {
}

itemsSet.deselectAll();
previousLassoNum = 0;
lassoComponent.setColour(juce::LassoComponent<size_t>::lassoFillColourId,
uiBase.getTextColor().withMultipliedAlpha(.25f));
lassoComponent.setColour(juce::LassoComponent<size_t>::lassoOutlineColourId,
Expand Down Expand Up @@ -482,11 +483,12 @@ namespace zlPanel {
panels[idx]->repaint();
}
}
if (currentSelectedNum == 1 && currentFirstSelectIdx != static_cast<int>(selectBandIdx.load())) {
if (previousLassoNum == 0 && currentSelectedNum > 0 && currentFirstSelectIdx != static_cast<int>(selectBandIdx.load())) {
auto *para = parametersNARef.getParameter(zlState::selectedBandIdx::ID);
para->beginChangeGesture();
para->setValueNotifyingHost(zlState::selectedBandIdx::convertTo01(currentFirstSelectIdx));
para->endChangeGesture();
previousLassoNum = currentSelectedNum;
}
loadPreviousParameters();
}
Expand Down
1 change: 1 addition & 0 deletions source/panel/curve_panel/button_panel/button_panel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ namespace zlPanel {

juce::LassoComponent<size_t> lassoComponent;
juce::SelectedItemSet<size_t> itemsSet;
int previousLassoNum{0};
std::atomic<bool> isLeftClick{true};
std::array<std::atomic<float>, zlState::bandNUM> previousFreqs{}, previousGains{}, previousQs{};

Expand Down

0 comments on commit 2464e1a

Please sign in to comment.