MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / decode_id_to_hit

Method decode_id_to_hit

src/picking.rs:747–782  ·  view source on GitHub ↗
(
        &self,
        id: u32,
        _points: &[Point],
        series: &[SeriesSpan],
    )

Source from the content-addressed store, hash-verified

745 }
746
747 fn decode_id_to_hit(
748 &self,
749 id: u32,
750 _points: &[Point],
751 series: &[SeriesSpan],
752 ) -> Option<PointId> {
753 // IDs are 1-based instance index
754 let idx = (id as usize).saturating_sub(1);
755
756 if idx >= self.id_map.len() {
757 return None;
758 }
759
760 let (span_idx_u32, local_idx_u32) = self.id_map[idx];
761 let span_idx = span_idx_u32 as usize;
762 let local_idx = local_idx_u32 as usize;
763
764 if span_idx >= series.len() {
765 return None;
766 }
767
768 let span: &SeriesSpan = &series[span_idx];
769 if !span.pickable {
770 return None;
771 }
772 if local_idx >= span.point_indices.len() {
773 return None;
774 }
775
776 let point_index = span.point_indices[local_idx];
777
778 Some(PointId {
779 series_id: span.id,
780 point_index,
781 })
782 }
783}
784
785#[cfg(test)]

Callers 1

poll_pendingMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected