1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Added App::clear_color() that apps can use to specify background color

This commit is contained in:
Emil Ernerfeldt
2020-12-18 22:34:48 +01:00
parent 9ea8d907fd
commit c3c4f28a9d
6 changed files with 33 additions and 11 deletions

View File

@@ -55,10 +55,13 @@ impl WebBackend {
Ok((output, paint_jobs))
}
pub fn paint(&mut self, paint_jobs: egui::PaintJobs) -> Result<(), JsValue> {
let bg_color = egui::color::TRANSPARENT; // Use background css color.
pub fn paint(
&mut self,
clear_color: egui::Rgba,
paint_jobs: egui::PaintJobs,
) -> Result<(), JsValue> {
self.painter.paint_jobs(
bg_color,
clear_color,
paint_jobs,
&self.ctx.texture(),
self.ctx.pixels_per_point(),
@@ -214,7 +217,7 @@ impl AppRunner {
}
pub fn paint(&mut self, paint_jobs: egui::PaintJobs) -> Result<(), JsValue> {
self.web_backend.paint(paint_jobs)
self.web_backend.paint(self.app.clear_color(), paint_jobs)
}
}