pub fn drawing_to_stored(
drawing: &Drawing,
bar_to_time: impl Fn(f32) -> i64,
) -> StoredDrawingExpand description
Convert a Drawing to StoredDrawing, its anchors mapped from bar index to timestamp, under the drawing’s stored id and creation time when it was restored from storage, and under its id and the current time otherwise.
Retained timestamps are used for unchanged projected indices. For new or edited indices,
bar_to_time must accept fractional bar indices and extrapolate by the bar
interval before index 0 and after the last bar instead of clamping: anchors
can sit between bars, in the history not yet loaded or in the future area,
and a clamping mapping would move them onto the first or last bar. It must
be the inverse of the time_to_bar passed to stored_to_drawing.