This commit is contained in:
galister
2025-12-24 00:58:40 +09:00
parent 6672fb71e4
commit 3f5a363136
23 changed files with 484 additions and 430 deletions

View File

@@ -1,25 +1,24 @@
use crate::{
animation::{Animation, AnimationEasing},
assets::AssetPath,
components::{self, tooltip::ComponentTooltip, Component, ComponentBase, ComponentTrait, RefreshData},
components::{self, Component, ComponentBase, ComponentTrait, RefreshData, tooltip::ComponentTooltip},
drawing::{self, Boundary, Color},
event::{CallbackDataCommon, EventListenerCollection, EventListenerID, EventListenerKind},
i18n::Translation,
layout::{LayoutTask, WidgetID, WidgetPair},
renderer_vk::{
text::{
custom_glyph::{CustomGlyphContent, CustomGlyphData},
FontWeight, TextStyle,
custom_glyph::{CustomGlyphContent, CustomGlyphData},
},
util::centered_matrix,
},
widget::{
self,
self, ConstructEssentials, EventResult, WidgetData,
label::{WidgetLabel, WidgetLabelParams},
rectangle::{WidgetRectangle, WidgetRectangleParams},
sprite::{WidgetSprite, WidgetSpriteParams},
util::WLength,
ConstructEssentials, EventResult, WidgetData,
},
};
use glam::{Mat4, Vec3};
@@ -28,7 +27,7 @@ use std::{
rc::Rc,
time::{Duration, Instant},
};
use taffy::{prelude::length, AlignItems, JustifyContent};
use taffy::{AlignItems, JustifyContent, prelude::length};
pub struct Params<'a> {
pub text: Option<Translation>, // if unset, label will not be populated

View File

@@ -1,7 +1,7 @@
use std::{cell::RefCell, rc::Rc};
use taffy::{
prelude::{length, percent},
AlignItems,
prelude::{length, percent},
};
use crate::{
@@ -13,10 +13,10 @@ use crate::{
layout::{self, WidgetID, WidgetPair},
renderer_vk::text::{FontWeight, TextStyle},
widget::{
ConstructEssentials, EventResult,
label::{WidgetLabel, WidgetLabelParams},
rectangle::{WidgetRectangle, WidgetRectangleParams},
util::WLength,
ConstructEssentials, EventResult,
},
};

View File

@@ -18,11 +18,11 @@ use crate::{
util,
},
widget::{
ConstructEssentials, EventResult,
div::WidgetDiv,
label::{WidgetLabel, WidgetLabelParams},
rectangle::{WidgetRectangle, WidgetRectangleParams},
util::WLength,
ConstructEssentials, EventResult,
},
};

View File

