MCPcopy Create free account
hub / github.com/jerryuhoo/Fire / mouseDrag

Method mouseDrag

Source/GUI/ModulatableSlider.cpp:180–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180void ModulatableSlider::mouseDrag(const juce::MouseEvent& event)
181{
182 // CRITICAL: Only forward the drag event to the base class if our flag is set
183 if (isDraggingMainSlider)
184 {
185 if (onMainDragMove)
186 onMainDragMove(this);
187 juce::Slider::mouseDrag(event);
188 }
189 else if (isModHandleMouseDown)
190 {
191 auto diff = event.getPosition() - event.getMouseDownPosition();
192
193 // Use the initial amount for a more stable drag interaction
194 auto newAmount = initialLfoAmount - diff.y * 0.005;
195
196 // Allow amount to be from -1.0 to 1.0
197 lfoAmount = juce::jlimit(-1.0, 1.0, newAmount);
198
199 // If the callback is set, call it to notify the processor
200 if (onModAmountChanged)
201 {
202 onModAmountChanged(lfoAmount);
203 }
204
205 if (onModDragMove)
206 onModDragMove(this);
207
208 // This will update the UI
209 repaint();
210 }
211}
212
213void ModulatableSlider::mouseUp(const juce::MouseEvent& event)
214{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected