MCPcopy Create free account
hub / github.com/andrewreeman/SpectralSuite / mouseDown

Method mouseDown

shared/components/ControlPointComponent.cpp:25–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25void 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
60void ControlPointComponent::mouseUp(const MouseEvent &event) {
61 if(shouldDebounce(event)) { return; }

Callers

nothing calls this directly

Calls 3

compareElementsMethod · 0.80
isStickyMethod · 0.80
removeMethod · 0.80

Tested by

no test coverage detected