Make components align in ObjComponent and reset more things when resetting rotation

pull/170/head
James Ball 2023-07-05 18:14:04 +01:00
rodzic 40537cbe55
commit 3db0a94254
3 zmienionych plików z 25 dodań i 0 usunięć

Wyświetl plik

@ -63,10 +63,24 @@ ObjComponent::ObjComponent(OscirenderAudioProcessor& p, OscirenderAudioProcessor
addAndMakeVisible(mouseRotate);
resetRotation.onClick = [this] {
fixedRotateX->setToggleState(false, juce::NotificationType::dontSendNotification);
fixedRotateY->setToggleState(false, juce::NotificationType::dontSendNotification);
fixedRotateZ->setToggleState(false, juce::NotificationType::dontSendNotification);
rotateX.slider.setValue(0);
rotateY.slider.setValue(0);
rotateZ.slider.setValue(0);
rotateSpeed.slider.setValue(0);
mouseRotate.setToggleState(false, juce::NotificationType::dontSendNotification);
juce::SpinLock::ScopedLockType lock(audioProcessor.parsersLock);
audioProcessor.currentRotateX.setValue(0);
audioProcessor.currentRotateY.setValue(0);
audioProcessor.currentRotateZ.setValue(0);
audioProcessor.currentRotateX.apply();
audioProcessor.currentRotateY.apply();
audioProcessor.currentRotateZ.apply();
};
auto doc = juce::XmlDocument::parse(BinaryData::fixed_rotate_svg);
@ -129,6 +143,10 @@ void ObjComponent::resized() {
rotateZ.setBounds(area.removeFromTop(rowHeight));
rotateSpeed.setBounds(area.removeFromTop(rowHeight));
// TODO this is a bit of a hack
focalLength.setRightPadding(25);
rotateSpeed.setRightPadding(25);
area.removeFromTop(10);
auto row = area.removeFromTop(rowHeight);
resetRotation.setBounds(row.removeFromLeft(120));

Wyświetl plik

@ -33,6 +33,7 @@ void EffectComponent::resized() {
auto sliderRight = getWidth() - 140;
auto bounds = getLocalBounds();
bounds.removeFromRight(10);
bounds.removeFromRight(rightPadding);
for (auto& component : components) {
component->setBounds(bounds.removeFromRight(25));
@ -61,6 +62,10 @@ void EffectComponent::addComponent(std::shared_ptr<juce::Component> component) {
addAndMakeVisible(component.get());
}
void EffectComponent::setRightPadding(double padding) {
rightPadding = padding;
}
void EffectComponent::setCheckboxVisible(bool visible) {
checkboxVisible = visible;
}

Wyświetl plik

@ -16,6 +16,7 @@ public:
void setCheckboxVisible(bool visible);
void addComponent(std::shared_ptr<juce::Component> component);
void setRightPadding(double padding);
juce::Slider slider;
juce::String id;
@ -27,6 +28,7 @@ private:
bool checkboxVisible = true;
juce::Rectangle<int> textBounds;
std::vector<std::shared_ptr<juce::Component>> components;
double rightPadding = 0;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(EffectComponent)
};