| 509 | } |
| 510 | |
| 511 | IClickable* PatchCable::GetDropTarget() |
| 512 | { |
| 513 | if (mDragging) |
| 514 | { |
| 515 | PatchCablePos cable = GetPatchCablePos(); |
| 516 | IClickable* potentialTarget = TheSynth->GetRootContainer()->GetModuleAt(cable.end.x, cable.end.y); |
| 517 | if (potentialTarget && (GetConnectionType() == kConnectionType_Pulse || GetConnectionType() == kConnectionType_Modulator || GetConnectionType() == kConnectionType_ValueSetter || GetConnectionType() == kConnectionType_Grid || GetConnectionType() == kConnectionType_UIControl)) |
| 518 | { |
| 519 | IClickable* potentialUIControl = nullptr; |
| 520 | |
| 521 | const auto& uicontrols = (static_cast<IDrawableModule*>(potentialTarget))->GetUIControls(); |
| 522 | for (auto uicontrol : uicontrols) |
| 523 | { |
| 524 | if (uicontrol->IsShowing() == false || !IsValidTarget(uicontrol)) |
| 525 | continue; |
| 526 | |
| 527 | ofRectangle rect = uicontrol->GetRect(); |
| 528 | if (rect.contains(cable.end.x, cable.end.y)) |
| 529 | { |
| 530 | potentialUIControl = uicontrol; |
| 531 | break; |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | const auto& grids = (static_cast<IDrawableModule*>(potentialTarget))->GetUIGrids(); |
| 536 | for (auto grid : grids) |
| 537 | { |
| 538 | if (grid->IsShowing() == false || !IsValidTarget(grid)) |
| 539 | continue; |
| 540 | |
| 541 | ofRectangle rect = grid->GetRect(); |
| 542 | if (rect.contains(cable.end.x, cable.end.y)) |
| 543 | { |
| 544 | potentialUIControl = grid; |
| 545 | break; |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | if (potentialUIControl != nullptr) |
| 550 | potentialTarget = potentialUIControl; |
| 551 | } |
| 552 | if (mOwner->IsValidTarget(potentialTarget)) |
| 553 | return potentialTarget; |
| 554 | } |
| 555 | |
| 556 | return nullptr; |
| 557 | } |
| 558 | |
| 559 | bool PatchCable::TestClick(float x, float y, bool right, bool testOnly /* = false */) |
| 560 | { |
no test coverage detected