Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflow clip margin #15561

Merged
merged 66 commits into from
Oct 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
bcabdbf
Taffy returns border values now, so there is no need to compute them …
ickshonpe Sep 10, 2024
c74c0cf
Merge branch 'main' into compute-borders-in-layout
ickshonpe Sep 10, 2024
266fafc
Fixed ui_material_pipeline's border normalization
ickshonpe Sep 10, 2024
bc67d38
removed unused imports
ickshonpe Sep 10, 2024
bfea0c9
Fixed border scalings.
ickshonpe Sep 10, 2024
18bb3fd
Removed unused imports
ickshonpe Sep 10, 2024
4a6b475
Removed unneed attribute.
ickshonpe Sep 10, 2024
ceefb43
removed border radius scaling
ickshonpe Sep 10, 2024
5512508
scale border radius Px values
ickshonpe Sep 10, 2024
a76f7eb
remove more scalings
ickshonpe Sep 10, 2024
ce8006e
`Node` contains logical coords, not physical.
ickshonpe Sep 10, 2024
5d99685
Cleanup.
ickshonpe Sep 11, 2024
eefc23d
Removed the `Inset` type, use a `BorderRect` to hold the resolved bor…
ickshonpe Sep 11, 2024
a31a987
added a `ZERO` const to `BorderRect`
ickshonpe Sep 11, 2024
237fd80
Use `BorderRect` in layout updates
ickshonpe Sep 11, 2024
f8b79cd
Removed old border extraction code
ickshonpe Sep 11, 2024
86aa524
clean up unused
ickshonpe Sep 11, 2024
8e35831
removed `logical_rect` method from `Node`
ickshonpe Sep 11, 2024
62d1c06
Removed unused import
ickshonpe Sep 11, 2024
d687217
improved corner radius visualization
ickshonpe Sep 11, 2024
4c31adf
Fixed `ExtractedUiNode` doc errors
ickshonpe Sep 11, 2024
334d361
removed unneeded import
ickshonpe Sep 11, 2024
789c4de
Removed doc link to private item.
ickshonpe Sep 11, 2024
c696763
Update crates/bevy_ui/src/render/ui.wgsl
ickshonpe Sep 25, 2024
f012b66
Added `outlined_node_size` method.
ickshonpe Sep 25, 2024
9d3b761
Fixed extracted image node border values
ickshonpe Sep 25, 2024
0001986
Added some non-uniform border-radius to the borders example.
ickshonpe Sep 25, 2024
1ce5bfe
Reverted shader changes
ickshonpe Sep 25, 2024
0312753
Merge branch 'main' into update-borders-in-layout
ickshonpe Sep 25, 2024
84e0a07
Fix up imports
ickshonpe Sep 25, 2024
2b78765
Fix up imports
ickshonpe Sep 25, 2024
2be7403
use `outlined_node_size` method in extaction
ickshonpe Sep 25, 2024
7cebb61
Merge branch 'update-borders-in-layout' of https://github.com/ickshon…
ickshonpe Sep 25, 2024
2878b24
Set outline width to zero width for uinodes with `Display::None` set.
ickshonpe Sep 25, 2024
68f1478
Added padding field and accessor method to `Node`
ickshonpe Sep 26, 2024
1419830
copy padding values to nodes in `ui_layout_system`
ickshonpe Sep 26, 2024
c33150a
fixed `Node::DEFAULT`
ickshonpe Sep 26, 2024
ff258e9
Added `content_inset` method to `Node`, returns the sum of the border…
ickshonpe Sep 26, 2024
d4bacbc
Fixed `content_inset` calculations
ickshonpe Sep 26, 2024
1091755
changed `update_clipping` to clip around the content box instead of t…
ickshonpe Sep 26, 2024
551f208
Added borders to the overflow example.
ickshonpe Sep 26, 2024
ec41f95
Removed ui scaling from example
ickshonpe Sep 26, 2024
fb9dfce
Merge branch 'main' into clip-inside-padding-box
ickshonpe Sep 27, 2024
2a1bad4
Merge branch 'main' into clip-inside-padding-box
ickshonpe Sep 30, 2024
508238d
Added `OverflowClipMargin` and `OverflowClipBox` types
ickshonpe Oct 1, 2024
981c3d2
Added const `DEFAULT` for `OverflowClipMargin`
ickshonpe Oct 1, 2024
4b5655e
Added `overflow_clip_margin: OverflowClipMargin` field to `Style`.
ickshonpe Oct 1, 2024
c55c9bf
Changed `margin` field to an `f32` value
ickshonpe Oct 1, 2024
75f70af
Implemented new clipping.
ickshonpe Oct 1, 2024
09694d6
Added const constructors for `OverflowClipMargin`
ickshonpe Oct 1, 2024
e3832f0
Fixed constructor functions
ickshonpe Oct 1, 2024
47a3c71
Fixed clip rect margins
ickshonpe Oct 1, 2024
5d55bd2
Added `overflow_clip_margin` example
ickshonpe Oct 1, 2024
6318ab9
Added example to cargo and readme
ickshonpe Oct 1, 2024
d7a9de3
updated comments
ickshonpe Oct 1, 2024
7c06252
cargo run -p build-templated-pages -- update examples
ickshonpe Oct 1, 2024
02f4b92
Fixed test
ickshonpe Oct 1, 2024
bdffd80
Merge branch 'main' into overflow-clip-margin
ickshonpe Oct 14, 2024
e94b2f0
Updated the example to the support new text api.
ickshonpe Oct 14, 2024
1f44f3b
Replaced the `margin` parameter on the associated constructor functio…
ickshonpe Oct 14, 2024
788a1e2
Replaced the `margin` parameter on the associated constructor functio…
ickshonpe Oct 14, 2024
08247b3
Merge branch 'overflow-clip-margin' of https://github.com/ickshonpe/b…
ickshonpe Oct 14, 2024
b543ada
Merge branch 'main' into overflow-clip-margin
ickshonpe Oct 14, 2024
0c229ab
Merge branch 'main' into overflow-clip-margin
ickshonpe Oct 15, 2024
5727af5
Merge branch 'main' into overflow-clip-margin
ickshonpe Oct 16, 2024
417760a
Updated comments.
ickshonpe Oct 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed unused imports
  • Loading branch information
