| 53 | } |
| 54 | |
| 55 | QRect Cursor::get_label_rect(const QRect &rect, bool &visible, bool has_hoff) |
| 56 | { |
| 57 | const double samples_per_pixel = _view.session().cur_snap_samplerate() * _view.scale(); |
| 58 | const double cur_offset = _index / samples_per_pixel; |
| 59 | if (cur_offset < _view.offset() || |
| 60 | cur_offset > (_view.offset() + _view.width())) { |
| 61 | visible = false; |
| 62 | return QRect(-1, -1, 0, 0); |
| 63 | } |
| 64 | const int64_t x = _view.index2pixel(_index, has_hoff); |
| 65 | |
| 66 | const QSize label_size( |
| 67 | _text_size.width() + View::LabelPadding.width() * 2, |
| 68 | _text_size.height() + View::LabelPadding.height() * 2); |
| 69 | const int top = rect.height() - label_size.height() - |
| 70 | Cursor::Offset - Cursor::ArrowSize - 0.5f; |
| 71 | const int height = label_size.height(); |
| 72 | |
| 73 | visible = true; |
| 74 | return QRect(x - label_size.width() / 2, top, label_size.width(), height); |
| 75 | } |
| 76 | |
| 77 | QRect Cursor::get_close_rect(const QRect &rect) |
| 78 | { |
no test coverage detected