feat: add editor project switching workflow
This commit is contained in:
@@ -86,6 +86,30 @@ inline void DrawComboPreviewFrame(
|
||||
textColor);
|
||||
}
|
||||
|
||||
inline void DrawControlFrameChrome(
|
||||
ImDrawList* drawList,
|
||||
const ImVec2& min,
|
||||
const ImVec2& max,
|
||||
bool hovered,
|
||||
bool active = false) {
|
||||
if (!drawList) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ImGuiStyle& style = ImGui::GetStyle();
|
||||
const ImU32 frameColor = ImGui::GetColorU32(
|
||||
active ? ImGuiCol_FrameBgActive : (hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg));
|
||||
const ImU32 borderColor = ImGui::GetColorU32(ImGuiCol_Border);
|
||||
drawList->AddRectFilled(min, max, frameColor, style.FrameRounding);
|
||||
drawList->AddRect(
|
||||
ImVec2(min.x + 0.5f, min.y + 0.5f),
|
||||
ImVec2(max.x - 0.5f, max.y - 0.5f),
|
||||
borderColor,
|
||||
style.FrameRounding,
|
||||
0,
|
||||
style.FrameBorderSize);
|
||||
}
|
||||
|
||||
inline bool DrawFloat(
|
||||
const char* label,
|
||||
float& value,
|
||||
@@ -113,7 +137,8 @@ inline bool DrawLinearSlider(
|
||||
const bool active = ImGui::IsItemActive();
|
||||
const ImVec2 min = ImGui::GetItemRectMin();
|
||||
const ImVec2 max = ImGui::GetItemRectMax();
|
||||
const float trackPadding = LinearSliderHorizontalPadding();
|
||||
const ImGuiStyle& style = ImGui::GetStyle();
|
||||
const float trackPadding = (std::max)(LinearSliderHorizontalPadding(), style.FramePadding.x);
|
||||
const float trackMinX = min.x + trackPadding;
|
||||
const float trackMaxX = max.x - trackPadding;
|
||||
const float centerY = (min.y + max.y) * 0.5f;
|
||||
@@ -121,6 +146,7 @@ inline bool DrawLinearSlider(
|
||||
const float trackHalfThickness = LinearSliderTrackThickness() * 0.5f;
|
||||
|
||||
ImDrawList* drawList = ImGui::GetWindowDrawList();
|
||||
DrawControlFrameChrome(drawList, min, max, hovered, active);
|
||||
drawList->AddRectFilled(
|
||||
ImVec2(trackMinX, centerY - trackHalfThickness),
|
||||
ImVec2(trackMaxX, centerY + trackHalfThickness),
|
||||
|
||||
Reference in New Issue
Block a user