diff --git a/CHANGELOG.md b/CHANGELOG.md index a1c829f..8bd63d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- `figures` is now directly re-exported at this crate's root. Kludgine still + also provides this export, so existing references through kludgine will + continue to work. This was added as an attempt to fix links on docs.rs (see + rust-lang/docs.rs#1588). + ## v0.2.0 ### Breaking Changes diff --git a/Cargo.lock b/Cargo.lock index e65acd8..da4113c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -576,6 +576,7 @@ dependencies = [ "alot", "arboard", "cushy-macros", + "figures", "image", "intentional", "interner", diff --git a/Cargo.toml b/Cargo.toml index 093bbf2..e909a2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ roboto-flex = [] [dependencies] kludgine = { version = "0.7.0", features = ["app"] } +figures = "0.2.0" # kludgine = { git = "https://github.com/khonsulabs/kludgine", features = [ # "app", # ] } diff --git a/examples/animation.rs b/examples/animation.rs index f8f015d..dd0d944 100644 --- a/examples/animation.rs +++ b/examples/animation.rs @@ -5,7 +5,7 @@ use cushy::value::Dynamic; use cushy::widget::MakeWidget; use cushy::widgets::progress::Progressable; use cushy::{Run, WithClone}; -use kludgine::figures::units::Lp; +use figures::units::Lp; fn main() -> cushy::Result { let animation = Dynamic::new(AnimationHandle::new()); diff --git a/examples/canvas.rs b/examples/canvas.rs index ada9b49..957668f 100644 --- a/examples/canvas.rs +++ b/examples/canvas.rs @@ -1,6 +1,6 @@ use cushy::widgets::Canvas; use cushy::{Run, Tick}; -use kludgine::figures::{Angle, IntoSigned, Point, Px2D, Rect, Size}; +use figures::{Angle, IntoSigned, Point, Px2D, Rect, Size}; use kludgine::shapes::Shape; use kludgine::text::{Text, TextOrigin}; use kludgine::{Color, DrawableExt}; diff --git a/examples/container-shadow.rs b/examples/container-shadow.rs index d192546..3fa473a 100644 --- a/examples/container-shadow.rs +++ b/examples/container-shadow.rs @@ -5,8 +5,8 @@ use cushy::widget::MakeWidget; use cushy::widgets::container::ContainerShadow; use cushy::widgets::slider::Slidable; use cushy::Run; -use kludgine::figures::units::Lp; -use kludgine::figures::{Point, Size}; +use figures::units::Lp; +use figures::{Point, Size}; use kludgine::shapes::CornerRadii; fn main() -> cushy::Result { diff --git a/examples/containers.rs b/examples/containers.rs index 965a8d6..f937069 100644 --- a/examples/containers.rs +++ b/examples/containers.rs @@ -3,8 +3,8 @@ use cushy::widget::{MakeWidget, WidgetInstance}; use cushy::widgets::container::ContainerShadow; use cushy::window::ThemeMode; use cushy::Run; -use kludgine::figures::units::Lp; -use kludgine::figures::Point; +use figures::units::Lp; +use figures::Point; fn main() -> cushy::Result { let theme_mode = Dynamic::default(); diff --git a/examples/counter.rs b/examples/counter.rs index e302daf..7131a0b 100644 --- a/examples/counter.rs +++ b/examples/counter.rs @@ -3,7 +3,7 @@ use std::string::ToString; use cushy::value::Dynamic; use cushy::widget::MakeWidget; use cushy::Run; -use kludgine::figures::units::Lp; +use figures::units::Lp; fn main() -> cushy::Result { let counter = Dynamic::new(0i32); diff --git a/examples/custom-widgets.rs b/examples/custom-widgets.rs index ecb3db1..603c623 100644 --- a/examples/custom-widgets.rs +++ b/examples/custom-widgets.rs @@ -5,8 +5,8 @@ use cushy::value::Dynamic; use cushy::widget::{MakeWidget, MakeWidgetWithTag, Widget, WidgetInstance, WidgetTag, HANDLED}; use cushy::widgets::Custom; use cushy::Run; -use kludgine::figures::units::{Lp, UPx}; -use kludgine::figures::{ScreenScale, Size}; +use figures::units::{Lp, UPx}; +use figures::{ScreenScale, Size}; use kludgine::Color; fn main() -> cushy::Result { @@ -107,7 +107,7 @@ impl Widget for Toggle { fn hit_test( &mut self, - _location: kludgine::figures::Point, + _location: figures::Point, _context: &mut cushy::context::EventContext<'_, '_>, ) -> bool { true @@ -115,7 +115,7 @@ impl Widget for Toggle { fn mouse_down( &mut self, - _location: kludgine::figures::Point, + _location: figures::Point, _device_id: kludgine::app::winit::event::DeviceId, _button: kludgine::app::winit::event::MouseButton, _context: &mut cushy::context::EventContext<'_, '_>, diff --git a/examples/focus-order.rs b/examples/focus-order.rs index adb6606..eb82c56 100644 --- a/examples/focus-order.rs +++ b/examples/focus-order.rs @@ -6,7 +6,7 @@ use cushy::widgets::grid::{Grid, GridDimension, GridWidgets}; use cushy::widgets::input::{InputValue, MaskedString}; use cushy::widgets::Expand; use cushy::Run; -use kludgine::figures::units::Lp; +use figures::units::Lp; /// This example is the same as login, but it has an explicit tab order to /// change from the default order (username, password, cancel, log in) to diff --git a/examples/focus.rs b/examples/focus.rs index d7b20b2..0b32b95 100644 --- a/examples/focus.rs +++ b/examples/focus.rs @@ -4,7 +4,7 @@ use cushy::widgets::input::InputValue; use cushy::widgets::slider::Slidable; use cushy::widgets::Custom; use cushy::Run; -use kludgine::figures::units::Lp; +use figures::units::Lp; fn main() -> cushy::Result { let allow_blur = Dynamic::new(true); diff --git a/examples/image.rs b/examples/image.rs index c22c00d..c43f667 100644 --- a/examples/image.rs +++ b/examples/image.rs @@ -5,7 +5,7 @@ use cushy::widgets::image::{Aspect, ImageScaling}; use cushy::widgets::slider::Slidable; use cushy::widgets::Image; use cushy::Run; -use kludgine::figures::Size; +use figures::Size; use kludgine::include_texture; fn main() -> cushy::Result { diff --git a/examples/input.rs b/examples/input.rs index 4896dfb..e9e0d36 100644 --- a/examples/input.rs +++ b/examples/input.rs @@ -2,7 +2,7 @@ use cushy::value::Dynamic; use cushy::widget::MakeWidget; use cushy::widgets::input::{InputValue, MaskedString}; use cushy::Run; -use kludgine::figures::units::Px; +use figures::units::Px; fn main() -> cushy::Result { let contents = Dynamic::from("Hello World"); diff --git a/examples/login.rs b/examples/login.rs index 491cebe..efcdfc9 100644 --- a/examples/login.rs +++ b/examples/login.rs @@ -6,7 +6,7 @@ use cushy::widgets::input::{InputValue, MaskedString}; use cushy::widgets::layers::OverlayLayer; use cushy::widgets::Expand; use cushy::Run; -use kludgine::figures::units::Lp; +use figures::units::Lp; fn main() -> cushy::Result { let tooltips = OverlayLayer::default(); diff --git a/examples/nested-scroll.rs b/examples/nested-scroll.rs index dcf5eb7..ac80b09 100644 --- a/examples/nested-scroll.rs +++ b/examples/nested-scroll.rs @@ -2,8 +2,8 @@ use cushy::styles::components::FontFamily; use cushy::styles::FontFamilyList; use cushy::widget::MakeWidget; use cushy::Run; +use figures::units::Lp; use kludgine::cosmic_text::FamilyOwned; -use kludgine::figures::units::Lp; fn main() -> cushy::Result { include_str!("./nested-scroll.rs") diff --git a/examples/overlays.rs b/examples/overlays.rs index 90f61de..ffb28b4 100644 --- a/examples/overlays.rs +++ b/examples/overlays.rs @@ -2,8 +2,8 @@ use cushy::widget::{MakeWidget, MakeWidgetWithTag, WidgetTag}; use cushy::widgets::container::ContainerShadow; use cushy::widgets::layers::{OverlayBuilder, OverlayLayer}; use cushy::Run; -use kludgine::figures::units::Lp; -use kludgine::figures::Point; +use figures::units::Lp; +use figures::Point; use kludgine::Color; use rand::{thread_rng, Rng}; diff --git a/examples/progress.rs b/examples/progress.rs index ee66230..2b1d260 100644 --- a/examples/progress.rs +++ b/examples/progress.rs @@ -3,8 +3,8 @@ use cushy::widget::MakeWidget; use cushy::widgets::progress::Progressable; use cushy::widgets::slider::Slidable; use cushy::Run; -use kludgine::figures::units::Lp; -use kludgine::figures::Size; +use figures::units::Lp; +use figures::Size; fn main() -> cushy::Result { let indeterminant = Dynamic::new(false); diff --git a/examples/slider.rs b/examples/slider.rs index d06c639..7803c8c 100644 --- a/examples/slider.rs +++ b/examples/slider.rs @@ -5,8 +5,8 @@ use cushy::widgets::checkbox::Checkable; use cushy::widgets::input::InputValue; use cushy::widgets::slider::Slidable; use cushy::Run; -use kludgine::figures::units::Lp; -use kludgine::figures::Ranged; +use figures::units::Lp; +use figures::Ranged; fn main() -> cushy::Result { let enabled = Dynamic::new(true); diff --git a/examples/style.rs b/examples/style.rs index bbf51b9..d2a8d57 100644 --- a/examples/style.rs +++ b/examples/style.rs @@ -3,7 +3,7 @@ use cushy::widget::MakeWidget; use cushy::widgets::stack::Stack; use cushy::widgets::Style; use cushy::Run; -use kludgine::figures::units::Lp; +use figures::units::Lp; use kludgine::Color; fn main() -> cushy::Result { diff --git a/examples/theme.rs b/examples/theme.rs index 482359e..2aaa71c 100644 --- a/examples/theme.rs +++ b/examples/theme.rs @@ -14,7 +14,7 @@ use cushy::widgets::slider::Slidable; use cushy::widgets::Space; use cushy::window::ThemeMode; use cushy::{Open, PendingApp}; -use kludgine::figures::units::Lp; +use figures::units::Lp; use kludgine::Color; use palette::OklabHue; diff --git a/examples/tic-tac-toe.rs b/examples/tic-tac-toe.rs index 5ac68fe..2319e49 100644 --- a/examples/tic-tac-toe.rs +++ b/examples/tic-tac-toe.rs @@ -7,7 +7,7 @@ use cushy::value::Dynamic; use cushy::widget::MakeWidget; use cushy::widgets::button::ButtonKind; use cushy::{Run, WithClone}; -use kludgine::figures::units::Lp; +use figures::units::Lp; fn main() -> cushy::Result { let app = Dynamic::default(); diff --git a/examples/tilemap.rs b/examples/tilemap.rs index 287775c..77cbe42 100644 --- a/examples/tilemap.rs +++ b/examples/tilemap.rs @@ -2,9 +2,9 @@ use std::array; use std::cmp::Ordering; use std::time::Duration; +use cushy::figures::units::Px; +use cushy::figures::{Point, Rect, Size}; use cushy::kludgine::app::winit::keyboard::Key; -use cushy::kludgine::figures::units::Px; -use cushy::kludgine::figures::{Point, Rect, Size}; use cushy::kludgine::render::Renderer; use cushy::kludgine::shapes::Shape; use cushy::kludgine::tilemap::{ @@ -14,8 +14,8 @@ use cushy::kludgine::Color; use cushy::value::Dynamic; use cushy::widgets::TileMap; use cushy::{Run, Tick}; +use figures::FloatConversion; use kludgine::app::winit::keyboard::NamedKey; -use kludgine::figures::FloatConversion; use kludgine::sprite::{Sprite, SpriteSource}; use kludgine::{include_aseprite_sprite, DrawableExt}; diff --git a/examples/validation.rs b/examples/validation.rs index 25d14b4..85f917f 100644 --- a/examples/validation.rs +++ b/examples/validation.rs @@ -2,7 +2,7 @@ use cushy::value::{Dynamic, Validations}; use cushy::widget::MakeWidget; use cushy::widgets::input::InputValue; use cushy::Run; -use kludgine::figures::units::Lp; +use figures::units::Lp; fn main() -> cushy::Result { let text = Dynamic::default(); diff --git a/examples/window-properties.rs b/examples/window-properties.rs index 658706f2..d07d1d0 100644 --- a/examples/window-properties.rs +++ b/examples/window-properties.rs @@ -1,7 +1,7 @@ use cushy::value::Dynamic; use cushy::widget::{MakeWidget, WidgetInstance}; use cushy::Run; -use kludgine::figures::Size; +use figures::Size; fn main() -> cushy::Result { let focused = Dynamic::new(false); diff --git a/examples/wrap.rs b/examples/wrap.rs index 54230e8..3908b96 100644 --- a/examples/wrap.rs +++ b/examples/wrap.rs @@ -3,7 +3,7 @@ use cushy::value::Dynamic; use cushy::widget::{Children, MakeWidget}; use cushy::widgets::wrap::{VerticalAlign, WrapAlign}; use cushy::Run; -use kludgine::figures::units::Lp; +use figures::units::Lp; use rand::{thread_rng, Rng}; const EXPLANATION: &str = "This example demonstrates the Wrap widget. Each word shown here is an individual Label widget that is being positioned by the Wrap widget."; diff --git a/src/animation.rs b/src/animation.rs index f404fb0..e6dea74 100644 --- a/src/animation.rs +++ b/src/animation.rs @@ -48,10 +48,10 @@ use std::thread; use std::time::{Duration, Instant}; use alot::{LotId, Lots}; +use figures::units::{Lp, Px, UPx}; +use figures::{Angle, Ranged, UnscaledUnit, Zero}; use intentional::Cast; use kempt::Set; -use kludgine::figures::units::{Lp, Px, UPx}; -use kludgine::figures::{Angle, Ranged, UnscaledUnit, Zero}; use kludgine::Color; use crate::animation::easings::Linear; diff --git a/src/context.rs b/src/context.rs index e03ff63..a96a0c0 100644 --- a/src/context.rs +++ b/src/context.rs @@ -4,13 +4,13 @@ use std::ops::{Deref, DerefMut}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex, MutexGuard}; +use figures::units::{Lp, Px, UPx}; +use figures::{IntoSigned, Point, Px2D, Rect, Round, ScreenScale, Size, Zero}; use kempt::Set; use kludgine::app::winit::event::{ DeviceId, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase, }; use kludgine::app::winit::window::CursorIcon; -use kludgine::figures::units::{Lp, Px, UPx}; -use kludgine::figures::{IntoSigned, Point, Px2D, Rect, Round, ScreenScale, Size, Zero}; use kludgine::shapes::{Shape, StrokeOptions}; use kludgine::{Color, Kludgine}; diff --git a/src/graphics.rs b/src/graphics.rs index 2628dd5..81fc3e5 100644 --- a/src/graphics.rs +++ b/src/graphics.rs @@ -1,11 +1,11 @@ use std::ops::{Deref, DerefMut}; use ahash::AHashSet; -use kludgine::cosmic_text::FamilyOwned; -use kludgine::figures::units::{Px, UPx}; -use kludgine::figures::{ +use figures::units::{Px, UPx}; +use figures::{ self, Fraction, IntoSigned, IntoUnsigned, Point, Rect, ScreenScale, ScreenUnit, Size, Zero, }; +use kludgine::cosmic_text::FamilyOwned; use kludgine::render::Renderer; use kludgine::shapes::Shape; use kludgine::text::{MeasuredText, Text, TextOrigin}; diff --git a/src/lib.rs b/src/lib.rs index 1e5506a..f645686 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,12 +24,12 @@ pub mod window; use std::ops::Sub; pub use app::{App, Application, Cushy, Open, PendingApp, Run}; -pub use kludgine; +use figures::units::UPx; +use figures::{Fraction, ScreenUnit, Size}; use kludgine::app::winit::error::EventLoopError; -use kludgine::figures::units::UPx; -use kludgine::figures::{Fraction, ScreenUnit, Size}; pub use names::Name; pub use utils::{Lazy, WithClone}; +pub use {figures, kludgine}; pub use self::graphics::Graphics; pub use self::tick::{InputState, Tick}; diff --git a/src/styles.rs b/src/styles.rs index 09a63ae..c4adb6b 100644 --- a/src/styles.rs +++ b/src/styles.rs @@ -11,12 +11,13 @@ use std::ops::{ use std::sync::Arc; use ahash::AHashMap; -use kludgine::cosmic_text::{FamilyOwned, Style, Weight}; -use kludgine::figures::units::{Lp, Px, UPx}; -use kludgine::figures::{Fraction, IntoSigned, IntoUnsigned, Rect, ScreenScale, Size, Zero}; -use kludgine::shapes::CornerRadii; -use kludgine::Color; -use palette::{IntoColor, Okhsl, OklabHue, Srgb}; +use figures::units::{Lp, Px, UPx}; +use figures::{Fraction, IntoSigned, IntoUnsigned, Rect, ScreenScale, Size, Zero}; +pub use kludgine::cosmic_text::{FamilyOwned, Style, Weight}; +pub use kludgine::shapes::CornerRadii; +pub use kludgine::Color; +pub use palette::OklabHue; +use palette::{IntoColor, Okhsl, Srgb}; use crate::animation::{EasingFunction, ZeroToOne}; use crate::context::WidgetContext; @@ -747,25 +748,25 @@ impl ScreenScale for Dimension { type Px = Px; type UPx = UPx; - fn into_px(self, scale: kludgine::figures::Fraction) -> Px { + fn into_px(self, scale: figures::Fraction) -> Px { match self { Dimension::Px(px) => px, Dimension::Lp(lp) => lp.into_px(scale), } } - fn from_px(px: Px, _scale: kludgine::figures::Fraction) -> Self { + fn from_px(px: Px, _scale: figures::Fraction) -> Self { Self::from(px) } - fn into_lp(self, scale: kludgine::figures::Fraction) -> Lp { + fn into_lp(self, scale: figures::Fraction) -> Lp { match self { Dimension::Px(px) => px.into_lp(scale), Dimension::Lp(lp) => lp, } } - fn from_lp(lp: Lp, _scale: kludgine::figures::Fraction) -> Self { + fn from_lp(lp: Lp, _scale: figures::Fraction) -> Self { Self::from(lp) } diff --git a/src/styles/components.rs b/src/styles/components.rs index 2a26589..58ee737 100644 --- a/src/styles/components.rs +++ b/src/styles/components.rs @@ -1,7 +1,7 @@ //! All style components supported by the built-in widgets. +use figures::units::Lp; use kludgine::cosmic_text::{FamilyOwned, Style, Weight}; -use kludgine::figures::units::Lp; use kludgine::shapes::CornerRadii; use kludgine::Color; @@ -20,7 +20,7 @@ use crate::styles::{Dimension, FocusableWidgets, FontFamilyList, VisualOrder}; /// use cushy::styles::Dimension; /// use cushy::styles::components::{SurfaceColor, TextColor}; /// use cushy::kludgine::Color; -/// use cushy::kludgine::figures::Zero; +/// use cushy::figures::Zero; /// /// define_components! { /// GroupName { diff --git a/src/tick.rs b/src/tick.rs index dd3425c..fe757ee 100644 --- a/src/tick.rs +++ b/src/tick.rs @@ -3,11 +3,11 @@ use std::sync::{Arc, Condvar, Mutex, MutexGuard}; use std::time::{Duration, Instant}; use ahash::AHashSet; +use figures::units::Px; +use figures::Point; use intentional::Assert; use kludgine::app::winit::event::{ElementState, KeyEvent, MouseButton}; use kludgine::app::winit::keyboard::Key; -use kludgine::figures::units::Px; -use kludgine::figures::Point; use crate::context::WidgetContext; use crate::utils::IgnorePoison; diff --git a/src/tree.rs b/src/tree.rs index f46ae60..d3dd45e 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -3,8 +3,8 @@ use std::sync::{Arc, Mutex, Weak}; use ahash::AHashMap; use alot::{LotId, Lots}; -use kludgine::figures::units::{Px, UPx}; -use kludgine::figures::{Point, Rect, Size}; +use figures::units::{Px, UPx}; +use figures::{Point, Rect, Size}; use crate::styles::{Styles, ThemePair, VisualOrder}; use crate::utils::IgnorePoison; diff --git a/src/widget.rs b/src/widget.rs index a4a74b2..c0f824b 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -9,13 +9,13 @@ use std::sync::{Arc, Mutex, MutexGuard}; use std::{slice, vec}; use alot::LotId; +use figures::units::{Px, UPx}; +use figures::{IntoSigned, IntoUnsigned, Point, Rect, Size}; use intentional::Assert; use kludgine::app::winit::event::{ DeviceId, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase, }; use kludgine::app::winit::window::CursorIcon; -use kludgine::figures::units::{Px, UPx}; -use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Rect, Size}; use kludgine::Color; use crate::app::{Application, Open, PendingApp, Run}; @@ -1156,7 +1156,7 @@ pub trait MakeWidget: Sized { /// /// - [`Dimension`] /// - [`Px`] - /// - [`Lp`](crate::kludgine::figures::units::Lp) + /// - [`Lp`](crate::figures::units::Lp) /// - A range of any fo the above. #[must_use] fn width(self, width: impl Into) -> Resize { @@ -1169,7 +1169,7 @@ pub trait MakeWidget: Sized { /// /// - [`Dimension`] /// - [`Px`] - /// - [`Lp`](crate::kludgine::figures::units::Lp) + /// - [`Lp`](crate::figures::units::Lp) /// - A range of any fo the above. #[must_use] fn height(self, height: impl Into) -> Resize { diff --git a/src/widgets/align.rs b/src/widgets/align.rs index 11a0e4e..b3402f4 100644 --- a/src/widgets/align.rs +++ b/src/widgets/align.rs @@ -1,7 +1,7 @@ use std::fmt::Debug; -use kludgine::figures::units::UPx; -use kludgine::figures::{Fraction, IntoSigned, Point, Rect, ScreenScale, Size}; +use figures::units::UPx; +use figures::{Fraction, IntoSigned, Point, Rect, ScreenScale, Size}; use crate::context::{AsEventContext, EventContext, LayoutContext}; use crate::styles::{Edges, FlexibleDimension}; diff --git a/src/widgets/button.rs b/src/widgets/button.rs index 6cfd391..7214b04 100644 --- a/src/widgets/button.rs +++ b/src/widgets/button.rs @@ -1,10 +1,10 @@ //! A clickable, labeled button use std::time::Duration; +use figures::units::{Lp, Px, UPx}; +use figures::{IntoSigned, Point, Rect, Round, ScreenScale, Size}; use kludgine::app::winit::event::{DeviceId, ElementState, KeyEvent, MouseButton}; use kludgine::app::winit::window::CursorIcon; -use kludgine::figures::units::{Lp, Px, UPx}; -use kludgine::figures::{IntoSigned, Point, Rect, Round, ScreenScale, Size}; use kludgine::shapes::{Shape, StrokeOptions}; use kludgine::Color; diff --git a/src/widgets/canvas.rs b/src/widgets/canvas.rs index 11f3d88..0bf58c2 100644 --- a/src/widgets/canvas.rs +++ b/src/widgets/canvas.rs @@ -1,7 +1,7 @@ use std::fmt::Debug; -use kludgine::figures::units::UPx; -use kludgine::figures::Size; +use figures::units::UPx; +use figures::Size; use crate::context::{GraphicsContext, LayoutContext}; use crate::value::Dynamic; diff --git a/src/widgets/checkbox.rs b/src/widgets/checkbox.rs index 000e825..8a26f9f 100644 --- a/src/widgets/checkbox.rs +++ b/src/widgets/checkbox.rs @@ -3,8 +3,8 @@ use std::error::Error; use std::fmt::Display; use std::ops::Not; -use kludgine::figures::units::Lp; -use kludgine::figures::{Point, Rect, Round, ScreenScale, Size}; +use figures::units::Lp; +use figures::{Point, Rect, Round, ScreenScale, Size}; use kludgine::shapes::{PathBuilder, Shape, StrokeOptions}; use crate::context::{GraphicsContext, LayoutContext}; @@ -245,7 +245,7 @@ impl Widget for CheckboxOrnament { &mut self, _available_space: Size, context: &mut LayoutContext<'_, '_, '_, '_, '_>, - ) -> Size { + ) -> Size { let checkbox_size = context.get(&CheckboxSize).into_upx(context.gfx.scale()); Size::squared(checkbox_size) } diff --git a/src/widgets/collapse.rs b/src/widgets/collapse.rs index 128094a..3027d00 100644 --- a/src/widgets/collapse.rs +++ b/src/widgets/collapse.rs @@ -1,7 +1,7 @@ use std::time::Duration; -use kludgine::figures::units::Px; -use kludgine::figures::Size; +use figures::units::Px; +use figures::Size; use crate::animation::easings::{EaseInQuadradic, EaseOutQuadradic}; use crate::animation::{AnimationHandle, AnimationTarget, EasingFunction, Spawn}; diff --git a/src/widgets/color.rs b/src/widgets/color.rs index d69792c..5db525b 100644 --- a/src/widgets/color.rs +++ b/src/widgets/color.rs @@ -1,10 +1,10 @@ //! Widgets for selecting colors. use std::ops::Range; +use figures::units::{Lp, Px}; +use figures::{FloatConversion, Point, Rect, Round, ScreenScale, Zero}; use intentional::Cast; use kludgine::app::winit::event::{DeviceId, MouseButton}; -use kludgine::figures::units::{Lp, Px}; -use kludgine::figures::{FloatConversion, Point, Rect, Round, ScreenScale, Zero}; use kludgine::shapes::{self, FillOptions, PathBuilder, Shape, StrokeOptions}; use kludgine::{Color, DrawableExt, Origin}; diff --git a/src/widgets/container.rs b/src/widgets/container.rs index 33fede8..5f43b93 100644 --- a/src/widgets/container.rs +++ b/src/widgets/container.rs @@ -2,10 +2,8 @@ use std::ops::Div; -use kludgine::figures::units::{Lp, Px, UPx}; -use kludgine::figures::{ - Abs, Angle, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, Zero, -}; +use figures::units::{Lp, Px, UPx}; +use figures::{Abs, Angle, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, Zero}; use kludgine::shapes::{CornerRadii, PathBuilder, Shape}; use kludgine::Color; @@ -763,7 +761,7 @@ where type Px = ContainerShadow; type UPx = ContainerShadow; - fn into_px(self, scale: kludgine::figures::Fraction) -> Self::Px { + fn into_px(self, scale: figures::Fraction) -> Self::Px { ContainerShadow { color: self.color, offset: self.offset.into_px(scale), @@ -772,7 +770,7 @@ where } } - fn from_px(px: Self::Px, scale: kludgine::figures::Fraction) -> Self { + fn from_px(px: Self::Px, scale: figures::Fraction) -> Self { Self { color: px.color, offset: Point::from_px(px.offset, scale), @@ -781,7 +779,7 @@ where } } - fn into_upx(self, scale: kludgine::figures::Fraction) -> Self::UPx { + fn into_upx(self, scale: figures::Fraction) -> Self::UPx { ContainerShadow { color: self.color, offset: self.offset.into_upx(scale), @@ -790,7 +788,7 @@ where } } - fn from_upx(px: Self::UPx, scale: kludgine::figures::Fraction) -> Self { + fn from_upx(px: Self::UPx, scale: figures::Fraction) -> Self { Self { color: px.color, offset: Point::from_upx(px.offset, scale), @@ -799,7 +797,7 @@ where } } - fn into_lp(self, scale: kludgine::figures::Fraction) -> Self::Lp { + fn into_lp(self, scale: figures::Fraction) -> Self::Lp { ContainerShadow { color: self.color, offset: self.offset.into_lp(scale), @@ -808,7 +806,7 @@ where } } - fn from_lp(lp: Self::Lp, scale: kludgine::figures::Fraction) -> Self { + fn from_lp(lp: Self::Lp, scale: figures::Fraction) -> Self { Self { color: lp.color, offset: Point::from_lp(lp.offset, scale), diff --git a/src/widgets/custom.rs b/src/widgets/custom.rs index a4d9471..f25aa84 100644 --- a/src/widgets/custom.rs +++ b/src/widgets/custom.rs @@ -1,11 +1,11 @@ use std::fmt::Debug; +use figures::units::Px; +use figures::{Point, Size}; use kludgine::app::winit::event::{ DeviceId, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase, }; use kludgine::app::winit::window::CursorIcon; -use kludgine::figures::units::Px; -use kludgine::figures::{Point, Size}; use kludgine::Color; use crate::context::{EventContext, GraphicsContext, LayoutContext, WidgetContext}; diff --git a/src/widgets/expand.rs b/src/widgets/expand.rs index ddeaf15..60a7745 100644 --- a/src/widgets/expand.rs +++ b/src/widgets/expand.rs @@ -1,4 +1,4 @@ -use kludgine::figures::{IntoSigned, Size}; +use figures::{IntoSigned, Size}; use crate::context::{AsEventContext, EventContext, LayoutContext}; use crate::widget::{MakeWidget, RootBehavior, WidgetRef, WrappedLayout, WrapperWidget}; diff --git a/src/widgets/grid.rs b/src/widgets/grid.rs index a45e3aa..fcbd19c 100644 --- a/src/widgets/grid.rs +++ b/src/widgets/grid.rs @@ -6,11 +6,9 @@ use std::fmt::Debug; use std::ops::{Deref, DerefMut}; use alot::{LotId, OrderedLots}; +use figures::units::{Lp, UPx}; +use figures::{Fraction, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size}; use intentional::{Assert, Cast}; -use kludgine::figures::units::{Lp, UPx}; -use kludgine::figures::{ - Fraction, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, -}; use crate::context::{AsEventContext, EventContext, GraphicsContext, LayoutContext}; use crate::styles::components::IntrinsicPadding; @@ -577,8 +575,8 @@ impl Deref for GridLayout { mod tests { use std::cmp::Ordering; - use kludgine::figures::units::UPx; - use kludgine::figures::{Fraction, IntoSigned, Size}; + use figures::units::UPx; + use figures::{Fraction, IntoSigned, Size}; use super::{GridDimension, GridLayout, Orientation}; use crate::styles::Dimension; diff --git a/src/widgets/image.rs b/src/widgets/image.rs index f6780a0..76174a5 100644 --- a/src/widgets/image.rs +++ b/src/widgets/image.rs @@ -1,7 +1,7 @@ //! A widget that displays an image/texture. -use kludgine::figures::units::UPx; -use kludgine::figures::{FloatConversion, IntoSigned, Point, Rect, Size, Zero}; +use figures::units::UPx; +use figures::{FloatConversion, IntoSigned, Point, Rect, Size, Zero}; use kludgine::{AnyTexture, CollectedTexture, LazyTexture, SharedTexture, Texture, TextureRegion}; use crate::animation::ZeroToOne; diff --git a/src/widgets/input.rs b/src/widgets/input.rs index e92f86b..67f66af 100644 --- a/src/widgets/input.rs +++ b/src/widgets/input.rs @@ -8,14 +8,14 @@ use std::ops::{Deref, DerefMut}; use std::sync::{Arc, OnceLock}; use std::time::Duration; +use figures::units::{Lp, Px, UPx}; +use figures::{ + Abs, FloatConversion, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, +}; use intentional::Cast; use kludgine::app::winit::event::{ElementState, Ime, KeyEvent}; use kludgine::app::winit::keyboard::{Key, NamedKey}; use kludgine::app::winit::window::{CursorIcon, ImePurpose}; -use kludgine::figures::units::{Lp, Px, UPx}; -use kludgine::figures::{ - Abs, FloatConversion, IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, -}; use kludgine::shapes::{Shape, StrokeOptions}; use kludgine::text::{MeasuredText, Text, TextOrigin}; use kludgine::{CanRenderTo, Color, DrawableExt}; diff --git a/src/widgets/label.rs b/src/widgets/label.rs index 147f07c..ec9c76e 100644 --- a/src/widgets/label.rs +++ b/src/widgets/label.rs @@ -1,7 +1,7 @@ //! A read-only text widget. -use kludgine::figures::units::{Px, UPx}; -use kludgine::figures::{Point, Round, Size}; +use figures::units::{Px, UPx}; +use figures::{Point, Round, Size}; use kludgine::text::{MeasuredText, Text, TextOrigin}; use kludgine::{CanRenderTo, Color, DrawableExt}; diff --git a/src/widgets/layers.rs b/src/widgets/layers.rs index 12c9316..50a4194 100644 --- a/src/widgets/layers.rs +++ b/src/widgets/layers.rs @@ -6,9 +6,9 @@ use std::time::Duration; use alot::{LotId, OrderedLots}; use cushy::widget::{RootBehavior, WidgetInstance}; +use figures::units::{Lp, Px, UPx}; +use figures::{IntoSigned, IntoUnsigned, Point, Rect, Size, Zero}; use intentional::Assert; -use kludgine::figures::units::{Lp, Px, UPx}; -use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Rect, Size, Zero}; use crate::animation::easings::EaseOutQuadradic; use crate::animation::{AnimationHandle, AnimationTarget, IntoAnimate, Spawn, ZeroToOne}; diff --git a/src/widgets/progress.rs b/src/widgets/progress.rs index eea4829..85225eb 100644 --- a/src/widgets/progress.rs +++ b/src/widgets/progress.rs @@ -3,8 +3,8 @@ use std::ops::RangeInclusive; use std::time::Duration; -use kludgine::figures::units::Px; -use kludgine::figures::{Angle, Point, Ranged, ScreenScale, Size, Zero}; +use figures::units::Px; +use figures::{Angle, Point, Ranged, ScreenScale, Size, Zero}; use kludgine::shapes::{Path, StrokeOptions}; use kludgine::Color; @@ -383,9 +383,9 @@ impl Widget for Spinner { fn layout( &mut self, - available_space: kludgine::figures::Size, + available_space: figures::Size, context: &mut crate::context::LayoutContext<'_, '_, '_, '_, '_>, - ) -> kludgine::figures::Size { + ) -> figures::Size { let track_size = context.get(&TrackSize).into_px(context.gfx.scale()); let minimum_size = track_size * 4; diff --git a/src/widgets/radio.rs b/src/widgets/radio.rs index cbdf2bb..eae447f 100644 --- a/src/widgets/radio.rs +++ b/src/widgets/radio.rs @@ -1,8 +1,8 @@ //! A labeled widget with a circular indicator representing a value. use std::fmt::Debug; -use kludgine::figures::units::Lp; -use kludgine::figures::{Point, ScreenScale, Size}; +use figures::units::Lp; +use figures::{Point, ScreenScale, Size}; use kludgine::shapes::{Shape, StrokeOptions}; use kludgine::DrawableExt; @@ -119,7 +119,7 @@ where &mut self, _available_space: Size, context: &mut LayoutContext<'_, '_, '_, '_, '_>, - ) -> Size { + ) -> Size { let radio_size = context.get(&RadioSize).into_upx(context.gfx.scale()); Size::squared(radio_size) } diff --git a/src/widgets/resize.rs b/src/widgets/resize.rs index 99d641b..bb9a271 100644 --- a/src/widgets/resize.rs +++ b/src/widgets/resize.rs @@ -1,4 +1,4 @@ -use kludgine::figures::{Fraction, IntoSigned, ScreenScale, Size}; +use figures::{Fraction, IntoSigned, ScreenScale, Size}; use crate::context::{AsEventContext, EventContext, LayoutContext}; use crate::styles::DimensionRange; @@ -50,8 +50,8 @@ impl Resize { /// `width` can be an any of: /// /// - [`Dimension`](crate::styles::Dimension) - /// - [`Px`](crate::kludgine::figures::units::Px) - /// - [`Lp`](crate::kludgine::figures::units::Lp) + /// - [`Px`](crate::figures::units::Px) + /// - [`Lp`](crate::figures::units::Lp) /// - A range of any fo the above. #[must_use] pub fn width(mut self, width: impl Into) -> Self { @@ -64,8 +64,8 @@ impl Resize { /// `height` can be an any of: /// /// - [`Dimension`](crate::styles::Dimension) - /// - [`Px`](crate::kludgine::figures::units::Px) - /// - [`Lp`](crate::kludgine::figures::units::Lp) + /// - [`Px`](crate::figures::units::Px) + /// - [`Lp`](crate::figures::units::Lp) /// - A range of any fo the above. #[must_use] pub fn height(mut self, height: impl Into) -> Self { diff --git a/src/widgets/scroll.rs b/src/widgets/scroll.rs index 2d3084f..f3638d9 100644 --- a/src/widgets/scroll.rs +++ b/src/widgets/scroll.rs @@ -1,13 +1,11 @@ //! A container that scrolls its contents on a virtual surface. use std::time::{Duration, Instant}; +use figures::units::{Lp, Px, UPx}; +use figures::{FloatConversion, IntoSigned, IntoUnsigned, Point, Rect, ScreenScale, Size, Zero}; use intentional::Cast; use kludgine::app::winit::event::{DeviceId, MouseScrollDelta, TouchPhase}; use kludgine::app::winit::window::CursorIcon; -use kludgine::figures::units::{Lp, Px, UPx}; -use kludgine::figures::{ - FloatConversion, IntoSigned, IntoUnsigned, Point, Rect, ScreenScale, Size, Zero, -}; use kludgine::shapes::Shape; use kludgine::Color; diff --git a/src/widgets/slider.rs b/src/widgets/slider.rs index 49d0ffd..2c3de1d 100644 --- a/src/widgets/slider.rs +++ b/src/widgets/slider.rs @@ -3,14 +3,12 @@ use std::fmt::Debug; use std::mem; use std::ops::RangeInclusive; +use figures::units::{Lp, Px, UPx}; +use figures::{FloatConversion, IntoSigned, Point, Ranged, Rect, Round, ScreenScale, Size}; use intentional::{Assert, Cast as _}; use kludgine::app::winit::event::{DeviceId, MouseButton, MouseScrollDelta, TouchPhase}; use kludgine::app::winit::keyboard::{Key, NamedKey}; use kludgine::app::winit::window::CursorIcon; -use kludgine::figures::units::{Lp, Px, UPx}; -use kludgine::figures::{ - FloatConversion, IntoSigned, Point, Ranged, Rect, Round, ScreenScale, Size, -}; use kludgine::shapes::{Shape, StrokeOptions}; use kludgine::{Color, DrawableExt, Origin}; diff --git a/src/widgets/space.rs b/src/widgets/space.rs index f7b9cdd..93dd8aa 100644 --- a/src/widgets/space.rs +++ b/src/widgets/space.rs @@ -1,5 +1,5 @@ -use kludgine::figures::units::UPx; -use kludgine::figures::Size; +use figures::units::UPx; +use figures::Size; use kludgine::Color; use crate::context::{GraphicsContext, LayoutContext}; diff --git a/src/widgets/stack.rs b/src/widgets/stack.rs index 6ff39ce..35daf20 100644 --- a/src/widgets/stack.rs +++ b/src/widgets/stack.rs @@ -1,7 +1,7 @@ //! A widget that combines a collection of [`Children`] widgets into one. -use kludgine::figures::units::UPx; -use kludgine::figures::{IntoSigned, Rect, Round, ScreenScale, Size}; +use figures::units::UPx; +use figures::{IntoSigned, Rect, Round, ScreenScale, Size}; use crate::context::{AsEventContext, EventContext, GraphicsContext, LayoutContext}; use crate::styles::components::IntrinsicPadding; diff --git a/src/widgets/switcher.rs b/src/widgets/switcher.rs index 0928a52..2259f8a 100644 --- a/src/widgets/switcher.rs +++ b/src/widgets/switcher.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use kludgine::figures::Size; +use figures::Size; use crate::context::{AsEventContext, LayoutContext}; use crate::value::{Dynamic, DynamicReader, IntoDynamic}; diff --git a/src/widgets/tilemap.rs b/src/widgets/tilemap.rs index 6e53c65..4737e65 100644 --- a/src/widgets/tilemap.rs +++ b/src/widgets/tilemap.rs @@ -1,17 +1,14 @@ use std::fmt::Debug; +use figures::units::{Px, UPx}; +use figures::{Point, Size}; use intentional::Cast; -use kludgine::app::winit::event::ElementState; +use kludgine::app::winit::event::{DeviceId, ElementState, KeyEvent, MouseScrollDelta, TouchPhase}; use kludgine::app::winit::window::CursorIcon; -use kludgine::figures::units::Px; -use kludgine::figures::Point; +use kludgine::tilemap; +use kludgine::tilemap::TileMapFocus; use crate::context::{EventContext, GraphicsContext, LayoutContext}; -use crate::kludgine::app::winit::event::{DeviceId, KeyEvent, MouseScrollDelta, TouchPhase}; -use crate::kludgine::figures::units::UPx; -use crate::kludgine::figures::Size; -use crate::kludgine::tilemap; -use crate::kludgine::tilemap::TileMapFocus; use crate::tick::Tick; use crate::value::{Dynamic, IntoValue, Value}; use crate::widget::{EventHandling, Widget, HANDLED, IGNORED}; @@ -112,7 +109,7 @@ where fn hit_test( &mut self, - _location: kludgine::figures::Point, + _location: figures::Point, _context: &mut EventContext<'_, '_>, ) -> bool { true diff --git a/src/widgets/wrap.rs b/src/widgets/wrap.rs index a333b72..fcc9c79 100644 --- a/src/widgets/wrap.rs +++ b/src/widgets/wrap.rs @@ -1,9 +1,9 @@ //! A widget for laying out multiple widgets in a similar fashion as how words //! are wrapped in a paragraph. +use figures::units::{Px, UPx}; +use figures::{IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, Zero}; use intentional::Cast; -use kludgine::figures::units::{Px, UPx}; -use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Rect, Round, ScreenScale, Size, Zero}; use crate::context::{AsEventContext, GraphicsContext, LayoutContext}; use crate::styles::components::{IntrinsicPadding, LayoutOrder}; diff --git a/src/window.rs b/src/window.rs index 1849d4c..b2bb983 100644 --- a/src/window.rs +++ b/src/window.rs @@ -11,6 +11,8 @@ use std::sync::{Arc, Mutex, MutexGuard, OnceLock}; use ahash::AHashMap; use alot::LotId; use arboard::Clipboard; +use figures::units::{Px, UPx}; +use figures::{IntoSigned, IntoUnsigned, Point, Ranged, Rect, ScreenScale, Size, Zero}; use kludgine::app::winit::dpi::{PhysicalPosition, PhysicalSize}; use kludgine::app::winit::event::{ DeviceId, ElementState, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase, @@ -19,8 +21,6 @@ use kludgine::app::winit::keyboard::{Key, NamedKey}; use kludgine::app::winit::window; use kludgine::app::WindowBehavior as _; use kludgine::cosmic_text::{fontdb, Family, FamilyOwned}; -use kludgine::figures::units::{Px, UPx}; -use kludgine::figures::{IntoSigned, IntoUnsigned, Point, Ranged, Rect, ScreenScale, Size, Zero}; use kludgine::render::Drawing; use kludgine::wgpu::CompositeAlphaMode; use kludgine::Kludgine; @@ -1398,8 +1398,8 @@ pub(crate) struct CursorState { pub(crate) mod sealed { use std::cell::RefCell; - use kludgine::figures::units::UPx; - use kludgine::figures::Size; + use figures::units::UPx; + use figures::Size; use crate::app::Cushy; use crate::context::InvalidationStatus;