|
|
@ -119,7 +119,7 @@ public: |
|
|
|
|
|
|
|
Rect viewportRect = Rect(scrolling, canvas_size); |
|
|
|
|
|
|
|
for (const auto &node : nodeList) { |
|
|
|
for (auto &node : nodeList) { |
|
|
|
bool visible = viewportRect.intersects(node.bbox); |
|
|
|
if (visible) { |
|
|
|
// TODO: this is garbage |
|
|
@ -128,6 +128,13 @@ public: |
|
|
|
// -- Draw the node boxes |
|
|
|
draw_list->ChannelsSetCurrent(0); // Switch to the background layer |
|
|
|
|
|
|
|
// draw an invisible button in the background, for dragging/hovering |
|
|
|
ImGui::SetCursorScreenPos(offset + node.bbox.pos); |
|
|
|
ImGui::InvisibleButton("node", node.bbox.size); |
|
|
|
|
|
|
|
if (ImGui::IsItemActive() && ImGui::IsMouseDragging(0)) |
|
|
|
node.bbox.pos += ImGui::GetIO().MouseDelta; |
|
|
|
|
|
|
|
ImVec2 upper_left = offset + node.bbox.pos; |
|
|
|
ImVec2 lower_right = upper_left + node.bbox.size; |
|
|
|
|
|
|
|