MCPcopy Create free account
hub / github.com/angular-rust/ux-charts / get_tooltip_position

Method get_tooltip_position

src/pie.rs:523–538  ·  view source on GitHub ↗
(&self, tooltip_width: f64, tooltip_height: f64)

Source from the content-addressed store, hash-verified

521 }
522
523 fn get_tooltip_position(&self, tooltip_width: f64, tooltip_height: f64) -> Point<f64> {
524 let channels = self.base.channels.borrow();
525 let channel = channels.first().unwrap();
526
527 let focused_entity_index = self.base.props.borrow().focused_entity_index as usize;
528
529 let props = self.props.borrow();
530
531 let pie = channel.entities.get(focused_entity_index).unwrap();
532 let angle = 0.5 * (pie.start_angle + pie.end_angle);
533 let radius = 0.5 * (props.inner_radius + props.outer_radius);
534 let point = utils::polar2cartesian(&props.center, radius, angle);
535 let x = point.x - 0.5 * tooltip_width;
536 let y = point.y - tooltip_height;
537 Point::new(x, y)
538 }
539}

Callers

nothing calls this directly

Calls 1

polar2cartesianFunction · 0.85

Tested by

no test coverage detected