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

Method MouseReleased

Source/PatchCable.cpp:455–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455void PatchCable::MouseReleased()
456{
457 if (mDragging)
458 {
459 ofVec2f mousePos(TheSynth->GetRawMouseX(), TheSynth->GetRawMouseY());
460 if ((mousePos - mGrabPos).distanceSquared() > 3)
461 {
462 IClickable* target = GetDropTarget();
463 if (target)
464 mOwner->SetPatchCableTarget(this, target, true);
465
466 Release();
467
468 if (target == nullptr)
469 {
470 if ((CableDropBehavior)UserPrefs.cable_drop_behavior.GetIndex() == CableDropBehavior::ShowQuickspawn)
471 {
472 if (GetConnectionType() == kConnectionType_Note || GetConnectionType() == kConnectionType_Audio || GetConnectionType() == kConnectionType_Pulse)
473 ShowQuickspawnForCable();
474 }
475
476 if ((CableDropBehavior)UserPrefs.cable_drop_behavior.GetIndex() == CableDropBehavior::DoNothing)
477 {
478 //do nothing
479 }
480
481 if ((CableDropBehavior)UserPrefs.cable_drop_behavior.GetIndex() == CableDropBehavior::DisconnectCable)
482 {
483 mOwner->RemovePatchCable(this, true);
484 return;
485 }
486
487 if (mTarget == nullptr)
488 Destroy(true);
489 }
490 }
491 }
492}
493
494void PatchCable::ShowQuickspawnForCable()
495{

Callers

nothing calls this directly

Calls 5

GetRawMouseXMethod · 0.80
GetRawMouseYMethod · 0.80
distanceSquaredMethod · 0.80
SetPatchCableTargetMethod · 0.80
RemovePatchCableMethod · 0.80

Tested by

no test coverage detected