@@ -10,8 +10,8 @@ use crate::{
globals::Globals,
layout::Widget,
renderer_vk::text::{
custom_glyph::{CustomGlyph, CustomGlyphData},
TextShadow,
custom_glyph::{CustomGlyph, CustomGlyphData},
},
stack::{self, ScissorBoundary, ScissorStack, TransformStack},
widget::{self, ScrollbarInfo, WidgetState},

View File

@@ -1,13 +1,13 @@
use crate::{
assets::AssetPath,
components::{button, tooltip, Component},
components::{Component, button, tooltip},
drawing::Color,
i18n::Translation,
layout::WidgetID,
parser::{
parse_check_f32, parse_check_i32, parse_children, parse_f32, print_invalid_attrib, process_component,
AttribPair, ParserContext, ParserFile, parse_check_f32, parse_check_i32, parse_children, parse_f32,
print_invalid_attrib, process_component,
style::{parse_color_opt, parse_round, parse_style, parse_text_style},
AttribPair, ParserContext, ParserFile,
},
widget::util::WLength,
};

View File

@@ -9,7 +9,7 @@ mod widget_rectangle;
mod widget_sprite;
use crate::{
assets::{normalize_path, AssetPath, AssetPathOwned},
assets::{AssetPath, AssetPathOwned, normalize_path},
components::{Component, ComponentWeak},
drawing::{self},
globals::WguiGlobals,

View File

@@ -6,8 +6,8 @@ use taffy::{
use crate::{
drawing,
parser::{
is_percent, parse_color_hex, parse_f32, parse_percent, parse_size_unit, parse_val, print_invalid_attrib,
print_invalid_value, AttribPair,
AttribPair, is_percent, parse_color_hex, parse_f32, parse_percent, parse_size_unit, parse_val,
print_invalid_attrib, print_invalid_value,
},
renderer_vk::text::{FontWeight, HorizontalAlign, TextStyle},
widget::util::WLength,

View File

@@ -2,9 +2,8 @@ use crate::{
assets::AssetPath,
layout::WidgetID,
parser::{
parse_children, parse_widget_universal, print_invalid_attrib,
AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, print_invalid_attrib,
style::{parse_color, parse_round, parse_style},
AttribPair, ParserContext, ParserFile,
},
renderer_vk::text::custom_glyph::{CustomGlyphContent, CustomGlyphData},
widget::image::{WidgetImage, WidgetImageParams},

View File

@@ -2,9 +2,8 @@ use crate::{
drawing::GradientMode,
layout::WidgetID,
parser::{
parse_children, parse_widget_universal, print_invalid_attrib,
AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, print_invalid_attrib,
style::{parse_color, parse_round, parse_style},
AttribPair, ParserContext, ParserFile,
},
widget::rectangle::{WidgetRectangle, WidgetRectangleParams},
};

View File

@@ -1,7 +1,7 @@
use crate::{
assets::AssetPath,
layout::WidgetID,
parser::{parse_children, parse_widget_universal, style::parse_style, AttribPair, ParserContext, ParserFile},
parser::{AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, style::parse_style},
renderer_vk::text::custom_glyph::{CustomGlyphContent, CustomGlyphData},
widget::sprite::{WidgetSprite, WidgetSpriteParams},
};

View File

@@ -2,22 +2,22 @@ use std::{cell::RefCell, rc::Rc, sync::Arc};
use cosmic_text::Buffer;
use glam::{Mat4, Vec2, Vec3};
use slotmap::{new_key_type, SlotMap};
use slotmap::{SlotMap, new_key_type};
use vulkano::pipeline::graphics::viewport;
use crate::{
drawing::{self},
font_config,
gfx::{cmd::GfxCommandBuffer, WGfx},
gfx::{WGfx, cmd::GfxCommandBuffer},
renderer_vk::image::{ImagePipeline, ImageRenderer},
};
use super::{
rect::{RectPipeline, RectRenderer},
text::{
DEFAULT_METRICS, SWASH_CACHE, TextArea, TextBounds,
text_atlas::{TextAtlas, TextPipeline},
text_renderer::TextRenderer,
TextArea, TextBounds, DEFAULT_METRICS, SWASH_CACHE,
},
viewport::Viewport,
};

View File

@@ -14,10 +14,10 @@ use vulkano::{
use crate::{
drawing::{Boundary, ImagePrimitive},
gfx::{
BLEND_ALPHA, WGfx,
cmd::GfxCommandBuffer,
pass::WGfxPass,
pipeline::{WGfxPipeline, WPipelineCreateInfo},
WGfx, BLEND_ALPHA,
},
renderer_vk::{
model_buffer::ModelBuffer,

View File

@@ -10,10 +10,10 @@ use vulkano::{
use crate::{
drawing::{Boundary, Rectangle},
gfx::{
BLEND_ALPHA, WGfx,
cmd::GfxCommandBuffer,
pass::WGfxPass,
pipeline::{WGfxPipeline, WPipelineCreateInfo},
WGfx, BLEND_ALPHA,
},
renderer_vk::model_buffer::ModelBuffer,
};

View File

@@ -1,8 +1,8 @@
use std::{
f32,
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
atomic::{AtomicUsize, Ordering},
},
};

View File

@@ -8,7 +8,7 @@ use crate::{
globals::Globals,
layout::WidgetID,
renderer_vk::text::custom_glyph::CustomGlyphData,
widget::{util::WLength, WidgetStateFlags},
widget::{WidgetStateFlags, util::WLength},
};
use super::{WidgetObj, WidgetState};

View File

@@ -206,11 +206,7 @@ impl EventResult {
#[must_use]
pub fn merge(self, other: Self) -> Self {
if self > other {
self
} else {
other
}
if self > other { self } else { other }
}
}

View File

@@ -4,7 +4,7 @@ use crate::{
drawing::{self, GradientMode, PrimitiveExtent},
event::CallbackDataCommon,
layout::WidgetID,
widget::{util::WLength, WidgetStateFlags},
widget::{WidgetStateFlags, util::WLength},
};
use super::{WidgetObj, WidgetState};

View File

@@ -9,8 +9,8 @@ use crate::{
globals::Globals,
layout::WidgetID,
renderer_vk::text::{
custom_glyph::{CustomGlyph, CustomGlyphData},
DEFAULT_METRICS,
custom_glyph::{CustomGlyph, CustomGlyphData},
},
widget::WidgetStateFlags,
};