Use Rust edition 2024 (#7280)
This commit is contained in:
parent
962c8e26a8
commit
b2995dcb83
|
|
@ -21,7 +21,7 @@ members = [
|
|||
]
|
||||
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
license = "MIT OR Apache-2.0"
|
||||
rust-version = "1.85"
|
||||
version = "0.31.1"
|
||||
|
|
@ -171,7 +171,6 @@ fn_params_excessive_bools = "warn"
|
|||
fn_to_numeric_cast_any = "warn"
|
||||
from_iter_instead_of_collect = "warn"
|
||||
get_unwrap = "warn"
|
||||
if_let_mutex = "warn"
|
||||
implicit_clone = "warn"
|
||||
implied_bounds_in_impls = "warn"
|
||||
imprecise_flops = "warn"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use super::{linear_f32_from_linear_u8, linear_u8_from_linear_f32, Color32, Hsva, HsvaGamma, Rgba};
|
||||
use super::{Color32, Hsva, HsvaGamma, Rgba, linear_f32_from_linear_u8, linear_u8_from_linear_f32};
|
||||
use cint::{Alpha, ColorInterop, EncodedSrgb, Hsv, LinearSrgb, PremultipliedAlpha};
|
||||
|
||||
// ---- Color32 ----
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{fast_round, linear_f32_from_linear_u8, Rgba};
|
||||
use crate::{Rgba, fast_round, linear_f32_from_linear_u8};
|
||||
|
||||
/// This format is used for space-efficient color representation (32 bits).
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
gamma_u8_from_linear_f32, linear_f32_from_gamma_u8, linear_u8_from_linear_f32, Color32, Rgba,
|
||||
Color32, Rgba, gamma_u8_from_linear_f32, linear_f32_from_gamma_u8, linear_u8_from_linear_f32,
|
||||
};
|
||||
|
||||
/// Hue, saturation, value, alpha. All in the range [0, 1].
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{gamma_from_linear, linear_from_gamma, Color32, Hsva, Rgba};
|
||||
use crate::{Color32, Hsva, Rgba, gamma_from_linear, linear_from_gamma};
|
||||
|
||||
/// Like Hsva but with the `v` value (brightness) being gamma corrected
|
||||
/// so that it is somewhat perceptually even.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ To use on Linux, first run:
|
|||
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
|
||||
```
|
||||
|
||||
You need to either use `edition = "2021"`, or set `resolver = "2"` in the `[workspace]` section of your to-level `Cargo.toml`. See [this link](https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html) for more info.
|
||||
You need to either use `edition = "2024"`, or set `resolver = "2"` in the `[workspace]` section of your to-level `Cargo.toml`. See [this link](https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html) for more info.
|
||||
|
||||
You can opt-in to the using [`egui-wgpu`](https://github.com/emilk/egui/tree/main/crates/egui-wgpu) for rendering by enabling the `wgpu` feature and setting `NativeOptions::renderer` to `Renderer::Wgpu`.
|
||||
|
||||
|
|
|
|||
|
|
@ -574,7 +574,9 @@ impl Default for Renderer {
|
|||
fn default() -> Self {
|
||||
#[cfg(not(feature = "glow"))]
|
||||
#[cfg(not(feature = "wgpu"))]
|
||||
compile_error!("eframe: you must enable at least one of the rendering backend features: 'glow' or 'wgpu'");
|
||||
compile_error!(
|
||||
"eframe: you must enable at least one of the rendering backend features: 'glow' or 'wgpu'"
|
||||
);
|
||||
|
||||
#[cfg(feature = "glow")]
|
||||
#[cfg(not(feature = "wgpu"))]
|
||||
|
|
@ -617,7 +619,9 @@ impl std::str::FromStr for Renderer {
|
|||
#[cfg(feature = "wgpu")]
|
||||
"wgpu" => Ok(Self::Wgpu),
|
||||
|
||||
_ => Err(format!("eframe renderer {name:?} is not available. Make sure that the corresponding eframe feature is enabled."))
|
||||
_ => Err(format!(
|
||||
"eframe renderer {name:?} is not available. Make sure that the corresponding eframe feature is enabled."
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ fn set_title_and_icon_mac(title: &str, icon_data: Option<&IconData>) -> AppIconS
|
|||
};
|
||||
|
||||
// TODO(madsmtm): Move this into `objc2-app-kit`
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
static NSApp: Option<&'static NSApplication>;
|
||||
}
|
||||
|
||||
|
|
@ -240,7 +240,9 @@ fn set_title_and_icon_mac(title: &str, icon_data: Option<&IconData>) -> AppIconS
|
|||
use objc2_app_kit::{NSBitmapImageRep, NSDeviceRGBColorSpace};
|
||||
use objc2_foundation::NSSize;
|
||||
|
||||
log::trace!("NSBitmapImageRep::initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel");
|
||||
log::trace!(
|
||||
"NSBitmapImageRep::initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel"
|
||||
);
|
||||
let Some(image_rep) = NSBitmapImageRep::initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel(
|
||||
NSBitmapImageRep::alloc(),
|
||||
[image.as_raw().as_ptr().cast_mut()].as_mut_ptr(),
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ fn roaming_appdata() -> Option<PathBuf> {
|
|||
use windows_sys::Win32::Foundation::S_OK;
|
||||
use windows_sys::Win32::System::Com::CoTaskMemFree;
|
||||
use windows_sys::Win32::UI::Shell::{
|
||||
FOLDERID_RoamingAppData, SHGetKnownFolderPath, KF_FLAG_DONT_VERIFY,
|
||||
FOLDERID_RoamingAppData, KF_FLAG_DONT_VERIFY, SHGetKnownFolderPath,
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
unsafe extern "C" {
|
||||
fn wcslen(buf: *const u16) -> usize;
|
||||
}
|
||||
let mut path_raw = ptr::null_mut();
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ use egui::{
|
|||
use egui_winit::accesskit_winit;
|
||||
|
||||
use crate::{
|
||||
native::epi_integration::EpiIntegration, App, AppCreator, CreationContext, NativeOptions,
|
||||
Result, Storage,
|
||||
App, AppCreator, CreationContext, NativeOptions, Result, Storage,
|
||||
native::epi_integration::EpiIntegration,
|
||||
};
|
||||
|
||||
use super::{
|
||||
epi_integration, event_loop_context,
|
||||
winit_integration::{create_egui_context, EventResult, UserEvent, WinitApp},
|
||||
winit_integration::{EventResult, UserEvent, WinitApp, create_egui_context},
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -1015,7 +1015,9 @@ impl GlutinWindowContext {
|
|||
let gl_context = match gl_context_result {
|
||||
Ok(it) => it,
|
||||
Err(err) => {
|
||||
log::warn!("Failed to create context using default context attributes {context_attributes:?} due to error: {err}");
|
||||
log::warn!(
|
||||
"Failed to create context using default context attributes {context_attributes:?} due to error: {err}"
|
||||
);
|
||||
log::debug!(
|
||||
"Retrying with fallback context attributes: {fallback_context_attributes:?}"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -10,9 +10,8 @@ use ahash::HashMap;
|
|||
|
||||
use super::winit_integration::{UserEvent, WinitApp};
|
||||
use crate::{
|
||||
epi,
|
||||
Result, epi,
|
||||
native::{event_loop_context, winit_integration::EventResult},
|
||||
Result,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ use egui_winit::accesskit_winit;
|
|||
use winit_integration::UserEvent;
|
||||
|
||||
use crate::{
|
||||
native::{epi_integration::EpiIntegration, winit_integration::EventResult},
|
||||
App, AppCreator, CreationContext, NativeOptions, Result, Storage,
|
||||
native::{epi_integration::EpiIntegration, winit_integration::EventResult},
|
||||
};
|
||||
|
||||
use super::{epi_integration, event_loop_context, winit_integration, winit_integration::WinitApp};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use egui::{TexturesDelta, UserData, ViewportCommand};
|
||||
|
||||
use crate::{epi, App};
|
||||
use crate::{App, epi};
|
||||
|
||||
use super::{now_sec, text_agent::TextAgent, web_painter::WebPainter as _, NeedRepaint};
|
||||
use super::{NeedRepaint, now_sec, text_agent::TextAgent, web_painter::WebPainter as _};
|
||||
|
||||
pub struct AppRunner {
|
||||
#[allow(dead_code, clippy::allow_attributes)]
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
use crate::web::string_from_js_value;
|
||||
|
||||
use super::{
|
||||
button_from_mouse_event, location_hash, modifiers_from_kb_event, modifiers_from_mouse_event,
|
||||
modifiers_from_wheel_event, native_pixels_per_point, pos_from_mouse_event,
|
||||
prefers_color_scheme_dark, primary_touch_pos, push_touches, text_from_keyboard_event,
|
||||
theme_from_dark_mode, translate_key, AppRunner, Closure, JsCast as _, JsValue, WebRunner,
|
||||
DEBUG_RESIZE,
|
||||
AppRunner, Closure, DEBUG_RESIZE, JsCast as _, JsValue, WebRunner, button_from_mouse_event,
|
||||
location_hash, modifiers_from_kb_event, modifiers_from_mouse_event, modifiers_from_wheel_event,
|
||||
native_pixels_per_point, pos_from_mouse_event, prefers_color_scheme_dark, primary_touch_pos,
|
||||
push_touches, text_from_keyboard_event, theme_from_dark_mode, translate_key,
|
||||
};
|
||||
|
||||
use web_sys::{Document, EventTarget, ShadowRoot};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use super::{canvas_content_rect, AppRunner};
|
||||
use super::{AppRunner, canvas_content_rect};
|
||||
|
||||
pub fn pos_from_mouse_event(
|
||||
canvas: &web_sys::HtmlCanvasElement,
|
||||
|
|
|
|||
|
|
@ -126,12 +126,17 @@ fn shorten_file_path(file_path: &str) -> &str {
|
|||
#[test]
|
||||
fn test_shorten_file_path() {
|
||||
for (before, after) in [
|
||||
("/Users/emilk/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.24.1/src/runtime/runtime.rs", "tokio-1.24.1/src/runtime/runtime.rs"),
|
||||
(
|
||||
"/Users/emilk/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.24.1/src/runtime/runtime.rs",
|
||||
"tokio-1.24.1/src/runtime/runtime.rs",
|
||||
),
|
||||
("crates/rerun/src/main.rs", "rerun/src/main.rs"),
|
||||
("/rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/ops/function.rs", "core/src/ops/function.rs"),
|
||||
(
|
||||
"/rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/ops/function.rs",
|
||||
"core/src/ops/function.rs",
|
||||
),
|
||||
("/weird/path/file.rs", "/weird/path/file.rs"),
|
||||
]
|
||||
{
|
||||
] {
|
||||
assert_eq!(shorten_file_path(before), after);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||
use super::web_painter::WebPainter;
|
||||
use crate::WebOptions;
|
||||
use egui::{Event, UserData, ViewportId};
|
||||
use egui_wgpu::capture::{capture_channel, CaptureReceiver, CaptureSender, CaptureState};
|
||||
use egui_wgpu::capture::{CaptureReceiver, CaptureSender, CaptureState, capture_channel};
|
||||
use egui_wgpu::{RenderState, SurfaceErrorAction};
|
||||
use wasm_bindgen::JsValue;
|
||||
use web_sys::HtmlCanvasElement;
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ use std::{cell::RefCell, rc::Rc};
|
|||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
use crate::{epi, App};
|
||||
use crate::{App, epi};
|
||||
|
||||
use super::{
|
||||
AppRunner, PanicHandler,
|
||||
events::{self, ResizeObserverContext},
|
||||
text_agent::TextAgent,
|
||||
AppRunner, PanicHandler,
|
||||
};
|
||||
|
||||
/// This is how `eframe` runs your web application
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use egui::{UserData, ViewportId};
|
||||
use epaint::ColorImage;
|
||||
use std::sync::{mpsc, Arc};
|
||||
use std::sync::{Arc, mpsc};
|
||||
use wgpu::{BindGroupLayout, MultisampleState, StoreOp};
|
||||
|
||||
/// A texture and a buffer for reading the rendered frame back to the cpu.
|
||||
|
|
@ -196,7 +196,10 @@ impl CaptureState {
|
|||
wgpu::TextureFormat::Rgba8Unorm => [0, 1, 2, 3],
|
||||
wgpu::TextureFormat::Bgra8Unorm => [2, 1, 0, 3],
|
||||
_ => {
|
||||
log::error!("Screen can't be captured unless the surface format is Rgba8Unorm or Bgra8Unorm. Current surface format is {:?}", format);
|
||||
log::error!(
|
||||
"Screen can't be captured unless the surface format is Rgba8Unorm or Bgra8Unorm. Current surface format is {:?}",
|
||||
format
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use std::{borrow::Cow, num::NonZeroU64, ops::Range};
|
||||
|
||||
use ahash::HashMap;
|
||||
use epaint::{emath::NumExt as _, PaintCallbackInfo, Primitive, Vertex};
|
||||
use epaint::{PaintCallbackInfo, Primitive, Vertex, emath::NumExt as _};
|
||||
|
||||
use wgpu::util::DeviceExt as _;
|
||||
|
||||
|
|
@ -909,7 +909,11 @@ impl Renderer {
|
|||
);
|
||||
|
||||
let Some(mut index_buffer_staging) = index_buffer_staging else {
|
||||
panic!("Failed to create staging buffer for index data. Index count: {index_count}. Required index buffer size: {required_index_buffer_size}. Actual size {} and capacity: {} (bytes)", self.index_buffer.buffer.size(), self.index_buffer.capacity);
|
||||
panic!(
|
||||
"Failed to create staging buffer for index data. Index count: {index_count}. Required index buffer size: {required_index_buffer_size}. Actual size {} and capacity: {} (bytes)",
|
||||
self.index_buffer.buffer.size(),
|
||||
self.index_buffer.capacity
|
||||
);
|
||||
};
|
||||
|
||||
let mut index_offset = 0;
|
||||
|
|
@ -948,7 +952,11 @@ impl Renderer {
|
|||
);
|
||||
|
||||
let Some(mut vertex_buffer_staging) = vertex_buffer_staging else {
|
||||
panic!("Failed to create staging buffer for vertex data. Vertex count: {vertex_count}. Required vertex buffer size: {required_vertex_buffer_size}. Actual size {} and capacity: {} (bytes)", self.vertex_buffer.buffer.size(), self.vertex_buffer.capacity);
|
||||
panic!(
|
||||
"Failed to create staging buffer for vertex data. Vertex count: {vertex_count}. Required vertex buffer size: {required_vertex_buffer_size}. Actual size {} and capacity: {} (bytes)",
|
||||
self.vertex_buffer.buffer.size(),
|
||||
self.vertex_buffer.capacity
|
||||
);
|
||||
};
|
||||
|
||||
let mut vertex_offset = 0;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#![allow(clippy::missing_errors_doc)]
|
||||
#![allow(clippy::undocumented_unsafe_blocks)]
|
||||
|
||||
use crate::capture::{capture_channel, CaptureReceiver, CaptureSender, CaptureState};
|
||||
use crate::{renderer, RenderState, SurfaceErrorAction, WgpuConfiguration};
|
||||
use crate::capture::{CaptureReceiver, CaptureSender, CaptureState, capture_channel};
|
||||
use crate::{RenderState, SurfaceErrorAction, WgpuConfiguration, renderer};
|
||||
use egui::{Context, Event, UserData, ViewportId, ViewportIdMap, ViewportIdSet};
|
||||
use std::{num::NonZeroU32, sync::Arc};
|
||||
|
||||
|
|
@ -220,7 +220,9 @@ impl Painter {
|
|||
} else if supported_alpha_modes.contains(&wgpu::CompositeAlphaMode::PostMultiplied) {
|
||||
wgpu::CompositeAlphaMode::PostMultiplied
|
||||
} else {
|
||||
log::warn!("Transparent window was requested, but the active wgpu surface does not support a `CompositeAlphaMode` with transparency.");
|
||||
log::warn!(
|
||||
"Transparent window was requested, but the active wgpu surface does not support a `CompositeAlphaMode` with transparency."
|
||||
);
|
||||
wgpu::CompositeAlphaMode::Auto
|
||||
}
|
||||
} else {
|
||||
|
|
@ -344,7 +346,9 @@ impl Painter {
|
|||
height_in_pixels,
|
||||
);
|
||||
} else {
|
||||
log::warn!("Ignoring window resize notification with no surface created via Painter::set_window()");
|
||||
log::warn!(
|
||||
"Ignoring window resize notification with no surface created via Painter::set_window()"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,9 @@ impl Clipboard {
|
|||
return;
|
||||
}
|
||||
|
||||
log::error!("Copying images is not supported. Enable the 'clipboard' feature of `egui-winit` to enable it.");
|
||||
log::error!(
|
||||
"Copying images is not supported. Enable the 'clipboard' feature of `egui-winit` to enable it."
|
||||
);
|
||||
_ = image;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
emath::{remap_clamp, NumExt as _},
|
||||
Id, IdMap, InputState,
|
||||
emath::{NumExt as _, remap_clamp},
|
||||
};
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
|
|
|
|||
|
|
@ -204,12 +204,17 @@ fn shorten_source_file_path(path: &std::path::Path) -> String {
|
|||
#[test]
|
||||
fn test_shorten_path() {
|
||||
for (before, after) in [
|
||||
("/Users/emilk/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.24.1/src/runtime/runtime.rs", "tokio-1.24.1/src/runtime/runtime.rs"),
|
||||
(
|
||||
"/Users/emilk/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.24.1/src/runtime/runtime.rs",
|
||||
"tokio-1.24.1/src/runtime/runtime.rs",
|
||||
),
|
||||
("crates/rerun/src/main.rs", "rerun/src/main.rs"),
|
||||
("/rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/ops/function.rs", "core/src/ops/function.rs"),
|
||||
(
|
||||
"/rustc/d5a82bbd26e1ad8b7401f6a718a9c57c96905483/library/core/src/ops/function.rs",
|
||||
"core/src/ops/function.rs",
|
||||
),
|
||||
("/weird/path/file.rs", "/weird/path/file.rs"),
|
||||
]
|
||||
{
|
||||
] {
|
||||
use std::str::FromStr as _;
|
||||
let before = std::path::PathBuf::from_str(before).unwrap();
|
||||
assert_eq!(shorten_source_file_path(&before), after);
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
use emath::GuiRounding as _;
|
||||
|
||||
use crate::{
|
||||
emath, pos2, Align2, Context, Id, InnerResponse, LayerId, Layout, NumExt as _, Order, Pos2,
|
||||
Rect, Response, Sense, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, WidgetRect, WidgetWithState,
|
||||
Align2, Context, Id, InnerResponse, LayerId, Layout, NumExt as _, Order, Pos2, Rect, Response,
|
||||
Sense, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, WidgetRect, WidgetWithState, emath, pos2,
|
||||
};
|
||||
|
||||
/// State of an [`Area`] that is persisted between frames.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use std::hash::Hash;
|
||||
|
||||
use crate::{
|
||||
emath, epaint, pos2, remap, remap_clamp, vec2, Context, Id, InnerResponse, NumExt as _, Rect,
|
||||
Response, Sense, Stroke, TextStyle, TextWrapMode, Ui, UiBuilder, UiKind, UiStackInfo, Vec2,
|
||||
WidgetInfo, WidgetText, WidgetType,
|
||||
Context, Id, InnerResponse, NumExt as _, Rect, Response, Sense, Stroke, TextStyle,
|
||||
TextWrapMode, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, WidgetInfo, WidgetText, WidgetType,
|
||||
emath, epaint, pos2, remap, remap_clamp, vec2,
|
||||
};
|
||||
use emath::GuiRounding as _;
|
||||
use epaint::{Shape, StrokeKind};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use epaint::Shape;
|
||||
|
||||
use crate::{
|
||||
epaint, style::StyleModifier, style::WidgetVisuals, vec2, Align2, Context, Id, InnerResponse,
|
||||
NumExt as _, Painter, Popup, PopupCloseBehavior, Rect, Response, ScrollArea, Sense, Stroke,
|
||||
TextStyle, TextWrapMode, Ui, UiBuilder, Vec2, WidgetInfo, WidgetText, WidgetType,
|
||||
Align2, Context, Id, InnerResponse, NumExt as _, Painter, Popup, PopupCloseBehavior, Rect,
|
||||
Response, ScrollArea, Sense, Stroke, TextStyle, TextWrapMode, Ui, UiBuilder, Vec2, WidgetInfo,
|
||||
WidgetText, WidgetType, epaint, style::StyleModifier, style::WidgetVisuals, vec2,
|
||||
};
|
||||
|
||||
#[expect(unused_imports)] // Documentation
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
//! Frame container
|
||||
|
||||
use crate::{
|
||||
epaint, layers::ShapeIdx, InnerResponse, Response, Sense, Style, Ui, UiBuilder, UiKind,
|
||||
UiStackInfo,
|
||||
InnerResponse, Response, Sense, Style, Ui, UiBuilder, UiKind, UiStackInfo, epaint,
|
||||
layers::ShapeIdx,
|
||||
};
|
||||
use epaint::{Color32, CornerRadius, Margin, MarginF32, Rect, Shadow, Shape, Stroke};
|
||||
|
||||
|
|
@ -143,7 +143,8 @@ pub struct Frame {
|
|||
#[test]
|
||||
fn frame_size() {
|
||||
assert_eq!(
|
||||
std::mem::size_of::<Frame>(), 32,
|
||||
std::mem::size_of::<Frame>(),
|
||||
32,
|
||||
"Frame changed size! If it shrank - good! Update this test. If it grew - bad! Try to find a way to avoid it."
|
||||
);
|
||||
assert!(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::{
|
|||
Button, Color32, Context, Frame, Id, InnerResponse, IntoAtoms, Layout, Popup,
|
||||
PopupCloseBehavior, Response, Style, Ui, UiBuilder, UiKind, UiStack, UiStackInfo, Widget as _,
|
||||
};
|
||||
use emath::{vec2, Align, RectAlign, Vec2};
|
||||
use emath::{Align, RectAlign, Vec2, vec2};
|
||||
use epaint::Stroke;
|
||||
|
||||
/// Apply a menu style to the [`Style`].
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
use emath::GuiRounding as _;
|
||||
|
||||
use crate::{
|
||||
lerp, vec2, Align, Context, CursorIcon, Frame, Id, InnerResponse, LayerId, Layout, NumExt as _,
|
||||
Rangef, Rect, Sense, Stroke, Ui, UiBuilder, UiKind, UiStackInfo, Vec2,
|
||||
Align, Context, CursorIcon, Frame, Id, InnerResponse, LayerId, Layout, NumExt as _, Rangef,
|
||||
Rect, Sense, Stroke, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, lerp, vec2,
|
||||
};
|
||||
|
||||
fn animate_expansion(ctx: &Context, id: Id, is_expanded: bool) -> f32 {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use crate::containers::menu::{menu_style, MenuConfig, MenuState};
|
||||
use crate::containers::menu::{MenuConfig, MenuState, menu_style};
|
||||
use crate::style::StyleModifier;
|
||||
use crate::{
|
||||
Area, AreaState, Context, Frame, Id, InnerResponse, Key, LayerId, Layout, Order, Response,
|
||||
Sense, Ui, UiKind, UiStackInfo,
|
||||
};
|
||||
use emath::{vec2, Align, Pos2, Rect, RectAlign, Vec2};
|
||||
use emath::{Align, Pos2, Rect, RectAlign, Vec2, vec2};
|
||||
use std::iter::once;
|
||||
|
||||
/// What should we anchor the popup to?
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
pos2, vec2, Align2, Color32, Context, CursorIcon, Id, NumExt as _, Rect, Response, Sense,
|
||||
Shape, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, Vec2b,
|
||||
Align2, Color32, Context, CursorIcon, Id, NumExt as _, Rect, Response, Sense, Shape, Ui,
|
||||
UiBuilder, UiKind, UiStackInfo, Vec2, Vec2b, pos2, vec2,
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ use core::f32;
|
|||
use emath::{GuiRounding as _, Pos2};
|
||||
|
||||
use crate::{
|
||||
emath::TSTransform, InnerResponse, LayerId, PointerButton, Rangef, Rect, Response, Sense, Ui,
|
||||
UiBuilder, Vec2,
|
||||
InnerResponse, LayerId, PointerButton, Rangef, Rect, Response, Sense, Ui, UiBuilder, Vec2,
|
||||
emath::TSTransform,
|
||||
};
|
||||
|
||||
/// Creates a transformation that fits a given scene rectangle into the available screen size.
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
use std::ops::{Add, AddAssign, BitOr, BitOrAssign};
|
||||
|
||||
use crate::{
|
||||
emath, epaint, lerp, pass_state, pos2, remap, remap_clamp, Context, CursorIcon, Id,
|
||||
NumExt as _, Pos2, Rangef, Rect, Sense, Ui, UiBuilder, UiKind, UiStackInfo, Vec2, Vec2b,
|
||||
Context, CursorIcon, Id, NumExt as _, Pos2, Rangef, Rect, Sense, Ui, UiBuilder, UiKind,
|
||||
UiStackInfo, Vec2, Vec2b, emath, epaint, lerp, pass_state, pos2, remap, remap_clamp,
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use crate::collapsing_header::CollapsingState;
|
|||
use crate::*;
|
||||
|
||||
use super::scroll_area::{ScrollBarVisibility, ScrollSource};
|
||||
use super::{area, resize, Area, Frame, Resize, ScrollArea};
|
||||
use super::{Area, Frame, Resize, ScrollArea, area, resize};
|
||||
|
||||
/// Builder for a floating window which can be dragged, closed, collapsed, resized and scrolled (off by default).
|
||||
///
|
||||
|
|
|
|||
|
|
@ -4,16 +4,23 @@ use std::{borrow::Cow, cell::RefCell, panic::Location, sync::Arc, time::Duration
|
|||
|
||||
use emath::{GuiRounding as _, OrderedFloat};
|
||||
use epaint::{
|
||||
ClippedPrimitive, ClippedShape, Color32, ImageData, ImageDelta, Pos2, Rect, StrokeKind,
|
||||
TessellationOptions, TextureAtlas, TextureId, Vec2,
|
||||
emath::{self, TSTransform},
|
||||
mutex::RwLock,
|
||||
stats::PaintStats,
|
||||
tessellator,
|
||||
text::{FontInsert, FontPriority, Fonts},
|
||||
vec2, ClippedPrimitive, ClippedShape, Color32, ImageData, ImageDelta, Pos2, Rect, StrokeKind,
|
||||
TessellationOptions, TextureAtlas, TextureId, Vec2,
|
||||
vec2,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
Align2, CursorIcon, DeferredViewportUiCallback, FontDefinitions, Grid, Id, ImmediateViewport,
|
||||
ImmediateViewportRendererCallback, Key, KeyboardShortcut, Label, LayerId, Memory,
|
||||
ModifierNames, Modifiers, NumExt as _, Order, Painter, RawInput, Response, RichText,
|
||||
ScrollArea, Sense, Style, TextStyle, TextureHandle, TextureOptions, Ui, ViewportBuilder,
|
||||
ViewportCommand, ViewportId, ViewportIdMap, ViewportIdPair, ViewportIdSet, ViewportOutput,
|
||||
Widget as _, WidgetRect, WidgetText,
|
||||
animation_manager::AnimationManager,
|
||||
containers::{self, area::AreaState},
|
||||
data::output::PlatformOutput,
|
||||
|
|
@ -29,12 +36,6 @@ use crate::{
|
|||
resize, response, scroll_area,
|
||||
util::IdTypeMap,
|
||||
viewport::ViewportClass,
|
||||
Align2, CursorIcon, DeferredViewportUiCallback, FontDefinitions, Grid, Id, ImmediateViewport,
|
||||
ImmediateViewportRendererCallback, Key, KeyboardShortcut, Label, LayerId, Memory,
|
||||
ModifierNames, Modifiers, NumExt as _, Order, Painter, RawInput, Response, RichText,
|
||||
ScrollArea, Sense, Style, TextStyle, TextureHandle, TextureOptions, Ui, ViewportBuilder,
|
||||
ViewportCommand, ViewportId, ViewportIdMap, ViewportIdPair, ViewportIdSet, ViewportOutput,
|
||||
Widget as _, WidgetRect, WidgetText,
|
||||
};
|
||||
|
||||
#[cfg(feature = "accesskit")]
|
||||
|
|
@ -860,7 +861,10 @@ impl Context {
|
|||
|
||||
if max_passes <= output.platform_output.num_completed_passes {
|
||||
#[cfg(feature = "log")]
|
||||
log::debug!("Ignoring call request_discard, because max_passes={max_passes}. Requested from {:?}", output.platform_output.request_discard_reasons);
|
||||
log::debug!(
|
||||
"Ignoring call request_discard, because max_passes={max_passes}. Requested from {:?}",
|
||||
output.platform_output.request_discard_reasons
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -2353,7 +2357,9 @@ impl Context {
|
|||
// If you see this message, it means we've been paying the cost of multi-pass for multiple frames in a row.
|
||||
// This is likely a bug. `request_discard` should only be called in rare situations, when some layout changes.
|
||||
|
||||
let mut warning = format!("egui PERF WARNING: request_discard has been called {num_multipass_in_row} frames in a row");
|
||||
let mut warning = format!(
|
||||
"egui PERF WARNING: request_discard has been called {num_multipass_in_row} frames in a row"
|
||||
);
|
||||
self.viewport(|vp| {
|
||||
for reason in &vp.output.request_discard_reasons {
|
||||
warning += &format!("\n {reason}");
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
use epaint::ColorImage;
|
||||
|
||||
use crate::{
|
||||
emath::{Pos2, Rect, Vec2},
|
||||
Key, Theme, ViewportId, ViewportIdMap,
|
||||
emath::{Pos2, Rect, Vec2},
|
||||
};
|
||||
|
||||
/// What the integrations provides to egui at the start of each frame.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
//! to get callbacks on certain events ([`Context::on_begin_pass`], [`Context::on_end_pass`]).
|
||||
|
||||
use crate::{
|
||||
text, Align, Align2, Color32, Context, FontFamily, FontId, Id, Rect, Shape, Vec2, WidgetText,
|
||||
Align, Align2, Color32, Context, FontFamily, FontId, Id, Rect, Shape, Vec2, WidgetText, text,
|
||||
};
|
||||
|
||||
/// Register this plugin on the given egui context,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use emath::GuiRounding as _;
|
||||
|
||||
use crate::{
|
||||
vec2, Align2, Color32, Context, Id, InnerResponse, NumExt as _, Painter, Rect, Region, Style,
|
||||
Ui, UiBuilder, Vec2,
|
||||
Align2, Color32, Context, Id, InnerResponse, NumExt as _, Painter, Rect, Region, Style, Ui,
|
||||
UiBuilder, Vec2, vec2,
|
||||
};
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use ahash::HashMap;
|
|||
|
||||
use emath::TSTransform;
|
||||
|
||||
use crate::{ahash, emath, id::IdSet, LayerId, Pos2, Rect, Sense, WidgetRect, WidgetRects};
|
||||
use crate::{LayerId, Pos2, Rect, Sense, WidgetRect, WidgetRects, ahash, emath, id::IdSet};
|
||||
|
||||
/// Result of a hit-test against [`WidgetRects`].
|
||||
///
|
||||
|
|
@ -466,7 +466,7 @@ fn should_prioritize_hits_on_back(back: Rect, front: Rect) -> bool {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use emath::{pos2, vec2, Rect};
|
||||
use emath::{Rect, pos2, vec2};
|
||||
|
||||
use crate::{Id, Sense};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
mod touch_state;
|
||||
|
||||
use crate::data::input::{
|
||||
Event, EventFilter, KeyboardShortcut, Modifiers, MouseWheelUnit, PointerButton, RawInput,
|
||||
TouchDeviceId, ViewportInfo, NUM_POINTER_BUTTONS,
|
||||
Event, EventFilter, KeyboardShortcut, Modifiers, MouseWheelUnit, NUM_POINTER_BUTTONS,
|
||||
PointerButton, RawInput, TouchDeviceId, ViewportInfo,
|
||||
};
|
||||
use crate::{
|
||||
emath::{vec2, NumExt as _, Pos2, Rect, Vec2},
|
||||
emath::{NumExt as _, Pos2, Rect, Vec2, vec2},
|
||||
util::History,
|
||||
};
|
||||
use std::{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use std::{collections::BTreeMap, fmt::Debug};
|
||||
|
||||
use crate::{
|
||||
data::input::TouchDeviceId,
|
||||
emath::{normalized_angle, Pos2, Vec2},
|
||||
Event, RawInput, TouchId, TouchPhase,
|
||||
data::input::TouchDeviceId,
|
||||
emath::{Pos2, Vec2, normalized_angle},
|
||||
};
|
||||
|
||||
/// All you probably need to know about a multi-touch gesture.
|
||||
|
|
@ -174,7 +174,7 @@ impl TouchState {
|
|||
if added_or_removed_touches {
|
||||
// Adding or removing fingers makes the average values "jump". We better forget
|
||||
// about the previous values, and don't create delta information for this frame:
|
||||
if let Some(ref mut state) = &mut self.gesture_state {
|
||||
if let Some(state) = &mut self.gesture_state {
|
||||
state.previous = None;
|
||||
}
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ impl TouchState {
|
|||
|
||||
fn update_gesture(&mut self, time: f64, pointer_pos: Option<Pos2>) {
|
||||
if let Some(dyn_state) = self.calc_dynamic_state() {
|
||||
if let Some(ref mut state) = &mut self.gesture_state {
|
||||
if let Some(state) = &mut self.gesture_state {
|
||||
// updating an ongoing gesture
|
||||
state.previous = Some(state.current);
|
||||
state.current = dyn_state;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//! How mouse and touch interzcts with widgets.
|
||||
|
||||
use crate::{hit_test, id, input_state, memory, Id, InputState, Key, WidgetRects};
|
||||
use crate::{Id, InputState, Key, WidgetRects, hit_test, id, input_state, memory};
|
||||
|
||||
use self::{hit_test::WidgetHits, id::IdSet, input_state::PointerEvent, memory::InteractionState};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
//! Showing UI:s for egui/epaint types.
|
||||
use crate::{
|
||||
epaint, memory, pos2, remap_clamp, vec2, Color32, CursorIcon, FontFamily, FontId, Label, Mesh,
|
||||
NumExt as _, Rect, Response, Sense, Shape, Slider, TextStyle, TextWrapMode, Ui, Widget,
|
||||
Color32, CursorIcon, FontFamily, FontId, Label, Mesh, NumExt as _, Rect, Response, Sense,
|
||||
Shape, Slider, TextStyle, TextWrapMode, Ui, Widget, epaint, memory, pos2, remap_clamp, vec2,
|
||||
};
|
||||
|
||||
pub fn font_family_ui(ui: &mut Ui, font_family: &mut FontFamily) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
//! Handles paint layers, i.e. how things
|
||||
//! are sometimes painted behind or in front of other things.
|
||||
|
||||
use crate::{ahash, epaint, Id, IdMap, Rect};
|
||||
use epaint::{emath::TSTransform, ClippedShape, Shape};
|
||||
use crate::{Id, IdMap, Rect, ahash, epaint};
|
||||
use epaint::{ClippedShape, Shape, emath::TSTransform};
|
||||
|
||||
/// Different layer categories
|
||||
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Ord, PartialOrd)]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use emath::GuiRounding as _;
|
||||
|
||||
use crate::{
|
||||
emath::{pos2, vec2, Align2, NumExt as _, Pos2, Rect, Vec2},
|
||||
Align,
|
||||
emath::{Align2, NumExt as _, Pos2, Rect, Vec2, pos2, vec2},
|
||||
};
|
||||
const INFINITY: f32 = f32::INFINITY;
|
||||
|
||||
|
|
|
|||
|
|
@ -463,22 +463,21 @@ pub use epaint::emath;
|
|||
pub use ecolor::hex_color;
|
||||
pub use ecolor::{Color32, Rgba};
|
||||
pub use emath::{
|
||||
lerp, pos2, remap, remap_clamp, vec2, Align, Align2, NumExt, Pos2, Rangef, Rect, RectAlign,
|
||||
Vec2, Vec2b,
|
||||
Align, Align2, NumExt, Pos2, Rangef, Rect, RectAlign, Vec2, Vec2b, lerp, pos2, remap,
|
||||
remap_clamp, vec2,
|
||||
};
|
||||
pub use epaint::{
|
||||
mutex,
|
||||
ClippedPrimitive, ColorImage, CornerRadius, FontImage, ImageData, Margin, Mesh, PaintCallback,
|
||||
PaintCallbackInfo, Shadow, Shape, Stroke, StrokeKind, TextureHandle, TextureId, mutex,
|
||||
text::{FontData, FontDefinitions, FontFamily, FontId, FontTweak},
|
||||
textures::{TextureFilter, TextureOptions, TextureWrapMode, TexturesDelta},
|
||||
ClippedPrimitive, ColorImage, CornerRadius, FontImage, ImageData, Margin, Mesh, PaintCallback,
|
||||
PaintCallbackInfo, Shadow, Shape, Stroke, StrokeKind, TextureHandle, TextureId,
|
||||
};
|
||||
|
||||
pub mod text {
|
||||
pub use crate::text_selection::CCursorRange;
|
||||
pub use epaint::text::{
|
||||
cursor::CCursor, FontData, FontDefinitions, FontFamily, Fonts, Galley, LayoutJob,
|
||||
LayoutSection, TextFormat, TextWrapping, TAB_SIZE,
|
||||
FontData, FontDefinitions, FontFamily, Fonts, Galley, LayoutJob, LayoutSection, TAB_SIZE,
|
||||
TextFormat, TextWrapping, cursor::CCursor,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -487,12 +486,12 @@ pub use self::{
|
|||
containers::*,
|
||||
context::{Context, RepaintCause, RequestRepaintInfo},
|
||||
data::{
|
||||
Key, UserData,
|
||||
input::*,
|
||||
output::{
|
||||
self, CursorIcon, FullOutput, OpenUrl, OutputCommand, PlatformOutput,
|
||||
UserAttentionType, WidgetInfo,
|
||||
},
|
||||
Key, UserData,
|
||||
},
|
||||
drag_and_drop::DragAndDrop,
|
||||
epaint::text::TextWrapMode,
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ use std::{
|
|||
use ahash::HashMap;
|
||||
|
||||
use emath::{Float as _, OrderedFloat};
|
||||
use epaint::{mutex::Mutex, textures::TextureOptions, ColorImage, TextureHandle, TextureId, Vec2};
|
||||
use epaint::{ColorImage, TextureHandle, TextureId, Vec2, mutex::Mutex, textures::TextureOptions};
|
||||
|
||||
use crate::Context;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use super::{
|
||||
generate_loader_id, Bytes, BytesLoadResult, BytesLoader, BytesPoll, Context, Cow, HashMap,
|
||||
LoadError, Mutex,
|
||||
Bytes, BytesLoadResult, BytesLoader, BytesPoll, Context, Cow, HashMap, LoadError, Mutex,
|
||||
generate_loader_id,
|
||||
};
|
||||
|
||||
/// Maps URI:s to [`Bytes`], e.g. found with `include_bytes!`.
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ use ahash::{HashMap, HashSet};
|
|||
use epaint::emath::TSTransform;
|
||||
|
||||
use crate::{
|
||||
area, vec2, EventFilter, Id, IdMap, LayerId, Order, Pos2, Rangef, RawInput, Rect, Style, Vec2,
|
||||
ViewportId, ViewportIdMap, ViewportIdSet,
|
||||
EventFilter, Id, IdMap, LayerId, Order, Pos2, Rangef, RawInput, Rect, Style, Vec2, ViewportId,
|
||||
ViewportIdMap, ViewportIdSet, area, vec2,
|
||||
};
|
||||
|
||||
mod theme;
|
||||
|
|
@ -377,8 +377,8 @@ impl Options {
|
|||
reduce_texture_memory,
|
||||
} = self;
|
||||
|
||||
use crate::containers::CollapsingHeader;
|
||||
use crate::Widget as _;
|
||||
use crate::containers::CollapsingHeader;
|
||||
|
||||
CollapsingHeader::new("⚙ Options")
|
||||
.default_open(false)
|
||||
|
|
@ -1250,8 +1250,11 @@ impl Areas {
|
|||
///
|
||||
/// The two layers must have the same [`LayerId::order`].
|
||||
pub fn set_sublayer(&mut self, parent: LayerId, child: LayerId) {
|
||||
debug_assert_eq!(parent.order, child.order,
|
||||
"DEBUG ASSERT: Trying to set sublayers across layers of different order ({:?}, {:?}), which is currently undefined behavior in egui", parent.order, child.order);
|
||||
debug_assert_eq!(
|
||||
parent.order, child.order,
|
||||
"DEBUG ASSERT: Trying to set sublayers across layers of different order ({:?}, {:?}), which is currently undefined behavior in egui",
|
||||
parent.order, child.order
|
||||
);
|
||||
|
||||
self.sublayers.entry(parent).or_default().insert(child);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,7 @@ impl Theme {
|
|||
|
||||
/// Chooses between [`Self::Dark`] or [`Self::Light`] based on a boolean value.
|
||||
pub fn from_dark_mode(dark_mode: bool) -> Self {
|
||||
if dark_mode {
|
||||
Self::Dark
|
||||
} else {
|
||||
Self::Light
|
||||
}
|
||||
if dark_mode { Self::Dark } else { Self::Light }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,14 +17,13 @@
|
|||
//! ```
|
||||
|
||||
use super::{
|
||||
style::WidgetVisuals, Align, Context, Id, InnerResponse, PointerState, Pos2, Rect, Response,
|
||||
Sense, TextStyle, Ui, Vec2,
|
||||
Align, Context, Id, InnerResponse, PointerState, Pos2, Rect, Response, Sense, TextStyle, Ui,
|
||||
Vec2, style::WidgetVisuals,
|
||||
};
|
||||
use crate::{
|
||||
epaint, vec2,
|
||||
widgets::{Button, ImageButton},
|
||||
Align2, Area, Color32, Frame, Key, LayerId, Layout, NumExt as _, Order, Stroke, Style,
|
||||
TextWrapMode, UiKind, WidgetText,
|
||||
TextWrapMode, UiKind, WidgetText, epaint, vec2,
|
||||
widgets::{Button, ImageButton},
|
||||
};
|
||||
use epaint::mutex::RwLock;
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ impl OperatingSystem {
|
|||
#[cfg(feature = "log")]
|
||||
log::warn!(
|
||||
"egui: Failed to guess operating system from User-Agent {:?}. Please file an issue at https://github.com/emilk/egui/issues",
|
||||
user_agent);
|
||||
user_agent
|
||||
);
|
||||
|
||||
Self::Unknown
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ use std::sync::Arc;
|
|||
|
||||
use emath::GuiRounding as _;
|
||||
use epaint::{
|
||||
text::{Fonts, Galley, LayoutJob},
|
||||
CircleShape, ClippedShape, CornerRadius, PathStroke, RectShape, Shape, Stroke, StrokeKind,
|
||||
text::{Fonts, Galley, LayoutJob},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
Color32, Context, FontId,
|
||||
emath::{Align2, Pos2, Rangef, Rect, Vec2},
|
||||
layers::{LayerId, PaintList, ShapeIdx},
|
||||
Color32, Context, FontId,
|
||||
};
|
||||
|
||||
/// Helper to paint shapes and text to a specific region on a specific layer.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use ahash::HashMap;
|
||||
|
||||
use crate::{id::IdSet, style, Align, Id, IdMap, LayerId, Rangef, Rect, Vec2, WidgetRects};
|
||||
use crate::{Align, Id, IdMap, LayerId, Rangef, Rect, Vec2, WidgetRects, id::IdSet, style};
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
use crate::{pos2, Align2, Color32, FontId, NumExt as _, Painter};
|
||||
use crate::{Align2, Color32, FontId, NumExt as _, Painter, pos2};
|
||||
|
||||
/// Reset at the start of each frame.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{grid, vec2, Layout, Painter, Pos2, Rect, Region, Vec2};
|
||||
use crate::{Layout, Painter, Pos2, Rect, Region, Vec2, grid, vec2};
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
use crate::{Align2, Color32, Stroke};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
use std::{any::Any, sync::Arc};
|
||||
|
||||
use crate::{
|
||||
Context, CursorIcon, Id, LayerId, PointerButton, Popup, PopupKind, Sense, Tooltip, Ui,
|
||||
WidgetRect, WidgetText,
|
||||
emath::{Align, Pos2, Rect, Vec2},
|
||||
pass_state, Context, CursorIcon, Id, LayerId, PointerButton, Popup, PopupKind, Sense, Tooltip,
|
||||
Ui, WidgetRect, WidgetText,
|
||||
pass_state,
|
||||
};
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
#![allow(clippy::if_same_then_else)]
|
||||
|
||||
use emath::Align;
|
||||
use epaint::{text::FontTweak, CornerRadius, Shadow, Stroke};
|
||||
use epaint::{CornerRadius, Shadow, Stroke, text::FontTweak};
|
||||
use std::{collections::BTreeMap, ops::RangeInclusive, sync::Arc};
|
||||
|
||||
use crate::{
|
||||
ecolor::Color32,
|
||||
emath::{pos2, vec2, Rangef, Rect, Vec2},
|
||||
ComboBox, CursorIcon, FontFamily, FontId, Grid, Margin, Response, RichText, TextWrapMode,
|
||||
WidgetText,
|
||||
ecolor::Color32,
|
||||
emath::{Rangef, Rect, Vec2, pos2, vec2},
|
||||
};
|
||||
|
||||
/// How to format numbers in e.g. a [`crate::DragValue`].
|
||||
|
|
@ -1557,8 +1557,8 @@ impl Default for Widgets {
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
use crate::{
|
||||
widgets::{reset_button, DragValue, Slider, Widget},
|
||||
Ui,
|
||||
widgets::{DragValue, Slider, Widget, reset_button},
|
||||
};
|
||||
|
||||
impl Style {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use emath::TSTransform;
|
|||
|
||||
use crate::{Context, Galley, Id};
|
||||
|
||||
use super::{text_cursor_state::is_word_char, CCursorRange};
|
||||
use super::{CCursorRange, text_cursor_state::is_word_char};
|
||||
|
||||
/// Update accesskit with the current text state.
|
||||
pub fn update_accesskit_for_text_widget(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use epaint::{text::cursor::CCursor, Galley};
|
||||
use epaint::{Galley, text::cursor::CCursor};
|
||||
|
||||
use crate::{os::OperatingSystem, Event, Id, Key, Modifiers};
|
||||
use crate::{Event, Id, Key, Modifiers, os::OperatingSystem};
|
||||
|
||||
use super::text_cursor_state::{ccursor_next_word, ccursor_previous_word, slice_char_range};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ use std::sync::Arc;
|
|||
use emath::TSTransform;
|
||||
|
||||
use crate::{
|
||||
layers::ShapeIdx, text::CCursor, text_selection::CCursorRange, Context, CursorIcon, Event,
|
||||
Galley, Id, LayerId, Pos2, Rect, Response, Ui,
|
||||
Context, CursorIcon, Event, Galley, Id, LayerId, Pos2, Rect, Response, Ui, layers::ShapeIdx,
|
||||
text::CCursor, text_selection::CCursorRange,
|
||||
};
|
||||
|
||||
use super::{
|
||||
text_cursor_state::cursor_rect,
|
||||
visuals::{paint_text_selection, RowVertexIndices},
|
||||
TextCursorState,
|
||||
text_cursor_state::cursor_rect,
|
||||
visuals::{RowVertexIndices, paint_text_selection},
|
||||
};
|
||||
|
||||
/// Turn on to help debug this
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
//! Text cursor changes/interaction, without modifying the text.
|
||||
|
||||
use epaint::text::{cursor::CCursor, Galley};
|
||||
use epaint::text::{Galley, cursor::CCursor};
|
||||
use unicode_segmentation::UnicodeSegmentation as _;
|
||||
|
||||
use crate::{epaint, NumExt as _, Rect, Response, Ui};
|
||||
use crate::{NumExt as _, Rect, Response, Ui, epaint};
|
||||
|
||||
use super::CCursorRange;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use crate::{pos2, vec2, Galley, Painter, Rect, Ui, Visuals};
|
||||
use crate::{Galley, Painter, Rect, Ui, Visuals, pos2, vec2};
|
||||
|
||||
use super::CCursorRange;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,15 @@ use emath::GuiRounding as _;
|
|||
use epaint::mutex::RwLock;
|
||||
use std::{any::Any, hash::Hash, sync::Arc};
|
||||
|
||||
use crate::close_tag::ClosableTag;
|
||||
use crate::containers::menu;
|
||||
#[cfg(debug_assertions)]
|
||||
use crate::Stroke;
|
||||
use crate::close_tag::ClosableTag;
|
||||
use crate::containers::menu;
|
||||
use crate::{
|
||||
Align, Color32, Context, CursorIcon, DragAndDrop, Id, InnerResponse, InputState, IntoAtoms,
|
||||
LayerId, Memory, Order, Painter, PlatformOutput, Pos2, Rangef, Rect, Response, Rgba, RichText,
|
||||
Sense, Style, TextStyle, TextWrapMode, UiBuilder, UiKind, UiStack, UiStackInfo, Vec2,
|
||||
WidgetRect, WidgetText,
|
||||
containers::{CollapsingHeader, CollapsingResponse, Frame},
|
||||
ecolor::Hsva,
|
||||
emath, epaint,
|
||||
|
|
@ -22,13 +26,9 @@ use crate::{
|
|||
util::IdTypeMap,
|
||||
vec2, widgets,
|
||||
widgets::{
|
||||
color_picker, Button, Checkbox, DragValue, Hyperlink, Image, ImageSource, Label, Link,
|
||||
RadioButton, SelectableLabel, Separator, Spinner, TextEdit, Widget,
|
||||
Button, Checkbox, DragValue, Hyperlink, Image, ImageSource, Label, Link, RadioButton,
|
||||
SelectableLabel, Separator, Spinner, TextEdit, Widget, color_picker,
|
||||
},
|
||||
Align, Color32, Context, CursorIcon, DragAndDrop, Id, InnerResponse, InputState, IntoAtoms,
|
||||
LayerId, Memory, Order, Painter, PlatformOutput, Pos2, Rangef, Rect, Response, Rgba, RichText,
|
||||
Sense, Style, TextStyle, TextWrapMode, UiBuilder, UiKind, UiStack, UiStackInfo, Vec2,
|
||||
WidgetRect, WidgetText,
|
||||
};
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use std::{hash::Hash, sync::Arc};
|
||||
|
||||
use crate::close_tag::ClosableTag;
|
||||
#[expect(unused_imports)] // Used for doclinks
|
||||
use crate::Ui;
|
||||
use crate::close_tag::ClosableTag;
|
||||
use crate::{Id, LayerId, Layout, Rect, Sense, Style, UiStackInfo};
|
||||
|
||||
/// Build a [`Ui`] as the child of another [`Ui`].
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ use std::fmt::Formatter;
|
|||
use std::{borrow::Cow, sync::Arc};
|
||||
|
||||
use crate::{
|
||||
text::{LayoutJob, TextWrapping},
|
||||
Align, Color32, FontFamily, FontSelection, Galley, Style, TextStyle, TextWrapMode, Ui, Visuals,
|
||||
text::{LayoutJob, TextWrapping},
|
||||
};
|
||||
|
||||
/// Text and optional style choices for it.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
epaint, pos2, Atom, AtomLayout, Atoms, Id, IntoAtoms, NumExt as _, Response, Sense, Shape, Ui,
|
||||
Vec2, Widget, WidgetInfo, WidgetType,
|
||||
Atom, AtomLayout, Atoms, Id, IntoAtoms, NumExt as _, Response, Sense, Shape, Ui, Vec2, Widget,
|
||||
WidgetInfo, WidgetType, epaint, pos2,
|
||||
};
|
||||
|
||||
// TODO(emilk): allow checkbox without a text label
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
use crate::util::fixed_cache::FixedCache;
|
||||
use crate::{
|
||||
epaint, lerp, remap_clamp, Context, DragValue, Id, Painter, Popup, PopupCloseBehavior,
|
||||
Response, Sense, Ui, Widget as _, WidgetInfo, WidgetType,
|
||||
Context, DragValue, Id, Painter, Popup, PopupCloseBehavior, Response, Sense, Ui, Widget as _,
|
||||
WidgetInfo, WidgetType, epaint, lerp, remap_clamp,
|
||||
};
|
||||
use epaint::{
|
||||
Mesh, Rect, Shape, Stroke, StrokeKind, Vec2,
|
||||
ecolor::{Color32, Hsva, HsvaGamma, Rgba},
|
||||
pos2, vec2, Mesh, Rect, Shape, Stroke, StrokeKind, Vec2,
|
||||
pos2, vec2,
|
||||
};
|
||||
|
||||
fn contrast_color(color: impl Into<Rgba>) -> Color32 {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
use std::{cmp::Ordering, ops::RangeInclusive};
|
||||
|
||||
use crate::{
|
||||
emath, text, Button, CursorIcon, Id, Key, Modifiers, NumExt as _, Response, RichText, Sense,
|
||||
TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, MINUS_CHAR_STR,
|
||||
Button, CursorIcon, Id, Key, MINUS_CHAR_STR, Modifiers, NumExt as _, Response, RichText, Sense,
|
||||
TextEdit, TextWrapMode, Ui, Widget, WidgetInfo, emath, text,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
epaint, text_selection, CursorIcon, Label, Response, Sense, Stroke, Ui, Widget, WidgetInfo,
|
||||
WidgetText, WidgetType,
|
||||
CursorIcon, Label, Response, Sense, Stroke, Ui, Widget, WidgetInfo, WidgetText, WidgetType,
|
||||
epaint, text_selection,
|
||||
};
|
||||
|
||||
use self::text_selection::LabelSelectionState;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@ use std::{borrow::Cow, slice::Iter, sync::Arc, time::Duration};
|
|||
|
||||
use emath::{Align, Float as _, GuiRounding as _, NumExt as _, Rot2};
|
||||
use epaint::{
|
||||
text::{LayoutJob, TextFormat, TextWrapping},
|
||||
RectShape,
|
||||
text::{LayoutJob, TextFormat, TextWrapping},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
load::{Bytes, SizeHint, SizedTexture, TextureLoadResult, TexturePoll},
|
||||
pos2, Color32, Context, CornerRadius, Id, Mesh, Painter, Rect, Response, Sense, Shape, Spinner,
|
||||
Color32, Context, CornerRadius, Id, Mesh, Painter, Rect, Response, Sense, Shape, Spinner,
|
||||
TextStyle, TextureOptions, Ui, Vec2, Widget, WidgetInfo, WidgetType,
|
||||
load::{Bytes, SizeHint, SizedTexture, TextureLoadResult, TexturePoll},
|
||||
pos2,
|
||||
};
|
||||
|
||||
/// A widget which displays an image.
|
||||
|
|
@ -499,7 +500,7 @@ impl ImageSize {
|
|||
|
||||
let point_size = match fit {
|
||||
ImageFit::Original { scale } => {
|
||||
return SizeHint::Scale((pixels_per_point * scale).ord())
|
||||
return SizeHint::Scale((pixels_per_point * scale).ord());
|
||||
}
|
||||
ImageFit::Fraction(fract) => available_size * fract,
|
||||
ImageFit::Exact(size) => size,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
widgets, Color32, CornerRadius, Image, Rect, Response, Sense, Ui, Vec2, Widget, WidgetInfo,
|
||||
WidgetType,
|
||||
Color32, CornerRadius, Image, Rect, Response, Sense, Ui, Vec2, Widget, WidgetInfo, WidgetType,
|
||||
widgets,
|
||||
};
|
||||
|
||||
/// A clickable image within a frame.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
epaint, pos2, text_selection::LabelSelectionState, Align, Direction, FontSelection, Galley,
|
||||
Pos2, Response, Sense, Stroke, TextWrapMode, Ui, Widget, WidgetInfo, WidgetText, WidgetType,
|
||||
Align, Direction, FontSelection, Galley, Pos2, Response, Sense, Stroke, TextWrapMode, Ui,
|
||||
Widget, WidgetInfo, WidgetText, WidgetType, epaint, pos2, text_selection::LabelSelectionState,
|
||||
};
|
||||
|
||||
/// Static text.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//! * `ui.add(Label::new("Text").text_color(color::red));`
|
||||
//! * `if ui.add(Button::new("Click me")).clicked() { … }`
|
||||
|
||||
use crate::{epaint, Response, Ui};
|
||||
use crate::{Response, Ui, epaint};
|
||||
|
||||
mod button;
|
||||
mod checkbox;
|
||||
|
|
@ -28,8 +28,8 @@ pub use self::{
|
|||
drag_value::DragValue,
|
||||
hyperlink::{Hyperlink, Link},
|
||||
image::{
|
||||
decode_animated_image_uri, has_gif_magic_header, has_webp_header, paint_texture_at,
|
||||
FrameDurations, Image, ImageFit, ImageOptions, ImageSize, ImageSource,
|
||||
decode_animated_image_uri, has_gif_magic_header, has_webp_header, paint_texture_at,
|
||||
},
|
||||
image_button::ImageButton,
|
||||
label::Label,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
lerp, vec2, Color32, CornerRadius, NumExt as _, Pos2, Rect, Response, Rgba, Sense, Shape,
|
||||
Stroke, TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType,
|
||||
Color32, CornerRadius, NumExt as _, Pos2, Rect, Response, Rgba, Sense, Shape, Stroke,
|
||||
TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetType, lerp, vec2,
|
||||
};
|
||||
|
||||
enum ProgressBarText {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
epaint, Atom, AtomLayout, Atoms, Id, IntoAtoms, NumExt as _, Response, Sense, Ui, Vec2, Widget,
|
||||
WidgetInfo, WidgetType,
|
||||
Atom, AtomLayout, Atoms, Id, IntoAtoms, NumExt as _, Response, Sense, Ui, Vec2, Widget,
|
||||
WidgetInfo, WidgetType, epaint,
|
||||
};
|
||||
|
||||
/// One out of several alternatives, either selected or not.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{vec2, Response, Sense, Ui, Vec2, Widget};
|
||||
use crate::{Response, Sense, Ui, Vec2, Widget, vec2};
|
||||
|
||||
/// A visual separator. A horizontal or vertical line (depending on [`crate::Layout`]).
|
||||
///
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
use std::ops::RangeInclusive;
|
||||
|
||||
use crate::{
|
||||
emath, epaint, lerp, pos2, remap, remap_clamp, style, style::HandleShape, vec2, Color32,
|
||||
DragValue, EventFilter, Key, Label, NumExt as _, Pos2, Rangef, Rect, Response, Sense,
|
||||
TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, MINUS_CHAR_STR,
|
||||
Color32, DragValue, EventFilter, Key, Label, MINUS_CHAR_STR, NumExt as _, Pos2, Rangef, Rect,
|
||||
Response, Sense, TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, emath,
|
||||
epaint, lerp, pos2, remap, remap_clamp, style, style::HandleShape, vec2,
|
||||
};
|
||||
|
||||
use super::drag_value::clamp_value_to_range;
|
||||
|
|
@ -134,11 +134,7 @@ impl<'a> Slider<'a> {
|
|||
value.to_f64()
|
||||
});
|
||||
|
||||
if Num::INTEGRAL {
|
||||
slf.integer()
|
||||
} else {
|
||||
slf
|
||||
}
|
||||
if Num::INTEGRAL { slf.integer() } else { slf }
|
||||
}
|
||||
|
||||
pub fn from_get_set(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use epaint::{emath::lerp, vec2, Color32, Pos2, Rect, Shape, Stroke};
|
||||
use epaint::{Color32, Pos2, Rect, Shape, Stroke, emath::lerp, vec2};
|
||||
|
||||
use crate::{Response, Sense, Ui, Widget, WidgetInfo, WidgetType};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@ use std::sync::Arc;
|
|||
|
||||
use emath::{Rect, TSTransform};
|
||||
use epaint::{
|
||||
text::{cursor::CCursor, Galley, LayoutJob},
|
||||
StrokeKind,
|
||||
text::{Galley, LayoutJob, cursor::CCursor},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
epaint,
|
||||
Align, Align2, Color32, Context, CursorIcon, Event, EventFilter, FontSelection, Id, ImeEvent,
|
||||
Key, KeyboardShortcut, Margin, Modifiers, NumExt as _, Response, Sense, Shape, TextBuffer,
|
||||
TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetWithState, epaint,
|
||||
os::OperatingSystem,
|
||||
output::OutputEvent,
|
||||
response, text_selection,
|
||||
text_selection::{text_cursor_state::cursor_rect, visuals::paint_text_selection, CCursorRange},
|
||||
vec2, Align, Align2, Color32, Context, CursorIcon, Event, EventFilter, FontSelection, Id,
|
||||
ImeEvent, Key, KeyboardShortcut, Margin, Modifiers, NumExt as _, Response, Sense, Shape,
|
||||
TextBuffer, TextStyle, TextWrapMode, Ui, Vec2, Widget, WidgetInfo, WidgetText, WidgetWithState,
|
||||
text_selection::{CCursorRange, text_cursor_state::cursor_rect, visuals::paint_text_selection},
|
||||
vec2,
|
||||
};
|
||||
|
||||
use super::{TextEditOutput, TextEditState};
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ use std::sync::Arc;
|
|||
use crate::mutex::Mutex;
|
||||
|
||||
use crate::{
|
||||
text_selection::{CCursorRange, TextCursorState},
|
||||
Context, Id,
|
||||
text_selection::{CCursorRange, TextCursorState},
|
||||
};
|
||||
|
||||
pub type TextEditUndoer = crate::util::undoer::Undoer<(CCursorRange, String)>;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use std::{borrow::Cow, ops::Range};
|
||||
|
||||
use epaint::{
|
||||
text::{cursor::CCursor, TAB_SIZE},
|
||||
Galley,
|
||||
text::{TAB_SIZE, cursor::CCursor},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use egui::{
|
||||
Color32, Painter, Pos2, Rect, Shape, Stroke, Ui, Vec2,
|
||||
containers::{CollapsingHeader, Frame},
|
||||
emath, pos2,
|
||||
widgets::Slider,
|
||||
Color32, Painter, Pos2, Rect, Shape, Stroke, Ui, Vec2,
|
||||
};
|
||||
use std::f32::consts::TAU;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use egui::emath::Rot2;
|
||||
use egui::panel::Side;
|
||||
use egui::panel::TopBottomSide;
|
||||
use egui::ImageFit;
|
||||
use egui::Slider;
|
||||
use egui::Vec2;
|
||||
use egui::emath::Rot2;
|
||||
use egui::panel::Side;
|
||||
use egui::panel::TopBottomSide;
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub struct ImageViewer {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ impl FrameHistory {
|
|||
}
|
||||
|
||||
fn graph(&self, ui: &mut egui::Ui) -> egui::Response {
|
||||
use egui::{emath, epaint, pos2, vec2, Pos2, Rect, Sense, Shape, Stroke, TextStyle};
|
||||
use egui::{Pos2, Rect, Sense, Shape, Stroke, TextStyle, emath, epaint, pos2, vec2};
|
||||
|
||||
ui.label("egui CPU usage history");
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ fn main() -> eframe::Result {
|
|||
start_puffin_server();
|
||||
|
||||
#[cfg(not(feature = "puffin"))]
|
||||
panic!("Unknown argument: {arg} - you need to enable the 'puffin' feature to use this.");
|
||||
panic!(
|
||||
"Unknown argument: {arg} - you need to enable the 'puffin' feature to use this."
|
||||
);
|
||||
}
|
||||
|
||||
_ => {
|
||||
|
|
@ -39,7 +41,12 @@ fn main() -> eframe::Result {
|
|||
rust_log += &format!(",{loud_crate}=warn");
|
||||
}
|
||||
}
|
||||
std::env::set_var("RUST_LOG", rust_log);
|
||||
|
||||
// SAFETY: we call this from the main thread without any other threads running.
|
||||
#[expect(unsafe_code)]
|
||||
unsafe {
|
||||
std::env::set_var("RUST_LOG", rust_log);
|
||||
}
|
||||
}
|
||||
|
||||
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use egui::accesskit::Role;
|
||||
use egui::Vec2;
|
||||
use egui::accesskit::Role;
|
||||
use egui_demo_app::{Anchor, WrapApp};
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use egui_kittest::SnapshotResults;
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
|
||||
#[test]
|
||||
fn test_demo_app() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::fmt::Write as _;
|
||||
|
||||
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
|
||||
use criterion::{BatchSize, Criterion, criterion_group, criterion_main};
|
||||
|
||||
use egui::epaint::TextShape;
|
||||
use egui::load::SizedTexture;
|
||||
|
|
@ -174,7 +174,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
|||
let mut locked_fonts = fonts.lock();
|
||||
c.bench_function("text_layout_uncached", |b| {
|
||||
b.iter(|| {
|
||||
use egui::epaint::text::{layout, LayoutJob};
|
||||
use egui::epaint::text::{LayoutJob, layout};
|
||||
|
||||
let job = LayoutJob::simple(
|
||||
LOREM_IPSUM_LONG.to_owned(),
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
use egui::{
|
||||
Color32, Context, Pos2, Rect, Ui,
|
||||
containers::{Frame, Window},
|
||||
emath, epaint,
|
||||
epaint::PathStroke,
|
||||
hex_color, lerp, pos2, remap, vec2, Color32, Context, Pos2, Rect, Ui,
|
||||
hex_color, lerp, pos2, remap, vec2,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use std::collections::BTreeSet;
|
||||
|
||||
use super::About;
|
||||
use crate::is_mobile;
|
||||
use crate::Demo;
|
||||
use crate::View as _;
|
||||
use crate::is_mobile;
|
||||
use egui::containers::menu;
|
||||
use egui::style::StyleModifier;
|
||||
use egui::{Context, Modifiers, ScrollArea, Ui};
|
||||
|
|
@ -370,7 +370,7 @@ fn file_menu_button(ui: &mut Ui) {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{demo::demo_app_windows::DemoGroups, Demo as _};
|
||||
use crate::{Demo as _, demo::demo_app_windows::DemoGroups};
|
||||
|
||||
use egui_kittest::kittest::{NodeT as _, Queryable as _};
|
||||
use egui_kittest::{Harness, SnapshotOptions, SnapshotResults};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use egui::{vec2, Color32, Context, Frame, Id, Ui, Window};
|
||||
use egui::{Color32, Context, Frame, Id, Ui, Window, vec2};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use super::{Demo, View};
|
||||
|
||||
use egui::{
|
||||
vec2, Align, Align2, Checkbox, CollapsingHeader, Color32, ComboBox, Context, FontId, Resize,
|
||||
RichText, Sense, Slider, Stroke, TextFormat, TextStyle, Ui, Vec2, Window,
|
||||
Align, Align2, Checkbox, CollapsingHeader, Color32, ComboBox, Context, FontId, Resize,
|
||||
RichText, Sense, Slider, Stroke, TextFormat, TextStyle, Ui, Vec2, Window, vec2,
|
||||
};
|
||||
|
||||
/// Showcase some ui code
|
||||
|
|
|
|||
|
|
@ -162,10 +162,10 @@ impl crate::View for Modals {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::demo::modals::Modals;
|
||||
use crate::Demo as _;
|
||||
use egui::accesskit::Role;
|
||||
use crate::demo::modals::Modals;
|
||||
use egui::Key;
|
||||
use egui::accesskit::Role;
|
||||
use egui_kittest::kittest::Queryable as _;
|
||||
use egui_kittest::{Harness, SnapshotResults};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use egui::{
|
||||
Color32, Frame, Pos2, Rect, Sense, Stroke, Vec2,
|
||||
emath::{RectTransform, Rot2},
|
||||
vec2, Color32, Frame, Pos2, Rect, Sense, Stroke, Vec2,
|
||||
vec2,
|
||||
};
|
||||
|
||||
pub struct MultiTouch {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use egui::{
|
||||
emath,
|
||||
Color32, Context, Frame, Grid, Pos2, Rect, Sense, Shape, Stroke, StrokeKind, Ui, Vec2,
|
||||
Widget as _, Window, emath,
|
||||
epaint::{self, CubicBezierShape, PathShape, QuadraticBezierShape},
|
||||
pos2, Color32, Context, Frame, Grid, Pos2, Rect, Sense, Shape, Stroke, StrokeKind, Ui, Vec2,
|
||||
Widget as _, Window,
|
||||
pos2,
|
||||
};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use egui::{emath, vec2, Color32, Context, Frame, Pos2, Rect, Sense, Stroke, Ui, Window};
|
||||
use egui::{Color32, Context, Frame, Pos2, Rect, Sense, Stroke, Ui, Window, emath, vec2};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[cfg_attr(feature = "serde", serde(default))]
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
use crate::rust_view_ui;
|
||||
use egui::color_picker::{color_picker_color32, Alpha};
|
||||
use egui::color_picker::{Alpha, color_picker_color32};
|
||||
use egui::containers::menu::{MenuConfig, SubMenuButton};
|
||||
use egui::{
|
||||
include_image, Align, Align2, ComboBox, Frame, Id, Layout, Popup, PopupCloseBehavior,
|
||||
RectAlign, RichText, Tooltip, Ui, UiBuilder,
|
||||
Align, Align2, ComboBox, Frame, Id, Layout, Popup, PopupCloseBehavior, RectAlign, RichText,
|
||||
Tooltip, Ui, UiBuilder, include_image,
|
||||
};
|
||||
|
||||
/// Showcase [`Popup`].
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use egui::{
|
||||
pos2, scroll_area::ScrollBarVisibility, Align, Align2, Color32, DragValue, NumExt as _, Rect,
|
||||
ScrollArea, Sense, Slider, TextStyle, TextWrapMode, Ui, Vec2, Widget as _,
|
||||
Align, Align2, Color32, DragValue, NumExt as _, Rect, ScrollArea, Sense, Slider, TextStyle,
|
||||
TextWrapMode, Ui, Vec2, Widget as _, pos2, scroll_area::ScrollBarVisibility,
|
||||
};
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use egui::{style::HandleShape, Slider, SliderClamping, SliderOrientation, Ui};
|
||||
use egui::{Slider, SliderClamping, SliderOrientation, Ui, style::HandleShape};
|
||||
|
||||
/// Showcase sliders
|
||||
#[derive(PartialEq)]
|
||||
|
|
|
|||
|
|
@ -330,7 +330,9 @@ fn expanding_content(ui: &mut egui::Ui) {
|
|||
}
|
||||
|
||||
fn long_text(row_index: usize) -> String {
|
||||
format!("Row {row_index} has some long text that you may want to clip, or it will take up too much horizontal space!")
|
||||
format!(
|
||||
"Row {row_index} has some long text that you may want to clip, or it will take up too much horizontal space!"
|
||||
)
|
||||
}
|
||||
|
||||
fn thick_row(row_index: usize) -> bool {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue