(
ctx: &mut ScriptContext<'_, API>,
pointer: ViewportPointer,
)
| 2516 | node.layout.anchor = UiAnchor::Center; |
| 2517 | node.layout.size = UiVector2::ratio(canvas_size.0, canvas_size.1); |
| 2518 | node.transform.position = UiVector2::percent(50.0, 50.0); |
| 2519 | node.transform.pivot = UiVector2::percent(50.0, 50.0); |
| 2520 | node.transform.translation = Vector2::ZERO; |
| 2521 | node.transform.self_translation = Vector2::ZERO; |
| 2522 | node.transform.scale = Vector2::ONE; |
| 2523 | node.input_enabled = false; |
| 2524 | }); |
| 2525 | } |
| 2526 | true |
| 2527 | } |
| 2528 | |
| 2529 | pub fn preview_doc_order(doc: &SceneDoc) -> Vec<u32> { |
| 2530 | let mut out = Vec::new(); |
| 2531 | if let Some(root) = doc.scene.root { |
| 2532 | push_doc_order(doc, root.as_u32(), &mut out); |
| 2533 | } |
| 2534 | for node in doc.scene.nodes.iter() { |
| 2535 | let key = node.key.as_u32(); |
| 2536 | if !out.contains(&key) { |
| 2537 | push_doc_order(doc, key, &mut out); |
| 2538 | } |
| 2539 | } |
| 2540 | out |
| 2541 | } |
| 2542 | |
| 2543 | pub fn push_doc_order(doc: &SceneDoc, key: u32, out: &mut Vec<u32>) { |
| 2544 | if out.contains(&key) { |
| 2545 | return; |
| 2546 | } |
no test coverage detected