| 1719 | } |
| 1720 | |
| 1721 | static void MiniMapDrawNode(ImNodesEditorContext& editor, const int node_idx) |
| 1722 | { |
| 1723 | const ImNodeData& node = editor.Nodes.Pool[node_idx]; |
| 1724 | |
| 1725 | const ImRect node_rect = ScreenSpaceToMiniMapSpace(editor, node.Rect); |
| 1726 | |
| 1727 | // Round to near whole pixel value for corner-rounding to prevent visual glitches |
| 1728 | const float mini_map_node_rounding = |
| 1729 | floorf(node.LayoutStyle.CornerRounding * editor.MiniMapScaling); |
| 1730 | |
| 1731 | ImU32 mini_map_node_background; |
| 1732 | |
| 1733 | if (editor.ClickInteraction.Type == ImNodesClickInteractionType_None && |
| 1734 | ImGui::IsMouseHoveringRect(node_rect.Min, node_rect.Max)) |
| 1735 | { |
| 1736 | mini_map_node_background = GImNodes->Style.Colors[ImNodesCol_MiniMapNodeBackgroundHovered]; |
| 1737 | |
| 1738 | // Run user callback when hovering a mini-map node |
| 1739 | if (editor.MiniMapNodeHoveringCallback) |
| 1740 | { |
| 1741 | editor.MiniMapNodeHoveringCallback(node.Id, editor.MiniMapNodeHoveringCallbackUserData); |
| 1742 | } |
| 1743 | } |
| 1744 | else if (editor.SelectedNodeIndices.contains(node_idx)) |
| 1745 | { |
| 1746 | mini_map_node_background = GImNodes->Style.Colors[ImNodesCol_MiniMapNodeBackgroundSelected]; |
| 1747 | } |
| 1748 | else |
| 1749 | { |
| 1750 | mini_map_node_background = GImNodes->Style.Colors[ImNodesCol_MiniMapNodeBackground]; |
| 1751 | } |
| 1752 | |
| 1753 | const ImU32 mini_map_node_outline = GImNodes->Style.Colors[ImNodesCol_MiniMapNodeOutline]; |
| 1754 | |
| 1755 | GImNodes->CanvasDrawList->AddRectFilled( |
| 1756 | node_rect.Min, node_rect.Max, mini_map_node_background, mini_map_node_rounding); |
| 1757 | |
| 1758 | GImNodes->CanvasDrawList->AddRect( |
| 1759 | node_rect.Min, node_rect.Max, mini_map_node_outline, mini_map_node_rounding); |
| 1760 | } |
| 1761 | |
| 1762 | static void MiniMapDrawLink(ImNodesEditorContext& editor, const int link_idx) |
| 1763 | { |
no test coverage detected