(&self, ui: &Ui, transform: &PlotTransform, shapes: &mut Vec<Shape>)
| 87 | |
| 88 | impl PlotItem for Text { |
| 89 | fn shapes(&self, ui: &Ui, transform: &PlotTransform, shapes: &mut Vec<Shape>) { |
| 90 | let color = if self.color == Color32::TRANSPARENT { |
| 91 | ui.style().visuals.text_color() |
| 92 | } else { |
| 93 | self.color |
| 94 | }; |
| 95 | |
| 96 | let galley = |
| 97 | self.text |
| 98 | .clone() |
| 99 | .into_galley(ui, Some(egui::TextWrapMode::Extend), f32::INFINITY, TextStyle::Small); |
| 100 | |
| 101 | let pos = transform.position_from_point(&self.position); |
| 102 | let rect = self.anchor.anchor_size(pos, galley.size()); |
| 103 | |
| 104 | shapes.push(TextShape::new(rect.min, galley, color).into()); |
| 105 | |
| 106 | if self.base.highlight { |
| 107 | shapes.push(Shape::rect_stroke( |
| 108 | rect.expand(1.0), |
| 109 | 1.0, |
| 110 | Stroke::new(0.5, color), |
| 111 | egui::StrokeKind::Outside, |
| 112 | )); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | fn initialize(&mut self, _x_range: RangeInclusive<f64>) {} |
| 117 |
nothing calls this directly
no test coverage detected