Added key response, now you can use Ctrl+A to select all nodes. Ctrl+X currently only deletes the selected part, and may support clipboard in the future. && Added a delete selected content function in the right-click menu.
This commit is contained in:
parent
7aa8c6750d
commit
a23f562906
@ -10,6 +10,11 @@ extern "C"
|
||||
// 绘制节点编辑器
|
||||
void Workflow_Editor::Show(void)
|
||||
{
|
||||
// 选区信息
|
||||
bool bounding_box_delete_flag = false;
|
||||
int bounding_box_link_nums = ImNodes::NumSelectedLinks();
|
||||
int bounding_box_node_nums = ImNodes::NumSelectedNodes();
|
||||
|
||||
// 浅色主题节点编辑器窗体
|
||||
ImNodes::StyleColorsLight();
|
||||
ImNodes::BeginNodeEditor();
|
||||
@ -56,6 +61,10 @@ void Workflow_Editor::Show(void)
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
// 删除框选内容
|
||||
if (ImGui::MenuItem(u8"删除所选内容", nullptr, nullptr, (bounding_box_link_nums > 0) || (bounding_box_node_nums > 0)))
|
||||
bounding_box_delete_flag = true;
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
@ -79,8 +88,30 @@ void Workflow_Editor::Show(void)
|
||||
|
||||
// 处理键盘事件
|
||||
{
|
||||
// Delete 按键释放
|
||||
if (ImGui::IsKeyReleased(ImGuiKey_Delete))
|
||||
// Ctrl + A 全选
|
||||
if (ImGui::IsKeyChordPressed(ImGuiMod_Ctrl | ImGuiKey_A) == true)
|
||||
{
|
||||
for (auto Link : this->Edge_Pool)
|
||||
if (ImNodes::IsLinkSelected(Link.id) == false)
|
||||
ImNodes::SelectLink(Link.id);
|
||||
for (auto pNode : this->Node_Pool)
|
||||
if (ImNodes::IsNodeSelected(pNode->Get_ID()) == false)
|
||||
ImNodes::SelectNode(pNode->Get_ID());
|
||||
}
|
||||
|
||||
// Ctrl + X 剪切
|
||||
if (ImGui::IsKeyChordPressed(ImGuiMod_Ctrl | ImGuiKey_X) == true)
|
||||
{
|
||||
bounding_box_delete_flag = true;
|
||||
|
||||
/**
|
||||
* @todo
|
||||
* 剪切板实现
|
||||
*/
|
||||
}
|
||||
|
||||
// Delete 按键释放 或有删除请求
|
||||
if (ImGui::IsKeyReleased(ImGuiKey_Delete) || bounding_box_delete_flag)
|
||||
{
|
||||
// 释放所有选中的边
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user