Merge remote-tracking branch 'egui/master' into dynamic-grid

This commit is contained in:
René Rössler 2022-01-09 22:08:26 +01:00
commit 99fdbb7918
3 changed files with 12 additions and 3 deletions

View file

@ -9,7 +9,7 @@ use crate::{
///
/// The style choices (font, color) are applied to the entire text.
/// For more detailed control, use [`crate::text::LayoutJob`] instead.
#[derive(Default)]
#[derive(Clone, Default, PartialEq)]
pub struct RichText {
text: String,
text_style: Option<TextStyle>,
@ -555,6 +555,7 @@ impl From<Arc<Galley>> for WidgetText {
// ----------------------------------------------------------------------------
#[derive(Clone, PartialEq)]
pub struct WidgetTextJob {
pub job: LayoutJob,
pub job_has_color: bool,
@ -574,6 +575,7 @@ impl WidgetTextJob {
// ----------------------------------------------------------------------------
/// Text that has been layed out and ready to be painted.
#[derive(Clone, PartialEq)]
pub struct WidgetTextGalley {
pub galley: Arc<Galley>,
pub galley_has_color: bool,

View file

@ -6,7 +6,9 @@ pub struct FontImage {
pub version: u64,
pub width: usize,
pub height: usize,
/// White color with the given alpha (linear space 0-255).
/// The alpha (linear space 0-255) of something white.
///
/// One byte per pixel. Often you want to use [`Self::srgba_pixels`] instead.
pub pixels: Vec<u8>,
}

View file

@ -160,8 +160,13 @@ pub trait App {
}
/// The size limit of the web app canvas.
///
/// By default the size if limited to 1024x2048.
///
/// A larger canvas can lead to bad frame rates on some browsers on some platforms.
/// In particular, Firefox on Mac and Linux is really bad at handling large WebGL canvases:
/// <https://bugzilla.mozilla.org/show_bug.cgi?id=1010527#c0> (unfixed since 2014).
fn max_size_points(&self) -> egui::Vec2 {
// Some browsers get slow with huge WebGL canvases, so we limit the size:
egui::Vec2::new(1024.0, 2048.0)
}