MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / OnClicked

Method OnClicked

Source/Slider.cpp:303–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303void FloatSlider::OnClicked(float x, float y, bool right)
304{
305 if (right)
306 {
307 DisplayLFOControl();
308 return;
309 }
310
311 if ((GetKeyModifiers() & kModifier_Command) && mAllowMinMaxAdjustment && !IUIControl::WasLastHoverSetManually())
312 {
313 bool adjustMax;
314 if (x > mWidth / 2)
315 adjustMax = true;
316 else
317 adjustMax = false;
318
319 if (adjustMax)
320 {
321 if (mMaxEntry != nullptr)
322 mMaxEntry->Delete();
323 mMaxEntry = new TextEntry(this, "", mX + mWidth - 5 * 9, mY, 5, &mMax, -FLT_MAX, FLT_MAX);
324 mMaxEntry->MakeActiveTextEntry(true);
325 }
326 else
327 {
328 if (mMinEntry != nullptr)
329 mMinEntry->Delete();
330 //mMinEntry = new TextEntry(this, "", mX, mY, 5, &mMin, -FLT_MAX, FLT_MAX);
331 mMinEntry = new TextEntry(this, "", mX + mWidth - 5 * 9, mY, 5, &mMin, -FLT_MAX, FLT_MAX);
332 mMinEntry->MakeActiveTextEntry(true);
333 }
334
335 return;
336 }
337
338 mFineRefX = ofMap(ValToPos(*GetModifyValue(), false), 0.0f, 1.0f, mX + 1, mX + mWidth - 1, true) - mX;
339 mRefY = y;
340 SetValueForMouse(x, y);
341 mMouseDown = true;
342 mTouching = true;
343 UpdateTouching();
344}
345
346void FloatSlider::MouseReleased()
347{

Callers

nothing calls this directly

Calls 4

GetKeyModifiersFunction · 0.85
ofMapFunction · 0.85
MakeActiveTextEntryMethod · 0.80
DeleteMethod · 0.45

Tested by

no test coverage detected