mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Sync with work done upstream
This commit is contained in:
@@ -134,11 +134,11 @@ impl Frame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show<R>(self, ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> R {
|
pub fn show<R>(self, ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {
|
||||||
let mut prepared = self.begin(ui);
|
let mut prepared = self.begin(ui);
|
||||||
let ret = add_contents(&mut prepared.content_ui);
|
let ret = add_contents(&mut prepared.content_ui);
|
||||||
prepared.end(ui);
|
let response = prepared.end(ui);
|
||||||
ret
|
InnerResponse::new(ret, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn paint(&self, outer_rect: Rect) -> Shape {
|
pub fn paint(&self, outer_rect: Rect) -> Shape {
|
||||||
@@ -175,7 +175,7 @@ impl Prepared {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn end(self, ui: &mut Ui) -> Rect {
|
pub fn end(self, ui: &mut Ui) -> Response {
|
||||||
let outer_rect = self.outer_rect();
|
let outer_rect = self.outer_rect();
|
||||||
|
|
||||||
let Prepared {
|
let Prepared {
|
||||||
@@ -186,7 +186,6 @@ impl Prepared {
|
|||||||
|
|
||||||
let shape = frame.paint(outer_rect);
|
let shape = frame.paint(outer_rect);
|
||||||
ui.painter().set(where_to_put_background, shape);
|
ui.painter().set(where_to_put_background, shape);
|
||||||
ui.advance_cursor_after_rect(outer_rect);
|
ui.allocate_rect(outer_rect, Sense::hover())
|
||||||
outer_rect
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,21 +51,16 @@ impl SidePanel {
|
|||||||
let mut panel_ui = Ui::new(ctx.clone(), layer_id, id, panel_rect, clip_rect);
|
let mut panel_ui = Ui::new(ctx.clone(), layer_id, id, panel_rect, clip_rect);
|
||||||
|
|
||||||
let frame = Frame::side_top_panel(&ctx.style());
|
let frame = Frame::side_top_panel(&ctx.style());
|
||||||
let (r, used_space) = frame.show(&mut panel_ui, |ui| {
|
let inner_response = frame.show(&mut panel_ui, |ui| {
|
||||||
let r = add_contents(ui);
|
|
||||||
let used_space = ui.min_rect();
|
|
||||||
ui.set_min_height(ui.max_rect_finite().height()); // Make sure the frame fills the full height
|
ui.set_min_height(ui.max_rect_finite().height()); // Make sure the frame fills the full height
|
||||||
(r, used_space)
|
add_contents(ui)
|
||||||
});
|
});
|
||||||
|
|
||||||
let panel_rect = panel_ui.min_rect();
|
|
||||||
let response = panel_ui.interact(panel_rect, id, Sense::hover());
|
|
||||||
|
|
||||||
// Only inform ctx about what we actually used, so we can shrink the native window to fit.
|
// Only inform ctx about what we actually used, so we can shrink the native window to fit.
|
||||||
ctx.frame_state()
|
ctx.frame_state()
|
||||||
.allocate_left_panel(used_space.expand2(frame.margin));
|
.allocate_left_panel(inner_response.response.rect);
|
||||||
|
|
||||||
InnerResponse::new(r, response)
|
inner_response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,21 +113,16 @@ impl TopPanel {
|
|||||||
let mut panel_ui = Ui::new(ctx.clone(), layer_id, id, panel_rect, clip_rect);
|
let mut panel_ui = Ui::new(ctx.clone(), layer_id, id, panel_rect, clip_rect);
|
||||||
|
|
||||||
let frame = Frame::side_top_panel(&ctx.style());
|
let frame = Frame::side_top_panel(&ctx.style());
|
||||||
let (r, used_space) = frame.show(&mut panel_ui, |ui| {
|
let inner_response = frame.show(&mut panel_ui, |ui| {
|
||||||
let r = add_contents(ui);
|
|
||||||
let used_space = ui.min_rect();
|
|
||||||
ui.set_min_width(ui.max_rect_finite().width()); // Make the frame fill full width
|
ui.set_min_width(ui.max_rect_finite().width()); // Make the frame fill full width
|
||||||
(r, used_space)
|
add_contents(ui)
|
||||||
});
|
});
|
||||||
|
|
||||||
let panel_rect = panel_ui.min_rect();
|
|
||||||
let response = panel_ui.interact(panel_rect, id, Sense::hover());
|
|
||||||
|
|
||||||
// Only inform ctx about what we actually used, so we can shrink the native window to fit.
|
// Only inform ctx about what we actually used, so we can shrink the native window to fit.
|
||||||
ctx.frame_state()
|
ctx.frame_state()
|
||||||
.allocate_top_panel(used_space.expand2(frame.margin));
|
.allocate_top_panel(inner_response.response.rect);
|
||||||
|
|
||||||
InnerResponse::new(r, response)
|
inner_response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,21 +172,15 @@ impl CentralPanel {
|
|||||||
let mut panel_ui = Ui::new(ctx.clone(), layer_id, id, panel_rect, clip_rect);
|
let mut panel_ui = Ui::new(ctx.clone(), layer_id, id, panel_rect, clip_rect);
|
||||||
|
|
||||||
let frame = frame.unwrap_or_else(|| Frame::central_panel(&ctx.style()));
|
let frame = frame.unwrap_or_else(|| Frame::central_panel(&ctx.style()));
|
||||||
let (r, used_space) = frame.show(&mut panel_ui, |ui| {
|
let inner_response = frame.show(&mut panel_ui, |ui| {
|
||||||
let r = add_contents(ui);
|
|
||||||
let used_space = ui.min_rect();
|
|
||||||
ui.expand_to_include_rect(ui.max_rect()); // Expand frame to include it all
|
ui.expand_to_include_rect(ui.max_rect()); // Expand frame to include it all
|
||||||
(r, used_space)
|
add_contents(ui)
|
||||||
});
|
});
|
||||||
|
|
||||||
let panel_rect = panel_ui.min_rect();
|
|
||||||
let id = Id::new("central_panel");
|
|
||||||
let response = panel_ui.interact(panel_rect, id, Sense::hover());
|
|
||||||
|
|
||||||
// Only inform ctx about what we actually used, so we can shrink the native window to fit.
|
// Only inform ctx about what we actually used, so we can shrink the native window to fit.
|
||||||
ctx.frame_state()
|
ctx.frame_state()
|
||||||
.allocate_central_panel(used_space.expand2(frame.margin));
|
.allocate_central_panel(inner_response.response.rect);
|
||||||
|
|
||||||
InnerResponse::new(r, response)
|
inner_response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ fn show_tooltip_area(
|
|||||||
Frame::popup(&ctx.style()).show(ui, |ui| {
|
Frame::popup(&ctx.style()).show(ui, |ui| {
|
||||||
ui.set_max_width(ui.spacing().tooltip_width);
|
ui.set_max_width(ui.spacing().tooltip_width);
|
||||||
add_contents(ui);
|
add_contents(ui);
|
||||||
})
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ impl<'open> Window<'open> {
|
|||||||
})
|
})
|
||||||
.map(|ir| ir.response);
|
.map(|ir| ir.response);
|
||||||
|
|
||||||
let outer_rect = frame.end(&mut area_content_ui);
|
let outer_rect = frame.end(&mut area_content_ui).rect;
|
||||||
|
|
||||||
if possible.resizable {
|
if possible.resizable {
|
||||||
paint_resize_corner(&mut area_content_ui, outer_rect, frame_stroke);
|
paint_resize_corner(&mut area_content_ui, outer_rect, frame_stroke);
|
||||||
|
|||||||
@@ -327,7 +327,6 @@ impl WidgetInfo {
|
|||||||
|
|
||||||
// TODO: localization
|
// TODO: localization
|
||||||
let widget_name = match typ {
|
let widget_name = match typ {
|
||||||
WidgetType::Label => "",
|
|
||||||
WidgetType::Hyperlink => "link",
|
WidgetType::Hyperlink => "link",
|
||||||
WidgetType::TextEdit => "text edit",
|
WidgetType::TextEdit => "text edit",
|
||||||
WidgetType::Button => "button",
|
WidgetType::Button => "button",
|
||||||
@@ -340,7 +339,7 @@ impl WidgetInfo {
|
|||||||
WidgetType::ColorButton => "color button",
|
WidgetType::ColorButton => "color button",
|
||||||
WidgetType::ImageButton => "image button",
|
WidgetType::ImageButton => "image button",
|
||||||
WidgetType::CollapsingHeader => "collapsing header",
|
WidgetType::CollapsingHeader => "collapsing header",
|
||||||
WidgetType::Other => "",
|
WidgetType::Label | WidgetType::Other => "",
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut description = widget_name.to_owned();
|
let mut description = widget_name.to_owned();
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ impl GridLayout {
|
|||||||
Rect::from_min_size(cursor.min, size)
|
Rect::from_min_size(cursor.min, size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::unused_self)]
|
||||||
pub(crate) fn align_size_within_rect(&self, size: Vec2, frame: Rect) -> Rect {
|
pub(crate) fn align_size_within_rect(&self, size: Vec2, frame: Rect) -> Rect {
|
||||||
// TODO: allow this alignment to be customized
|
// TODO: allow this alignment to be customized
|
||||||
Align2::LEFT_CENTER.align_size_within_rect(size, frame)
|
Align2::LEFT_CENTER.align_size_within_rect(size, frame)
|
||||||
@@ -305,7 +306,7 @@ impl Grid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Grid {
|
impl Grid {
|
||||||
pub fn show<R>(self, ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> R {
|
pub fn show<R>(self, ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {
|
||||||
let Self {
|
let Self {
|
||||||
id_source,
|
id_source,
|
||||||
striped,
|
striped,
|
||||||
@@ -337,6 +338,5 @@ impl Grid {
|
|||||||
ui.save_grid();
|
ui.save_grid();
|
||||||
r
|
r
|
||||||
})
|
})
|
||||||
.inner
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -411,6 +411,8 @@ impl Layout {
|
|||||||
avail.min.y = cursor.min.y;
|
avail.min.y = cursor.min.y;
|
||||||
avail.max.y = cursor.max.y;
|
avail.max.y = cursor.max.y;
|
||||||
}
|
}
|
||||||
|
avail.max.x = avail.max.x.max(avail.min.x);
|
||||||
|
avail.max.y = avail.max.y.max(avail.min.y);
|
||||||
}
|
}
|
||||||
Direction::RightToLeft => {
|
Direction::RightToLeft => {
|
||||||
avail.max.x = cursor.max.x;
|
avail.max.x = cursor.max.x;
|
||||||
@@ -419,6 +421,8 @@ impl Layout {
|
|||||||
avail.min.y = cursor.min.y;
|
avail.min.y = cursor.min.y;
|
||||||
avail.max.y = cursor.max.y;
|
avail.max.y = cursor.max.y;
|
||||||
}
|
}
|
||||||
|
avail.min.x = avail.min.x.min(avail.max.x);
|
||||||
|
avail.max.y = avail.max.y.max(avail.min.y);
|
||||||
}
|
}
|
||||||
Direction::TopDown => {
|
Direction::TopDown => {
|
||||||
avail.min.y = cursor.min.y;
|
avail.min.y = cursor.min.y;
|
||||||
@@ -427,6 +431,8 @@ impl Layout {
|
|||||||
avail.min.x = cursor.min.x;
|
avail.min.x = cursor.min.x;
|
||||||
avail.max.x = cursor.max.x;
|
avail.max.x = cursor.max.x;
|
||||||
}
|
}
|
||||||
|
avail.max.x = avail.max.x.max(avail.min.x);
|
||||||
|
avail.max.y = avail.max.y.max(avail.min.y);
|
||||||
}
|
}
|
||||||
Direction::BottomUp => {
|
Direction::BottomUp => {
|
||||||
avail.min.y = avail.min.y.min(cursor.max.y);
|
avail.min.y = avail.min.y.min(cursor.max.y);
|
||||||
@@ -434,6 +440,8 @@ impl Layout {
|
|||||||
avail.min.x = cursor.min.x;
|
avail.min.x = cursor.min.x;
|
||||||
avail.max.x = cursor.max.x;
|
avail.max.x = cursor.max.x;
|
||||||
}
|
}
|
||||||
|
avail.max.x = avail.max.x.max(avail.min.x);
|
||||||
|
avail.min.y = avail.min.y.min(avail.max.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -233,19 +233,26 @@
|
|||||||
clippy::all,
|
clippy::all,
|
||||||
clippy::await_holding_lock,
|
clippy::await_holding_lock,
|
||||||
clippy::dbg_macro,
|
clippy::dbg_macro,
|
||||||
|
clippy::debug_assert_with_mut_call,
|
||||||
clippy::doc_markdown,
|
clippy::doc_markdown,
|
||||||
clippy::empty_enum,
|
clippy::empty_enum,
|
||||||
clippy::enum_glob_use,
|
clippy::enum_glob_use,
|
||||||
clippy::exit,
|
clippy::exit,
|
||||||
|
clippy::explicit_into_iter_loop,
|
||||||
clippy::filter_map_next,
|
clippy::filter_map_next,
|
||||||
clippy::fn_params_excessive_bools,
|
clippy::fn_params_excessive_bools,
|
||||||
clippy::if_let_mutex,
|
clippy::if_let_mutex,
|
||||||
clippy::imprecise_flops,
|
clippy::imprecise_flops,
|
||||||
clippy::inefficient_to_string,
|
clippy::inefficient_to_string,
|
||||||
|
clippy::large_types_passed_by_value,
|
||||||
|
clippy::let_unit_value,
|
||||||
clippy::linkedlist,
|
clippy::linkedlist,
|
||||||
clippy::lossy_float_literal,
|
clippy::lossy_float_literal,
|
||||||
clippy::macro_use_imports,
|
clippy::macro_use_imports,
|
||||||
|
clippy::map_err_ignore,
|
||||||
|
clippy::map_flatten,
|
||||||
clippy::match_on_vec_items,
|
clippy::match_on_vec_items,
|
||||||
|
clippy::match_same_arms,
|
||||||
clippy::match_wildcard_for_single_variants,
|
clippy::match_wildcard_for_single_variants,
|
||||||
clippy::mem_forget,
|
clippy::mem_forget,
|
||||||
clippy::mismatched_target_os,
|
clippy::mismatched_target_os,
|
||||||
@@ -256,18 +263,20 @@
|
|||||||
clippy::needless_pass_by_value,
|
clippy::needless_pass_by_value,
|
||||||
clippy::option_option,
|
clippy::option_option,
|
||||||
clippy::pub_enum_variant_names,
|
clippy::pub_enum_variant_names,
|
||||||
|
clippy::ref_option_ref,
|
||||||
clippy::rest_pat_in_fully_bound_structs,
|
clippy::rest_pat_in_fully_bound_structs,
|
||||||
|
clippy::string_add_assign,
|
||||||
|
clippy::string_add,
|
||||||
|
clippy::string_to_string,
|
||||||
clippy::todo,
|
clippy::todo,
|
||||||
clippy::unimplemented,
|
clippy::unimplemented,
|
||||||
clippy::unnested_or_patterns,
|
clippy::unnested_or_patterns,
|
||||||
|
clippy::unused_self,
|
||||||
clippy::verbose_file_reads,
|
clippy::verbose_file_reads,
|
||||||
future_incompatible,
|
future_incompatible,
|
||||||
missing_crate_level_docs,
|
missing_crate_level_docs,
|
||||||
missing_doc_code_examples,
|
|
||||||
// missing_docs,
|
|
||||||
nonstandard_style,
|
nonstandard_style,
|
||||||
rust_2018_idioms,
|
rust_2018_idioms
|
||||||
unused_doc_comments,
|
|
||||||
)]
|
)]
|
||||||
#![allow(clippy::manual_range_contains)]
|
#![allow(clippy::manual_range_contains)]
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ fn menu_impl<'c>(
|
|||||||
style.visuals.widgets.inactive.bg_stroke = Stroke::none();
|
style.visuals.widgets.inactive.bg_stroke = Stroke::none();
|
||||||
ui.set_style(style);
|
ui.set_style(style);
|
||||||
ui.with_layout(Layout::top_down_justified(Align::LEFT), add_contents);
|
ui.with_layout(Layout::top_down_justified(Align::LEFT), add_contents);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: this prevents sub-menus in menus. We should fix that.
|
// TODO: this prevents sub-menus in menus. We should fix that.
|
||||||
|
|||||||
@@ -1121,7 +1121,7 @@ impl Ui {
|
|||||||
/// ui.label("Within a frame");
|
/// ui.label("Within a frame");
|
||||||
/// });
|
/// });
|
||||||
/// ```
|
/// ```
|
||||||
pub fn group<R>(&mut self, add_contents: impl FnOnce(&mut Ui) -> R) -> R {
|
pub fn group<R>(&mut self, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {
|
||||||
crate::Frame::group(self.style()).show(self, add_contents)
|
crate::Frame::group(self.style()).show(self, add_contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ pub fn color_edit_button_hsva(ui: &mut Ui, hsva: &mut Hsva, alpha: Alpha) -> Res
|
|||||||
if color_picker_hsva_2d(ui, hsva, alpha) {
|
if color_picker_hsva_2d(ui, hsva, alpha) {
|
||||||
button_response.mark_changed();
|
button_response.mark_changed();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if !button_response.clicked()
|
if !button_response.clicked()
|
||||||
|
|||||||
@@ -303,6 +303,7 @@ fn x_range(rect: &Rect) -> RangeInclusive<f32> {
|
|||||||
|
|
||||||
impl<'a> Slider<'a> {
|
impl<'a> Slider<'a> {
|
||||||
/// Just the slider, no text
|
/// Just the slider, no text
|
||||||
|
#[allow(clippy::unused_self)]
|
||||||
fn allocate_slider_space(&self, ui: &mut Ui, height: f32) -> Response {
|
fn allocate_slider_space(&self, ui: &mut Ui, height: f32) -> Response {
|
||||||
let desired_size = vec2(ui.spacing().slider_width, height);
|
let desired_size = vec2(ui.spacing().slider_width, height);
|
||||||
ui.allocate_response(desired_size, Sense::click_and_drag())
|
ui.allocate_response(desired_size, Sense::click_and_drag())
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ impl super::View for LayoutTest {
|
|||||||
ui.available_size_before_wrap_finite().x,
|
ui.available_size_before_wrap_finite().x,
|
||||||
self.wrap_row_height,
|
self.wrap_row_height,
|
||||||
),
|
),
|
||||||
|ui| ui.with_layout(self.layout(), |ui| self.demo_ui(ui)),
|
|ui| ui.with_layout(self.layout(), demo_ui),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ui.allocate_ui(
|
ui.allocate_ui(
|
||||||
@@ -65,11 +65,11 @@ impl super::View for LayoutTest {
|
|||||||
self.wrap_column_width,
|
self.wrap_column_width,
|
||||||
ui.available_size_before_wrap_finite().y,
|
ui.available_size_before_wrap_finite().y,
|
||||||
),
|
),
|
||||||
|ui| ui.with_layout(self.layout(), |ui| self.demo_ui(ui)),
|
|ui| ui.with_layout(self.layout(), demo_ui),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ui.with_layout(self.layout(), |ui| self.demo_ui(ui));
|
ui.with_layout(self.layout(), demo_ui);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ui.label("Resize to see effect");
|
ui.label("Resize to see effect");
|
||||||
@@ -138,18 +138,18 @@ impl LayoutTest {
|
|||||||
ui.checkbox(&mut self.cross_justify, "Cross Justified")
|
ui.checkbox(&mut self.cross_justify, "Cross Justified")
|
||||||
.on_hover_text("Try to fill full width/height (e.g. buttons)");
|
.on_hover_text("Try to fill full width/height (e.g. buttons)");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn demo_ui(&mut self, ui: &mut Ui) {
|
fn demo_ui(ui: &mut Ui) {
|
||||||
ui.monospace("Example widgets:");
|
ui.monospace("Example widgets:");
|
||||||
for _ in 0..3 {
|
for _ in 0..3 {
|
||||||
ui.label("label");
|
ui.label("label");
|
||||||
}
|
}
|
||||||
for _ in 0..3 {
|
for _ in 0..3 {
|
||||||
let mut dummy = false;
|
let mut dummy = false;
|
||||||
ui.checkbox(&mut dummy, "checkbox");
|
ui.checkbox(&mut dummy, "checkbox");
|
||||||
}
|
}
|
||||||
for _ in 0..3 {
|
for _ in 0..3 {
|
||||||
let _ = ui.button("button");
|
let _ = ui.button("button");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,19 +8,26 @@
|
|||||||
clippy::all,
|
clippy::all,
|
||||||
clippy::await_holding_lock,
|
clippy::await_holding_lock,
|
||||||
clippy::dbg_macro,
|
clippy::dbg_macro,
|
||||||
|
clippy::debug_assert_with_mut_call,
|
||||||
clippy::doc_markdown,
|
clippy::doc_markdown,
|
||||||
clippy::empty_enum,
|
clippy::empty_enum,
|
||||||
clippy::enum_glob_use,
|
clippy::enum_glob_use,
|
||||||
clippy::exit,
|
clippy::exit,
|
||||||
|
clippy::explicit_into_iter_loop,
|
||||||
clippy::filter_map_next,
|
clippy::filter_map_next,
|
||||||
clippy::fn_params_excessive_bools,
|
clippy::fn_params_excessive_bools,
|
||||||
clippy::if_let_mutex,
|
clippy::if_let_mutex,
|
||||||
clippy::imprecise_flops,
|
clippy::imprecise_flops,
|
||||||
clippy::inefficient_to_string,
|
clippy::inefficient_to_string,
|
||||||
|
clippy::large_types_passed_by_value,
|
||||||
|
clippy::let_unit_value,
|
||||||
clippy::linkedlist,
|
clippy::linkedlist,
|
||||||
clippy::lossy_float_literal,
|
clippy::lossy_float_literal,
|
||||||
clippy::macro_use_imports,
|
clippy::macro_use_imports,
|
||||||
|
clippy::map_err_ignore,
|
||||||
|
clippy::map_flatten,
|
||||||
clippy::match_on_vec_items,
|
clippy::match_on_vec_items,
|
||||||
|
clippy::match_same_arms,
|
||||||
clippy::match_wildcard_for_single_variants,
|
clippy::match_wildcard_for_single_variants,
|
||||||
clippy::mem_forget,
|
clippy::mem_forget,
|
||||||
clippy::mismatched_target_os,
|
clippy::mismatched_target_os,
|
||||||
@@ -31,19 +38,22 @@
|
|||||||
clippy::needless_pass_by_value,
|
clippy::needless_pass_by_value,
|
||||||
clippy::option_option,
|
clippy::option_option,
|
||||||
clippy::pub_enum_variant_names,
|
clippy::pub_enum_variant_names,
|
||||||
|
clippy::ref_option_ref,
|
||||||
clippy::rest_pat_in_fully_bound_structs,
|
clippy::rest_pat_in_fully_bound_structs,
|
||||||
|
clippy::string_add_assign,
|
||||||
|
clippy::string_add,
|
||||||
|
clippy::string_to_string,
|
||||||
clippy::todo,
|
clippy::todo,
|
||||||
clippy::unimplemented,
|
clippy::unimplemented,
|
||||||
clippy::unnested_or_patterns,
|
clippy::unnested_or_patterns,
|
||||||
|
clippy::unused_self,
|
||||||
clippy::verbose_file_reads,
|
clippy::verbose_file_reads,
|
||||||
future_incompatible,
|
future_incompatible,
|
||||||
missing_crate_level_docs,
|
missing_crate_level_docs,
|
||||||
missing_doc_code_examples,
|
|
||||||
// missing_docs,
|
|
||||||
nonstandard_style,
|
nonstandard_style,
|
||||||
rust_2018_idioms,
|
rust_2018_idioms
|
||||||
unused_doc_comments,
|
|
||||||
)]
|
)]
|
||||||
|
#![allow(clippy::manual_range_contains)]
|
||||||
|
|
||||||
mod apps;
|
mod apps;
|
||||||
pub(crate) mod frame_history;
|
pub(crate) mod frame_history;
|
||||||
|
|||||||
@@ -15,19 +15,26 @@
|
|||||||
clippy::all,
|
clippy::all,
|
||||||
clippy::await_holding_lock,
|
clippy::await_holding_lock,
|
||||||
clippy::dbg_macro,
|
clippy::dbg_macro,
|
||||||
|
clippy::debug_assert_with_mut_call,
|
||||||
clippy::doc_markdown,
|
clippy::doc_markdown,
|
||||||
clippy::empty_enum,
|
clippy::empty_enum,
|
||||||
clippy::enum_glob_use,
|
clippy::enum_glob_use,
|
||||||
clippy::exit,
|
clippy::exit,
|
||||||
|
clippy::explicit_into_iter_loop,
|
||||||
clippy::filter_map_next,
|
clippy::filter_map_next,
|
||||||
clippy::fn_params_excessive_bools,
|
clippy::fn_params_excessive_bools,
|
||||||
clippy::if_let_mutex,
|
clippy::if_let_mutex,
|
||||||
clippy::imprecise_flops,
|
clippy::imprecise_flops,
|
||||||
clippy::inefficient_to_string,
|
clippy::inefficient_to_string,
|
||||||
|
clippy::large_types_passed_by_value,
|
||||||
|
clippy::let_unit_value,
|
||||||
clippy::linkedlist,
|
clippy::linkedlist,
|
||||||
clippy::lossy_float_literal,
|
clippy::lossy_float_literal,
|
||||||
clippy::macro_use_imports,
|
clippy::macro_use_imports,
|
||||||
|
clippy::map_err_ignore,
|
||||||
|
clippy::map_flatten,
|
||||||
clippy::match_on_vec_items,
|
clippy::match_on_vec_items,
|
||||||
|
clippy::match_same_arms,
|
||||||
clippy::match_wildcard_for_single_variants,
|
clippy::match_wildcard_for_single_variants,
|
||||||
clippy::mem_forget,
|
clippy::mem_forget,
|
||||||
clippy::mismatched_target_os,
|
clippy::mismatched_target_os,
|
||||||
@@ -38,18 +45,20 @@
|
|||||||
clippy::needless_pass_by_value,
|
clippy::needless_pass_by_value,
|
||||||
clippy::option_option,
|
clippy::option_option,
|
||||||
clippy::pub_enum_variant_names,
|
clippy::pub_enum_variant_names,
|
||||||
|
clippy::ref_option_ref,
|
||||||
clippy::rest_pat_in_fully_bound_structs,
|
clippy::rest_pat_in_fully_bound_structs,
|
||||||
|
clippy::string_add_assign,
|
||||||
|
clippy::string_add,
|
||||||
|
clippy::string_to_string,
|
||||||
clippy::todo,
|
clippy::todo,
|
||||||
clippy::unimplemented,
|
clippy::unimplemented,
|
||||||
clippy::unnested_or_patterns,
|
clippy::unnested_or_patterns,
|
||||||
|
clippy::unused_self,
|
||||||
clippy::verbose_file_reads,
|
clippy::verbose_file_reads,
|
||||||
future_incompatible,
|
future_incompatible,
|
||||||
missing_crate_level_docs,
|
missing_crate_level_docs,
|
||||||
missing_doc_code_examples,
|
|
||||||
// missing_docs,
|
|
||||||
nonstandard_style,
|
nonstandard_style,
|
||||||
rust_2018_idioms,
|
rust_2018_idioms
|
||||||
unused_doc_comments,
|
|
||||||
)]
|
)]
|
||||||
#![allow(clippy::manual_range_contains)]
|
#![allow(clippy::manual_range_contains)]
|
||||||
|
|
||||||
|
|||||||
@@ -6,19 +6,26 @@
|
|||||||
clippy::all,
|
clippy::all,
|
||||||
clippy::await_holding_lock,
|
clippy::await_holding_lock,
|
||||||
clippy::dbg_macro,
|
clippy::dbg_macro,
|
||||||
|
clippy::debug_assert_with_mut_call,
|
||||||
clippy::doc_markdown,
|
clippy::doc_markdown,
|
||||||
clippy::empty_enum,
|
clippy::empty_enum,
|
||||||
clippy::enum_glob_use,
|
clippy::enum_glob_use,
|
||||||
clippy::exit,
|
clippy::exit,
|
||||||
|
clippy::explicit_into_iter_loop,
|
||||||
clippy::filter_map_next,
|
clippy::filter_map_next,
|
||||||
clippy::fn_params_excessive_bools,
|
clippy::fn_params_excessive_bools,
|
||||||
clippy::if_let_mutex,
|
clippy::if_let_mutex,
|
||||||
clippy::imprecise_flops,
|
clippy::imprecise_flops,
|
||||||
clippy::inefficient_to_string,
|
clippy::inefficient_to_string,
|
||||||
|
clippy::large_types_passed_by_value,
|
||||||
|
clippy::let_unit_value,
|
||||||
clippy::linkedlist,
|
clippy::linkedlist,
|
||||||
clippy::lossy_float_literal,
|
clippy::lossy_float_literal,
|
||||||
clippy::macro_use_imports,
|
clippy::macro_use_imports,
|
||||||
|
clippy::map_err_ignore,
|
||||||
|
clippy::map_flatten,
|
||||||
clippy::match_on_vec_items,
|
clippy::match_on_vec_items,
|
||||||
|
clippy::match_same_arms,
|
||||||
clippy::match_wildcard_for_single_variants,
|
clippy::match_wildcard_for_single_variants,
|
||||||
clippy::mem_forget,
|
clippy::mem_forget,
|
||||||
clippy::mismatched_target_os,
|
clippy::mismatched_target_os,
|
||||||
@@ -29,18 +36,20 @@
|
|||||||
clippy::needless_pass_by_value,
|
clippy::needless_pass_by_value,
|
||||||
clippy::option_option,
|
clippy::option_option,
|
||||||
clippy::pub_enum_variant_names,
|
clippy::pub_enum_variant_names,
|
||||||
|
clippy::ref_option_ref,
|
||||||
clippy::rest_pat_in_fully_bound_structs,
|
clippy::rest_pat_in_fully_bound_structs,
|
||||||
|
clippy::string_add_assign,
|
||||||
|
clippy::string_add,
|
||||||
|
clippy::string_to_string,
|
||||||
clippy::todo,
|
clippy::todo,
|
||||||
clippy::unimplemented,
|
clippy::unimplemented,
|
||||||
clippy::unnested_or_patterns,
|
clippy::unnested_or_patterns,
|
||||||
|
clippy::unused_self,
|
||||||
clippy::verbose_file_reads,
|
clippy::verbose_file_reads,
|
||||||
future_incompatible,
|
future_incompatible,
|
||||||
missing_crate_level_docs,
|
missing_crate_level_docs,
|
||||||
missing_doc_code_examples,
|
|
||||||
// missing_docs,
|
|
||||||
nonstandard_style,
|
nonstandard_style,
|
||||||
rust_2018_idioms,
|
rust_2018_idioms
|
||||||
unused_doc_comments,
|
|
||||||
)]
|
)]
|
||||||
#![allow(clippy::manual_range_contains)]
|
#![allow(clippy::manual_range_contains)]
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
pub fn adjust_colors(shape: &mut Shape, adjust_color: &impl Fn(&mut Color32)) {
|
pub fn adjust_colors(shape: &mut Shape, adjust_color: &impl Fn(&mut Color32)) {
|
||||||
|
#![allow(clippy::match_same_arms)]
|
||||||
match shape {
|
match shape {
|
||||||
Shape::Noop => {}
|
Shape::Noop => {}
|
||||||
Shape::Vec(shapes) => {
|
Shape::Vec(shapes) => {
|
||||||
|
|||||||
@@ -107,13 +107,20 @@ impl FontImpl {
|
|||||||
if glyph.id().0 == 0 {
|
if glyph.id().0 == 0 {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let glyph_info = allocate_glyph(
|
let mut glyph_info = allocate_glyph(
|
||||||
&mut self.atlas.lock(),
|
&mut self.atlas.lock(),
|
||||||
glyph,
|
glyph,
|
||||||
self.scale_in_pixels,
|
self.scale_in_pixels,
|
||||||
self.y_offset,
|
self.y_offset,
|
||||||
self.pixels_per_point,
|
self.pixels_per_point,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if c == '\t' {
|
||||||
|
if let Some(space) = self.glyph_info(' ') {
|
||||||
|
glyph_info.advance_width = 4.0 * space.advance_width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.glyph_info_cache.write().insert(c, glyph_info);
|
self.glyph_info_cache.write().insert(c, glyph_info);
|
||||||
Some(glyph_info)
|
Some(glyph_info)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,19 +12,26 @@
|
|||||||
clippy::all,
|
clippy::all,
|
||||||
clippy::await_holding_lock,
|
clippy::await_holding_lock,
|
||||||
clippy::dbg_macro,
|
clippy::dbg_macro,
|
||||||
|
clippy::debug_assert_with_mut_call,
|
||||||
clippy::doc_markdown,
|
clippy::doc_markdown,
|
||||||
clippy::empty_enum,
|
clippy::empty_enum,
|
||||||
clippy::enum_glob_use,
|
clippy::enum_glob_use,
|
||||||
clippy::exit,
|
clippy::exit,
|
||||||
|
clippy::explicit_into_iter_loop,
|
||||||
clippy::filter_map_next,
|
clippy::filter_map_next,
|
||||||
clippy::fn_params_excessive_bools,
|
clippy::fn_params_excessive_bools,
|
||||||
clippy::if_let_mutex,
|
clippy::if_let_mutex,
|
||||||
clippy::imprecise_flops,
|
clippy::imprecise_flops,
|
||||||
clippy::inefficient_to_string,
|
clippy::inefficient_to_string,
|
||||||
|
clippy::large_types_passed_by_value,
|
||||||
|
clippy::let_unit_value,
|
||||||
clippy::linkedlist,
|
clippy::linkedlist,
|
||||||
clippy::lossy_float_literal,
|
clippy::lossy_float_literal,
|
||||||
clippy::macro_use_imports,
|
clippy::macro_use_imports,
|
||||||
|
clippy::map_err_ignore,
|
||||||
|
clippy::map_flatten,
|
||||||
clippy::match_on_vec_items,
|
clippy::match_on_vec_items,
|
||||||
|
clippy::match_same_arms,
|
||||||
clippy::match_wildcard_for_single_variants,
|
clippy::match_wildcard_for_single_variants,
|
||||||
clippy::mem_forget,
|
clippy::mem_forget,
|
||||||
clippy::mismatched_target_os,
|
clippy::mismatched_target_os,
|
||||||
@@ -35,18 +42,22 @@
|
|||||||
clippy::needless_pass_by_value,
|
clippy::needless_pass_by_value,
|
||||||
clippy::option_option,
|
clippy::option_option,
|
||||||
clippy::pub_enum_variant_names,
|
clippy::pub_enum_variant_names,
|
||||||
|
clippy::ref_option_ref,
|
||||||
clippy::rest_pat_in_fully_bound_structs,
|
clippy::rest_pat_in_fully_bound_structs,
|
||||||
|
clippy::string_add_assign,
|
||||||
|
clippy::string_add,
|
||||||
|
clippy::string_to_string,
|
||||||
clippy::todo,
|
clippy::todo,
|
||||||
clippy::unimplemented,
|
clippy::unimplemented,
|
||||||
clippy::unnested_or_patterns,
|
clippy::unnested_or_patterns,
|
||||||
|
clippy::unused_self,
|
||||||
clippy::verbose_file_reads,
|
clippy::verbose_file_reads,
|
||||||
future_incompatible,
|
future_incompatible,
|
||||||
missing_crate_level_docs,
|
missing_crate_level_docs,
|
||||||
missing_doc_code_examples,
|
nonstandard_style,
|
||||||
missing_docs,
|
rust_2018_idioms
|
||||||
rust_2018_idioms,
|
|
||||||
unused_doc_comments
|
|
||||||
)]
|
)]
|
||||||
|
#![allow(clippy::manual_range_contains)]
|
||||||
|
|
||||||
pub use egui; // Re-export for user convenience
|
pub use egui; // Re-export for user convenience
|
||||||
|
|
||||||
@@ -172,10 +183,6 @@ impl<'a> Frame<'a> {
|
|||||||
self.0.output.window_size = Some(size);
|
self.0.output.window_size = Some(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Use [`egui::Context::set_pixels_per_point`] instead
|
|
||||||
#[deprecated = "Use egui::Context::set_pixels_per_point instead"]
|
|
||||||
pub fn set_pixels_per_point(&mut self, _: f32) {}
|
|
||||||
|
|
||||||
/// If you need to request a repaint from another thread, clone this and send it to that other thread.
|
/// If you need to request a repaint from another thread, clone this and send it to that other thread.
|
||||||
pub fn repaint_signal(&self) -> std::sync::Arc<dyn RepaintSignal> {
|
pub fn repaint_signal(&self) -> std::sync::Arc<dyn RepaintSignal> {
|
||||||
self.0.repaint_signal.clone()
|
self.0.repaint_signal.clone()
|
||||||
|
|||||||
Reference in New Issue
Block a user