diff --git a/apps/shaders_lab/shaders_lab.exe b/apps/shaders_lab/shaders_lab.exe index 76b9edb7..b25c79dd 100755 Binary files a/apps/shaders_lab/shaders_lab.exe and b/apps/shaders_lab/shaders_lab.exe differ diff --git a/cpp/functions/gfx/dag_node_editor.cpp b/cpp/functions/gfx/dag_node_editor.cpp index 3224b2ce..a90eb33d 100644 --- a/cpp/functions/gfx/dag_node_editor.cpp +++ b/cpp/functions/gfx/dag_node_editor.cpp @@ -75,15 +75,22 @@ static constexpr float PIN_DIAMETER = PIN_RADIUS * 2.0f; static const ImVec4 PIN_COLOR = ImVec4(0.78f, 0.78f, 0.82f, 1.0f); static const ImVec4 PIN_BORDER = ImVec4(0.20f, 0.20f, 0.22f, 1.0f); -// Draws a filled circle and reserves a (PIN_DIAMETER × PIN_DIAMETER) item. -// All pins use the same neutral color since the data type is uniform (vec4). -static void draw_pin_circle() { +enum class PinSide { Input, Output }; + +// Draws a filled circle straddling the node's edge (half outside, half inside) +// and reserves only the inside half (PIN_RADIUS × PIN_DIAMETER) so the layout +// stays compact. The full circle is set as the pin's hit rect via ed::PinRect +// so the user can grab the protruding half. +static void draw_pin_circle(PinSide side) { ImVec2 cursor = ImGui::GetCursorScreenPos(); - ImVec2 center = ImVec2(cursor.x + PIN_RADIUS, cursor.y + PIN_RADIUS); + float center_x = (side == PinSide::Input) ? cursor.x : cursor.x + PIN_RADIUS; + ImVec2 center(center_x, cursor.y + PIN_RADIUS); + ed::PinRect(ImVec2(center.x - PIN_RADIUS, center.y - PIN_RADIUS), + ImVec2(center.x + PIN_RADIUS, center.y + PIN_RADIUS)); ImDrawList* dl = ImGui::GetWindowDrawList(); dl->AddCircleFilled(center, PIN_RADIUS, ImGui::ColorConvertFloat4ToU32(PIN_COLOR)); dl->AddCircle(center, PIN_RADIUS, ImGui::ColorConvertFloat4ToU32(PIN_BORDER), 0, 1.5f); - ImGui::Dummy(ImVec2(PIN_DIAMETER, PIN_DIAMETER)); + ImGui::Dummy(ImVec2(PIN_RADIUS, PIN_DIAMETER)); } // Topological sort using Kahn's algorithm. @@ -252,13 +259,13 @@ bool dag_node_editor(std::vector& pipeline) { // ── Three-column layout: inputs · controls · output ────────── ImGui::BeginGroup(); // inputs column (left edge) if (ni == 0) { - ImGui::Dummy(ImVec2(PIN_DIAMETER, PIN_DIAMETER)); + ImGui::Dummy(ImVec2(PIN_RADIUS, PIN_DIAMETER)); } for (int k = 0; k < ni; ++k) { ed::BeginPin(ed::PinId(input_pin_id(step.editor_uid, k)), ed::PinKind::Input); ed::PinPivotAlignment(ImVec2(0.0f, 0.5f)); ed::PinPivotSize(ImVec2(0, 0)); - draw_pin_circle(); + draw_pin_circle(PinSide::Input); ed::EndPin(); } ImGui::EndGroup(); @@ -307,10 +314,10 @@ bool dag_node_editor(std::vector& pipeline) { ed::BeginPin(ed::PinId(output_pin_id(step.editor_uid)), ed::PinKind::Output); ed::PinPivotAlignment(ImVec2(1.0f, 0.5f)); ed::PinPivotSize(ImVec2(0, 0)); - draw_pin_circle(); + draw_pin_circle(PinSide::Output); ed::EndPin(); } else { - ImGui::Dummy(ImVec2(PIN_DIAMETER, PIN_DIAMETER)); + ImGui::Dummy(ImVec2(PIN_RADIUS, PIN_DIAMETER)); } ImGui::EndGroup();