ickshonpe committed Sep 10, 2024
commit bc67d38c53bb4c209b2297083a4c21bec7b655ab
18 changes: 2 additions & 16 deletions crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use bevy_color::{Alpha, ColorToComponents, LinearRgba};
use bevy_core_pipeline::core_2d::graph::{Core2d, Node2d};
use bevy_core_pipeline::core_3d::graph::{Core3d, Node3d};
use bevy_core_pipeline::{core_2d::Camera2d, core_3d::Camera3d};
use bevy_hierarchy::Parent;
use bevy_render::render_phase::ViewSortedRenderPhases;
use bevy_render::texture::TRANSPARENT_IMAGE_HANDLE;
use bevy_render::{
Expand All @@ -24,9 +23,8 @@ use ui_texture_slice_pipeline::UiTextureSlicerPlugin;

use crate::graph::{NodeUi, SubGraphUi};
use crate::{
BackgroundColor, BorderColor, CalculatedClip, DefaultUiCamera, Display, Node, Outline, Style,
TargetCamera, UiImage, UiScale, Val,
};
BackgroundColor, BorderColor, CalculatedClip, DefaultUiCamera, Node, Outline, TargetCamera,
UiImage, UiScale,

use bevy_app::prelude::*;
use bevy_asset::{load_internal_asset, AssetEvent, AssetId, Assets, Handle};
Expand Down Expand Up @@ -356,18 +354,6 @@ pub fn extract_uinode_images(
}
}

pub(crate) fn resolve_border_thickness(value: Val, parent_width: f32, viewport_size: Vec2) -> f32 {
match value {
Val::Auto => 0.,
Val::Px(px) => px.max(0.),
Val::Percent(percent) => (parent_width * percent / 100.).max(0.),
Val::Vw(percent) => (viewport_size.x * percent / 100.).max(0.),
Val::Vh(percent) => (viewport_size.y * percent / 100.).max(0.),
Val::VMin(percent) => (viewport_size.min_element() * percent / 100.).max(0.),
Val::VMax(percent) => (viewport_size.max_element() * percent / 100.).max(0.),
}
}

#[inline]
fn clamp_corner(r: f32, size: Vec2, offset: Vec2) -> f32 {
let s = 0.5 * size + offset;
Expand Down