-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix: FIT-790: Snap TimeSeries seek events to nearest data point to eliminate floating-point precision errors #8629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…recision errors When clicking on a TimeSeries visualization, seek events were emitting inaccurate time values due to floating-point precision errors in the pixel-to-time conversion calculations. For example, clicking on data point 1770.677344 would emit a seek event with value 1770.6719467913167, which doesn't exist in the original dataset. This caused synchronization issues with audio/video players and affected annotation accuracy. Changes: - Added snapToNearestDataPoint() helper function in helpers.js using efficient binary search (O(log n)) to find the closest actual data point - Refactored emitSeekSync() to snap center time before emitting - Refactored plotClickHandler() to snap clicked time before processing - Refactored handleMainAreaClick() to snap clicked time before processing Benefits: - Seek events now emit exact data point values from the dataset - Eliminates ~135 lines of duplicated code across 3 locations - Maintains backward compatibility with no breaking changes - Improves synchronization accuracy with video/audio players - Ensures annotation precision in time-based labeling tasks Bug demonstration: https://www.loom.com/share/5f1f429a21f0438ca5f11e7146570bfe Fix demonstration: https://www.loom.com/share/b1b2b9ea3230461eb6e58848c40edfe2 Files changed: - web/libs/editor/src/tags/object/TimeSeries/helpers.js - web/libs/editor/src/tags/object/TimeSeries.jsx Related To: #8601
✅ Deploy Preview for label-studio-docs-new-theme canceled.
|
✅ Deploy Preview for label-studio-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for label-studio-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for heartex-docs canceled.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8629 +/- ##
===========================================
- Coverage 67.13% 60.06% -7.08%
===========================================
Files 786 548 -238
Lines 60310 38805 -21505
Branches 10254 10263 +9
===========================================
- Hits 40492 23310 -17182
+ Misses 19815 15492 -4323
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This pull request improves the accuracy and reliability of time selection in the time series editor by introducing a new utility function that snaps requested time values to the nearest actual data point. This helps avoid floating-point precision errors when users interact with time-based visualizations. The changes are applied consistently across all relevant user interactions and synchronization logic.
original PR: #8602
Key improvements:
Precision and Data Consistency Enhancements:
snapToNearestDataPoint
inTimeSeries/helpers.js
that efficiently finds the closest time value in the dataset to a requested time, minimizing floating-point errors.TimeSeries.jsx
to usesnapToNearestDataPoint
when determining the final time value, ensuring all time-based actions align with actual data points. [1] [2] [3]Code Maintenance:
snapToNearestDataPoint
function intoTimeSeries.jsx
.Minor Cleanups: