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

Function pick_resize_handle

perro_editor/res/scripts/scene/editor_viewport.rs:2499–2516  ·  view source on GitHub ↗
(
    ctx: &mut ScriptContext<'_, API>,
    pointer: ViewportPointer,
)

Source from the content-addressed store, hash-verified

2497 ctx: &mut ScriptContext<'_, API>,
2498 root: NodeID,
2499) -> bool {
2500 let Some(panel) = find_named(ctx, "viewport_panel") else {
2501 return false;
2502 };
2503 if ctx
2504 .run
2505 .Nodes()
2506 .with_base_node::<UiNode, _, _>(root, |_| ())
2507 .is_some()
2508 {
2509 let _ = ctx.run.Nodes().reparent(panel, root);
2510 let canvas_size = ui_canvas_size_ratio(
2511 viewport_window_aspect(ctx),
2512 1.0,
2513 with_state!(ctx.run, EditorState, ctx.id, editor_layout).unwrap_or_default(),
2514 );
2515 let _ = with_base_node_mut!(ctx.run, UiNode, root, |node| {
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);

Callers 2

update_preview_pickFunction · 0.85
editor_cursor_iconFunction · 0.85

Calls 5

cached_scene_doc_sharedFunction · 0.85
doc_ui_rectFunction · 0.85
resize_handlesFunction · 0.85
findMethod · 0.80
absMethod · 0.45

Tested by

no test coverage detected