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

Method content_position

src/plot_overlay.rs:143–156  ·  view source on GitHub ↗
(&self, size: iced::Size)

Source from the content-addressed store, hash-verified

141
142impl<Message> PositionedOverlay<'_, Message> {
143 fn content_position(&self, size: iced::Size) -> Point {
144 let x = match self.horizontal_position {
145 Horizontal::Left => self.anchor[0] - size.width,
146 Horizontal::Center => self.anchor[0] - size.width * 0.5,
147 Horizontal::Right => self.anchor[0],
148 };
149 let y = match self.vertical_position {
150 Vertical::Top => self.anchor[1] - size.height,
151 Vertical::Center => self.anchor[1] - size.height * 0.5,
152 Vertical::Bottom => self.anchor[1],
153 };
154
155 Point::new(x, y)
156 }
157}
158
159impl<Message> Widget<Message, Theme, iced::Renderer> for PositionedOverlay<'_, Message> {

Callers 1

layoutMethod · 0.80

Calls 1

newFunction · 0.50

Tested by

no test coverage detected