mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Add egui::Scene for panning/zooming a Ui (#5505)
This is similar to `ScrollArea`, but: * Supports zooming * Has no scroll bars * Has no limits on the scrolling ## TODO * [x] Automatic sizing of `Scene`s outer bounds * [x] Fix text selection in scenes * [x] Implement `fit_rect` * [x] Document / improve API --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
@@ -33,7 +33,7 @@ impl TSTransform {
|
||||
|
||||
#[inline]
|
||||
/// Creates a new translation that first scales points around
|
||||
/// `(0, 0)`, then translates them.
|
||||
/// `(0, 0)`, then translates them.
|
||||
pub fn new(translation: Vec2, scaling: f32) -> Self {
|
||||
Self {
|
||||
translation,
|
||||
@@ -51,6 +51,11 @@ impl TSTransform {
|
||||
Self::new(Vec2::ZERO, scaling)
|
||||
}
|
||||
|
||||
/// Is this a valid, invertible transform?
|
||||
pub fn is_valid(&self) -> bool {
|
||||
self.scaling.is_finite() && self.translation.x.is_finite() && self.scaling != 0.0
|
||||
}
|
||||
|
||||
/// Inverts the transform.
|
||||
///
|
||||
/// ```
|
||||
|
||||
Reference in New Issue
Block a user