Directly depending on figures

While this was a workaround for a docs.rs issue (Px/Lp are not
linked), I decided having the shorter import path would look better in
the examples.

It probably wasn't necessary to update all of the references in the
internal code, but I decided it was worth the consistency.
This commit is contained in:
Jonathan Johnson 2023-12-28 09:35:24 -08:00
parent 98f8d3a43d
commit 2fe28729df
No known key found for this signature in database
GPG key ID: A66D6A34D6620579
59 changed files with 145 additions and 144 deletions

View file

@ -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

1
Cargo.lock generated
View file

@ -576,6 +576,7 @@ dependencies = [
"alot",
"arboard",
"cushy-macros",
"figures",
"image",
"intentional",
"interner",

View file

@ -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",
# ] }

View file

@ -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());

View file

@ -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};

View file

@ -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 {

View file

@ -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();

View file

@ -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);

View file

@ -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<kludgine::figures::units::Px>,
_location: figures::Point<figures::units::Px>,
_context: &mut cushy::context::EventContext<'_, '_>,
) -> bool {
true
@ -115,7 +115,7 @@ impl Widget for Toggle {
fn mouse_down(
&mut self,
_location: kludgine::figures::Point<kludgine::figures::units::Px>,
_location: figures::Point<figures::units::Px>,
_device_id: kludgine::app::winit::event::DeviceId,
_button: kludgine::app::winit::event::MouseButton,
_context: &mut cushy::context::EventContext<'_, '_>,

View file

@ -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

View file

@ -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);

View file

@ -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 {

View file

@ -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");

View file

@ -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();

View file

@ -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")

View file

@ -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};

View file

@ -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);

View file

@ -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);

View file

@ -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 {

View file

@ -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;

View file

@ -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();

View file

@ -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};

View file

@ -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();

View file

@ -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);

View file

@ -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.";

View file

@ -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;

View file

@ -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};

View file

@ -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};

View file

@ -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};

View file

@ -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)
}

View file

@ -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 {

View file

@ -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;

View file

@ -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;

View file

@ -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<DimensionRange>) -> 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<DimensionRange>) -> Resize {

View file

@ -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};

View file

@ -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;

View file

@ -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;

View file

@ -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<ConstraintLimit>,
context: &mut LayoutContext<'_, '_, '_, '_, '_>,
) -> Size<kludgine::figures::units::UPx> {
) -> Size<figures::units::UPx> {
let checkbox_size = context.get(&CheckboxSize).into_upx(context.gfx.scale());
Size::squared(checkbox_size)
}

View file

@ -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};

View file

@ -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};

View file

@ -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<Px>;
type UPx = ContainerShadow<UPx>;
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),

View file

@ -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};

View file

@ -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};

View file

@ -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;

View file

@ -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;

View file

@ -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};

View file

@ -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};

View file

@ -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};

View file

@ -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<crate::ConstraintLimit>,
available_space: figures::Size<crate::ConstraintLimit>,
context: &mut crate::context::LayoutContext<'_, '_, '_, '_, '_>,
) -> kludgine::figures::Size<kludgine::figures::units::UPx> {
) -> figures::Size<figures::units::UPx> {
let track_size = context.get(&TrackSize).into_px(context.gfx.scale());
let minimum_size = track_size * 4;

View file

@ -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<ConstraintLimit>,
context: &mut LayoutContext<'_, '_, '_, '_, '_>,
) -> Size<kludgine::figures::units::UPx> {
) -> Size<figures::units::UPx> {
let radio_size = context.get(&RadioSize).into_upx(context.gfx.scale());
Size::squared(radio_size)
}

View file

@ -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<DimensionRange>) -> 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<DimensionRange>) -> Self {

View file

@ -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;

View file

@ -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};

View file

@ -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};

View file

@ -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;

View file

@ -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};

View file

@ -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<kludgine::figures::units::Px>,
_location: figures::Point<figures::units::Px>,
_context: &mut EventContext<'_, '_>,
) -> bool {
true

View file

@ -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};

View file

@ -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;