| 2517 | } |
| 2518 | |
| 2519 | void Link(const int id, const int start_attr_id, const int end_attr_id) |
| 2520 | { |
| 2521 | assert(GImNodes->CurrentScope == ImNodesScope_Editor); |
| 2522 | |
| 2523 | ImNodesEditorContext& editor = EditorContextGet(); |
| 2524 | ImLinkData& link = ObjectPoolFindOrCreateObject(editor.Links, id); |
| 2525 | link.Id = id; |
| 2526 | link.StartPinIdx = ObjectPoolFindOrCreateIndex(editor.Pins, start_attr_id); |
| 2527 | link.EndPinIdx = ObjectPoolFindOrCreateIndex(editor.Pins, end_attr_id); |
| 2528 | link.ColorStyle.Base = GImNodes->Style.Colors[ImNodesCol_Link]; |
| 2529 | link.ColorStyle.Hovered = GImNodes->Style.Colors[ImNodesCol_LinkHovered]; |
| 2530 | link.ColorStyle.Selected = GImNodes->Style.Colors[ImNodesCol_LinkSelected]; |
| 2531 | |
| 2532 | // Check if this link was created by the current link event |
| 2533 | if ((editor.ClickInteraction.Type == ImNodesClickInteractionType_LinkCreation && |
| 2534 | editor.Pins.Pool[link.EndPinIdx].Flags & ImNodesAttributeFlags_EnableLinkCreationOnSnap && |
| 2535 | editor.ClickInteraction.LinkCreation.StartPinIdx == link.StartPinIdx && |
| 2536 | editor.ClickInteraction.LinkCreation.EndPinIdx == link.EndPinIdx) || |
| 2537 | (editor.ClickInteraction.LinkCreation.StartPinIdx == link.EndPinIdx && |
| 2538 | editor.ClickInteraction.LinkCreation.EndPinIdx == link.StartPinIdx)) |
| 2539 | { |
| 2540 | GImNodes->SnapLinkIdx = ObjectPoolFindOrCreateIndex(editor.Links, id); |
| 2541 | } |
| 2542 | } |
| 2543 | |
| 2544 | void PushColorStyle(const ImNodesCol item, unsigned int color) |
| 2545 | { |
nothing calls this directly
no test coverage detected