mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 04:55:13 +00:00
GUI: populate portPos even when invisible
This commit is contained in:
parent
5a48c85c14
commit
9f0d8dba20
1 changed files with 89 additions and 82 deletions
|
@ -92,9 +92,12 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs
|
|||
);
|
||||
|
||||
ImGui::ItemSize(size,style.FramePadding.y);
|
||||
if (ImGui::ItemAdd(rect,ImGui::GetID(portID.c_str()))) {
|
||||
bool hovered=ImGui::ItemHoverable(rect,ImGui::GetID(portID.c_str()));
|
||||
bool active=(hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left));
|
||||
bool visible=ImGui::ItemAdd(rect,ImGui::GetID(portID.c_str()));
|
||||
bool hovered=false;
|
||||
bool active=false;
|
||||
if (visible) {
|
||||
hovered=ImGui::ItemHoverable(rect,ImGui::GetID(portID.c_str()));
|
||||
active=(hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left));
|
||||
|
||||
|
||||
if (hovered) hoveredPortSet=portSetID;
|
||||
|
@ -104,6 +107,7 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs
|
|||
dl->AddRectFilled(minArea,maxArea,ImGui::GetColorU32(portSetColor),0.0f);
|
||||
dl->AddRect(minArea,maxArea,ImGui::GetColorU32(portSetBorderColor),0.0f,dpiScale);
|
||||
dl->AddText(ImGui::GetFont(),ImGui::GetFontSize(),textPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),label.c_str(),NULL,ImGui::GetWindowSize().x*0.6f);
|
||||
}
|
||||
|
||||
// input ports
|
||||
for (int i=0; i<ins; i++) {
|
||||
|
@ -131,6 +135,7 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs
|
|||
|
||||
portPos[(portSetID<<4)|i]=ImLerp(portMin,portMax,ImVec2(0.0f,0.5f));
|
||||
|
||||
if (visible) {
|
||||
if (ImGui::ItemAdd(portRect,ImGui::GetID(subPortID.c_str()))) {
|
||||
dl->AddRectFilled(portMin,portMax,ImGui::GetColorU32(portColor),0.0f);
|
||||
dl->AddRect(portMin,portMax,ImGui::GetColorU32(portBorderColor),0.0f,dpiScale);
|
||||
|
@ -142,6 +147,7 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs
|
|||
if (active) clickedPort=i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// output ports
|
||||
for (int i=0; i<outs; i++) {
|
||||
|
@ -169,6 +175,7 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs
|
|||
|
||||
portPos[(portSetID<<4)|i]=ImLerp(portMin,portMax,ImVec2(1.0f,0.5f));
|
||||
|
||||
if (visible) {
|
||||
if (ImGui::ItemAdd(portRect,ImGui::GetID(subPortID.c_str()))) {
|
||||
dl->AddRectFilled(portMin,portMax,ImGui::GetColorU32(portColor),0.0f);
|
||||
dl->AddRect(portMin,portMax,ImGui::GetColorU32(portBorderColor),0.0f,dpiScale);
|
||||
|
@ -180,10 +187,10 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs
|
|||
hoveredSubPort=i;
|
||||
}
|
||||
}
|
||||
|
||||
if (hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left)) return true;
|
||||
}
|
||||
|
||||
if (visible && hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -283,7 +290,7 @@ void FurnaceGUI::drawMixer() {
|
|||
ImVec2 topPos=ImGui::GetCursorPos();
|
||||
ImVec2 sysSize=calcPortSetSize("System",displayHiddenPorts?DIV_MAX_OUTPUTS:e->getAudioDescGot().outChans,0);
|
||||
topPos.x+=ImGui::GetContentRegionAvail().x-sysSize.x;
|
||||
topPos.y+=(ImGui::GetContentRegionAvail().y-sysSize.y)*0.5+ImGui::GetScrollY();
|
||||
if (ImGui::GetContentRegionAvail().y>sysSize.y) topPos.y+=(ImGui::GetContentRegionAvail().y-sysSize.y)*0.5+ImGui::GetScrollY();
|
||||
|
||||
if (ImGui::IsWindowHovered() && ImGui::IsMouseClicked(ImGuiMouseButton_Left)) selectedPortSet=0x1fff;
|
||||
|
||||
|
|
Loading…
Reference in a new issue