| 533 | } |
| 534 | |
| 535 | PeakIndex Plot1DCanvas::findPeakAtPosition_(QPoint p) |
| 536 | { |
| 537 | //no layers => return invalid peak index |
| 538 | if (layers_.empty()) |
| 539 | { |
| 540 | return PeakIndex(); |
| 541 | } |
| 542 | // mirror mode and p not on same half as active layer => return invalid peak index |
| 543 | if (mirror_mode_ && (getCurrentLayer().flipped ^ (p.y() > height() / 2))) |
| 544 | { |
| 545 | return PeakIndex(); |
| 546 | } |
| 547 | recalculatePercentageFactor_(getCurrentLayerIndex()); |
| 548 | |
| 549 | RangeAllType search_area = unit_mapper_.fromXY(widgetToData(p - QPoint(2, 2))); |
| 550 | search_area.extend(unit_mapper_.fromXY(widgetToData(p + QPoint(2, 2)))); |
| 551 | return getCurrentLayer().findClosestDataPoint(search_area); |
| 552 | } |
| 553 | |
| 554 | ////////////////////////////////////////////////////////////////////////////////// |
| 555 | // SLOTS |
nothing calls this directly
no test coverage detected