Skip to main content

stored_to_drawing

Function stored_to_drawing 

Source
pub fn stored_to_drawing(
    stored: &StoredDrawing,
    time_to_bar: impl Fn(i64) -> f32,
    next_id: usize,
) -> Drawing
Expand description

Convert StoredDrawing back to a completed Drawing with id next_id, its anchors mapped from timestamp to bar index and the record’s id, creation time and notes kept; the screen points follow on the next Drawing::update_screen_coords.

time_to_bar must be the inverse of the bar_to_time passed to drawing_to_stored: it returns fractional bar indices and extrapolates before the first and after the last bar instead of clamping, or anchors outside the loaded bars collapse onto the edge bar.