Skip to content
Snippets Groups Projects
Commit 9ca2b007 authored by StarToaster's avatar StarToaster
Browse files

Fix formatting issues.

parent 41e732c8
No related branches found
No related tags found
No related merge requests found
...@@ -16,8 +16,8 @@ use kayak_font::KayakFont; ...@@ -16,8 +16,8 @@ use kayak_font::KayakFont;
pub mod font; pub mod font;
pub mod image; pub mod image;
mod nine_patch; mod nine_patch;
mod texture_atlas;
mod quad; mod quad;
mod texture_atlas;
pub struct BevyKayakUIExtractPlugin; pub struct BevyKayakUIExtractPlugin;
...@@ -81,8 +81,12 @@ pub fn extract( ...@@ -81,8 +81,12 @@ pub fn extract(
extracted_quads.extend(nine_patch_quads); extracted_quads.extend(nine_patch_quads);
} }
RenderPrimitive::TextureAtlas { .. } => { RenderPrimitive::TextureAtlas { .. } => {
let texture_atlas_quads = let texture_atlas_quads = texture_atlas::extract_texture_atlas(
texture_atlas::extract_texture_atlas(&render_primitive, &image_manager, &images, dpi); &render_primitive,
&image_manager,
&images,
dpi,
);
extracted_quads.extend(texture_atlas_quads); extracted_quads.extend(texture_atlas_quads);
} }
RenderPrimitive::Clip { layout } => { RenderPrimitive::Clip { layout } => {
......
...@@ -21,8 +21,8 @@ pub fn extract_texture_atlas( ...@@ -21,8 +21,8 @@ pub fn extract_texture_atlas(
let (size, position, layout, handle) = match render_primitive { let (size, position, layout, handle) = match render_primitive {
RenderPrimitive::TextureAtlas { RenderPrimitive::TextureAtlas {
size, size,
position, position,
layout, layout,
handle, handle,
} => (size, position, layout, handle), } => (size, position, layout, handle),
...@@ -57,21 +57,21 @@ pub fn extract_texture_atlas( ...@@ -57,21 +57,21 @@ pub fn extract_texture_atlas(
}, },
uv_min: Some(Vec2::new( uv_min: Some(Vec2::new(
position.0 / image_size.x, position.0 / image_size.x,
1.0 - ((position.1 + size.1) / image_size.y) 1.0 - ((position.1 + size.1) / image_size.y),
)), )),
uv_max: Some(Vec2::new( uv_max: Some(Vec2::new(
(position.0 + size.0) / image_size.x, (position.0 + size.0) / image_size.x,
1.0 - (position.1 / image_size.y), 1.0 - (position.1 / image_size.y),
)), )),
color: Color::WHITE, color: Color::WHITE,
vertex_index: 0, vertex_index: 0,
char_id: 0, char_id: 0,
z_index: layout.z_index, z_index: layout.z_index,
font_handle: None, font_handle: None,
quad_type: UIQuadType::Image, quad_type: UIQuadType::Image,
type_index: 0, type_index: 0,
border_radius: Corner::default(), border_radius: Corner::default(),
image: image_handle, image: image_handle,
}, },
}; };
extracted_quads.push(quad); extracted_quads.push(quad);
......
...@@ -105,7 +105,11 @@ impl From<&Style> for RenderPrimitive { ...@@ -105,7 +105,11 @@ impl From<&Style> for RenderPrimitive {
layout: Rect::default(), layout: Rect::default(),
handle, handle,
}, },
RenderCommand::TextureAtlas { handle, size, position, } => Self::TextureAtlas { RenderCommand::TextureAtlas {
handle,
size,
position,
} => Self::TextureAtlas {
handle, handle,
layout: Rect::default(), layout: Rect::default(),
size, size,
......
...@@ -399,7 +399,7 @@ impl Style { ...@@ -399,7 +399,7 @@ impl Style {
impl Add for Style { impl Add for Style {
type Output = Style; type Output = Style;
/// Defines the `+` operator for [`Style`]. This is a convenience wrapper of the `self.with_style()` method and useful for concatenating many small `Style` variables. /// Defines the `+` operator for [`Style`]. This is a convenience wrapper of the `self.with_style()` method and useful for concatenating many small `Style` variables.
/// Similar to `with_style()` In a `StyleA + StyleB` operation, values from `StyleB` are applied to any field of StyleA that are marked as [`StyleProp::Unset`]. /// Similar to `with_style()` In a `StyleA + StyleB` operation, values from `StyleB` are applied to any field of StyleA that are marked as [`StyleProp::Unset`].
/// ///
/// Note: since the changes are applied only to unset fields, addition is *not* commutative. This means StyleA + StyleB != StyleB + StyleA for most cases. /// Note: since the changes are applied only to unset fields, addition is *not* commutative. This means StyleA + StyleB != StyleB + StyleA for most cases.
......
...@@ -195,10 +195,7 @@ impl FontTextureCache { ...@@ -195,10 +195,7 @@ impl FontTextureCache {
texture, texture,
sampler, sampler,
texture_view, texture_view,
size: Vec2 { size: Vec2 { x: 1.0, y: 1.0 },
x: 1.0,
y: 1.0,
},
texture_format: TextureFormat::Rgba8Unorm, texture_format: TextureFormat::Rgba8Unorm,
}; };
......
...@@ -8,12 +8,12 @@ mod if_element; ...@@ -8,12 +8,12 @@ mod if_element;
mod image; mod image;
mod inspector; mod inspector;
mod nine_patch; mod nine_patch;
mod texture_atlas;
mod on_change; mod on_change;
mod scroll; mod scroll;
mod spin_box; mod spin_box;
mod text; mod text;
mod text_box; mod text_box;
mod texture_atlas;
mod tooltip; mod tooltip;
mod window; mod window;
...@@ -27,11 +27,11 @@ pub use if_element::*; ...@@ -27,11 +27,11 @@ pub use if_element::*;
pub use image::*; pub use image::*;
pub use inspector::*; pub use inspector::*;
pub use nine_patch::*; pub use nine_patch::*;
pub use texture_atlas::*;
pub use on_change::*; pub use on_change::*;
pub use scroll::*; pub use scroll::*;
pub use spin_box::*; pub use spin_box::*;
pub use text::*; pub use text::*;
pub use text_box::*; pub use text_box::*;
pub use texture_atlas::*;
pub use tooltip::*; pub use tooltip::*;
pub use window::*; pub use window::*;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment