| 23 | } |
| 24 | |
| 25 | void ControlPointComponent::mouseDown (const MouseEvent& e) { |
| 26 | |
| 27 | if (e.getNumberOfClicks() > 1 || e.mods.isAltDown()) { |
| 28 | auto nearbyPoint = findNearbyPoint(e.getPosition(), nullptr); |
| 29 | if(nearbyPoint == nullptr) { return; } |
| 30 | |
| 31 | for(auto initialPoint : initialPoints) { |
| 32 | if( pointComparator.compareElements(initialPoint.referencePoint, *nearbyPoint) == 0 ) { |
| 33 | if(initialPoint.isSticky()) { |
| 34 | return; |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | points.remove(nearbyPoint); |
| 40 | repaint(); |
| 41 | } |
| 42 | |
| 43 | if(shouldDebounce(e)) { return; } |
| 44 | |
| 45 | if (points.size() == 0 || e.x > points.getLast().getX()) { |
| 46 | points.add (e.getPosition()); |
| 47 | repaint(); |
| 48 | } |
| 49 | else { |
| 50 | auto nearbyPoint = findNearbyPoint(e.getPosition(), nullptr); |
| 51 | if(nearbyPoint == nullptr) { |
| 52 | points.add(e.getPosition()); |
| 53 | |
| 54 | points.sort(pointComparator); |
| 55 | repaint(); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | void ControlPointComponent::mouseUp(const MouseEvent &event) { |
| 61 | if(shouldDebounce(event)) { return; } |
nothing calls this directly
no test coverage detected