MCPcopy Create free account
hub / github.com/PerroEngine/Perro / apply_canvas_overlay_style

Function apply_canvas_overlay_style

perro_editor/res/scripts/ui/editor_ui.rs:4423–4447  ·  view source on GitHub ↗
(
    ctx: &mut ScriptContext<'_, API>,
    mode: &str,
)

Source from the content-addressed store, hash-verified

4421pub fn set_label_size_ratio<API: ScriptAPI + ?Sized>(
4422 ctx: &mut ScriptContext<'_, API>,
4423 name: &str,
4424 size: (f32, f32),
4425) {
4426 if let Some(id) = find_named(ctx, name) {
4427 let _ = with_node_mut!(ctx.run, UiLabel, id, |node| {
4428 node.layout.size = UiVector2::ratio(size.0, size.1);
4429 });
4430 }
4431}
4432
4433pub fn set_label_text_ratio<API: ScriptAPI + ?Sized>(
4434 ctx: &mut ScriptContext<'_, API>,
4435 name: &str,
4436 ratio: f32,
4437) {
4438 if let Some(id) = find_named(ctx, name) {
4439 let _ = with_node_mut!(ctx.run, UiLabel, id, |node| {
4440 node.text_size_ratio = ratio;
4441 });
4442 }
4443}
4444
4445pub fn set_label_color<API: ScriptAPI + ?Sized>(
4446 ctx: &mut ScriptContext<'_, API>,
4447 name: &str,
4448 color: &str,
4449) {
4450 let Some(color) = Color::from_hex(color) else {

Callers 1

apply_viewport_canvasFunction · 0.85

Calls 1

find_namedFunction · 0.85

Tested by

no test coverage detected