mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-24 05:25:12 +00:00
GUI: even more improvements to macro editor
This commit is contained in:
parent
0e03bf6bec
commit
76adccc0fc
1 changed files with 23 additions and 13 deletions
|
@ -1192,9 +1192,10 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
processDrags(ImGui::GetMousePos().x,ImGui::GetMousePos().y);
|
||||
}
|
||||
if (i.macro->open) {
|
||||
if (ImGui::IsItemHovered() && ctrlWheeling) {
|
||||
if (ImGui::IsItemHovered()) {
|
||||
if (ctrlWheeling) {
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift)) {
|
||||
i.macro->vZoom+=wheelY;
|
||||
i.macro->vZoom+=wheelY*(1+(i.macro->vZoom>>4));
|
||||
if (i.macro->vZoom<1) i.macro->vZoom=1;
|
||||
if (i.macro->vZoom>(i.max-i.min)) i.macro->vZoom=i.max-i.min;
|
||||
if ((i.macro->vScroll+i.macro->vZoom)>(i.max-i.min)) {
|
||||
|
@ -1205,6 +1206,11 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
if (macroPointSize<1) macroPointSize=1;
|
||||
if (macroPointSize>256) macroPointSize=256;
|
||||
}
|
||||
} else if ((ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift)) && wheelY!=0) {
|
||||
i.macro->vScroll+=wheelY*(1+(i.macro->vZoom>>4));
|
||||
if (i.macro->vScroll<0) i.macro->vScroll=0;
|
||||
if (i.macro->vScroll>((i.max-i.min)-i.macro->vZoom)) i.macro->vScroll=(i.max-i.min)-i.macro->vZoom;
|
||||
}
|
||||
}
|
||||
|
||||
// slider
|
||||
|
@ -1214,12 +1220,16 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
|||
ImS64 contentsV=(i.max-i.min);
|
||||
|
||||
ImGui::SameLine(0.0f);
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX()-ImGui::GetStyle().ItemSpacing.x);
|
||||
ImRect scrollbarPos=ImRect(ImGui::GetCursorScreenPos(),ImGui::GetCursorScreenPos());
|
||||
scrollbarPos.Min.x-=ImGui::GetStyle().ItemSpacing.x;
|
||||
scrollbarPos.Max.x+=ImGui::GetStyle().ScrollbarSize;
|
||||
scrollbarPos.Max.x-=ImGui::GetStyle().ItemSpacing.x;
|
||||
scrollbarPos.Max.y+=i.height*dpiScale;
|
||||
ImGui::Dummy(ImVec2(ImGui::GetStyle().ScrollbarSize,i.height*dpiScale));
|
||||
if (ImGui::IsItemHovered() && ctrlWheeling) {
|
||||
i.macro->vScroll+=wheelY*(1+(i.macro->vZoom>>4));
|
||||
if (i.macro->vScroll<0) i.macro->vScroll=0;
|
||||
if (i.macro->vScroll>((i.max-i.min)-i.macro->vZoom)) i.macro->vScroll=(i.max-i.min)-i.macro->vZoom;
|
||||
}
|
||||
|
||||
if (ImGui::ScrollbarEx(scrollbarPos,ImGui::GetID("IMacroVScroll"),ImGuiAxis_Y,&scrollV,availV,contentsV,0)) {
|
||||
i.macro->vScroll=(i.max-i.min-i.macro->vZoom)-scrollV;
|
||||
|
|
Loading…
Reference in a new issue