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

Method controls_overlay

examples/auto_backend.rs:94–121  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

92 }
93
94 fn controls_overlay(&self) -> Element<'_, Message> {
95 let panel = column![
96 text(format!("Render Strategy: {:?}", self.render_strategy)).size(16),
97 text(if matches!(self.render_strategy, PlotRenderStrategy::Canvas) {
98 "iced_tiny_skia::Renderer has bug with canvas's offset, which is fixed by iced v0.15.0-dev"
99 } else {
100 "Run with CPU backend:\nICED_BACKEND=\"tiny-skia\" cargo run --features canvas --example auto_backend"
101 })
102 .style(text::secondary),
103 offset_slider("x offset", self.x_offset, Message::XOffsetChanged),
104 offset_slider("y offset", self.y_offset, Message::YOffsetChanged),
105 ]
106 .spacing(8);
107
108 container(panel)
109 .padding(12)
110 .width(Length::Fixed(360.0))
111 .style(|theme: &Theme| {
112 let palette = theme.extended_palette();
113 container::Style {
114 background: Some(palette.background.weak.color.scale_alpha(0.86).into()),
115 text_color: Some(palette.background.weak.text),
116 border: border::rounded(8).color(palette.background.strong.color),
117 ..container::Style::default()
118 }
119 })
120 .into()
121 }
122
123 fn set_render_strategy(&mut self, strategy: PlotRenderStrategy) {
124 self.render_strategy = strategy;

Callers 1

viewMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected