MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / filterEdgeHitAtPixel

Function filterEdgeHitAtPixel

src/gui/SpectrumWidget.cpp:409–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409static int filterEdgeHitAtPixel(int mx, int loX, int hiX, int grabPx)
410{
411 const int left = std::min(loX, hiX);
412 const int right = std::max(loX, hiX);
413 const bool insidePassband = mx >= left && mx <= right;
414 if (insidePassband && right - left <= kFilterPassbandMinBodyPx) {
415 return 0;
416 }
417
418 const int insideGrabPx = filterInteriorGrabPx(loX, hiX, grabPx);
419 const bool lowIsLeft = loX <= hiX;
420 const bool lowHit = lowIsLeft
421 ? (mx >= loX - grabPx && mx <= loX + insideGrabPx)
422 : (mx >= loX - insideGrabPx && mx <= loX + grabPx);
423 const bool highHit = lowIsLeft
424 ? (mx >= hiX - insideGrabPx && mx <= hiX + grabPx)
425 : (mx >= hiX - grabPx && mx <= hiX + insideGrabPx);
426
427 if (lowHit && highHit) {
428 return (std::abs(mx - loX) <= std::abs(mx - hiX)) ? -1 : 1;
429 }
430 if (lowHit) {
431 return -1;
432 }
433 if (highHit) {
434 return 1;
435 }
436 return 0;
437}
438
439static bool filterPassbandBodyHitAtPixel(int mx, int loX, int hiX, int grabPx)
440{

Callers 3

sliceCursorShapeAtMethod · 0.85
mousePressEventMethod · 0.85

Calls 1

filterInteriorGrabPxFunction · 0.85

Tested by

no test coverage detected