2
0
forked from Ivasoft/DSView

Get the sample index from mouse point by round()

This commit is contained in:
dreamsourcelabTAI
2023-12-27 14:40:18 +08:00
parent 12cec54159
commit 9b4f4fe5af

View File

@@ -1273,9 +1273,9 @@ double View::index2pixel(uint64_t index, bool has_hoff)
uint64_t View::pixel2index(double pixel)
{
const double samples_per_pixel = session().cur_snap_samplerate() * scale();
uint64_t index = (pixel + offset()) * samples_per_pixel - trig_hoff();
double index = (pixel + offset()) * samples_per_pixel - trig_hoff();
return index;
return (uint64_t)std::round(index);
}
void View::set_receive_len(uint64_t len)