(
ctx: &mut ScriptContext<'_, API>,
view: &EditorView,
)
| 4544 | ) { |
| 4545 | if let Some(id) = find_named(ctx, name) { |
| 4546 | let _ = with_base_node_mut!(ctx.run, UiNode, id, |node| { |
| 4547 | node.layout.padding = padding; |
| 4548 | }); |
| 4549 | } |
| 4550 | } |
| 4551 | |
| 4552 | pub fn set_ui_node_h_align<API: ScriptAPI + ?Sized>( |
| 4553 | ctx: &mut ScriptContext<'_, API>, |
| 4554 | name: &str, |
| 4555 | align: UiHorizontalAlign, |
| 4556 | ) { |
| 4557 | if let Some(id) = find_named(ctx, name) { |
| 4558 | let _ = with_base_node_mut!(ctx.run, UiNode, id, |node| { |
| 4559 | node.layout.h_align = align; |
| 4560 | }); |
| 4561 | } |
| 4562 | } |
| 4563 | |
| 4564 | pub fn set_ui_node_z_index<API: ScriptAPI + ?Sized>( |
| 4565 | ctx: &mut ScriptContext<'_, API>, |
| 4566 | name: &str, |
| 4567 | z_index: i32, |
| 4568 | ) { |
| 4569 | if let Some(id) = find_named(ctx, name) { |
| 4570 | let _ = with_base_node_mut!(ctx.run, UiNode, id, |node| { |
| 4571 | node.layout.z_index = z_index; |
| 4572 | }); |
| 4573 | } |
| 4574 | } |
| 4575 | |
| 4576 | pub fn set_hlayout_spacing<API: ScriptAPI + ?Sized>( |
| 4577 | ctx: &mut ScriptContext<'_, API>, |
| 4578 | name: &str, |
| 4579 | spacing: f32, |
| 4580 | ) { |
| 4581 | if let Some(id) = find_named(ctx, name) { |
| 4582 | let _ = with_node_mut!(ctx.run, UiHLayout, id, |node| { |
| 4583 | node.inner.spacing = spacing; |
| 4584 | }); |
| 4585 | } |
| 4586 | } |
| 4587 | |
| 4588 | pub fn set_button_row_style<API: ScriptAPI + ?Sized>( |
| 4589 | ctx: &mut ScriptContext<'_, API>, |
| 4590 | name: &str, |
| 4591 | hover: &str, |
| 4592 | pressed: &str, |
| 4593 | ) { |
| 4594 | let Some(hover_color) = Color::from_hex(hover) else { |
| 4595 | return; |
| 4596 | }; |
| 4597 | let Some(pressed_color) = Color::from_hex(pressed) else { |
| 4598 | return; |
| 4599 | }; |
| 4600 | if let Some(id) = find_named(ctx, name) { |
| 4601 | let _ = with_node_mut!(ctx.run, UiButton, id, |node| { |
| 4602 | node.style.fill = hover_color; |
| 4603 | node.style.stroke = hover_color; |
no test coverage detected