-
-
Notifications
You must be signed in to change notification settings - Fork 272
Add Modal popup and UI shadow system to Editor UI #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -197,6 +197,54 @@ namespace ImGuiSp | |
| ImColor(0, 0, 0, 0) // border | ||
| ); | ||
| } | ||
|
|
||
| //= Rectangle ============================================================================= | ||
|
|
||
| inline ImRect get_item_rect() | ||
| { | ||
| return { | ||
| ImGui::GetItemRectMin(), | ||
| ImGui::GetItemRectMax() | ||
| }; | ||
| } | ||
|
|
||
| inline ImRect rectangle_expanded(const ImRect& rect, float x, float y) | ||
| { | ||
| ImRect result = rect; | ||
| result.Min.x -= x; | ||
| result.Min.y -= y; | ||
| result.Max.x += x; | ||
| result.Max.y += y; | ||
| return result; | ||
| } | ||
|
|
||
| inline ImRect rectangle_offset(const ImRect& rect, float x, float y) | ||
| { | ||
| ImRect result = rect; | ||
| result.Min.x += x; | ||
| result.Min.y += y; | ||
| result.Max.x += x; | ||
| result.Max.y += y; | ||
| return result; | ||
| } | ||
|
|
||
| inline ImRect rectangle_offset(const ImRect& rect, ImVec2 xy) | ||
| { | ||
| return rectangle_offset(rect, xy.x, xy.y); | ||
| } | ||
|
Comment on lines
+203
to
+234
|
||
|
|
||
| static bool hyper_link(const char* label, ImU32 lineColor = IM_COL32(186, 66, 30, 255), float lineThickness = GImGui->Style.FrameBorderSize) | ||
|
||
| { | ||
| ImGui::Text(label); | ||
| const ImRect rect = rectangle_expanded(get_item_rect(), lineThickness, lineThickness); | ||
| if (ImGui::IsItemHovered()) | ||
| { | ||
| ImGui::GetWindowDrawList()->AddLine({rect.Min.x, rect.Max.y}, rect.Max, lineColor, lineThickness); | ||
| ImGui::SetMouseCursor(ImGuiMouseCursor_Hand); | ||
| return ImGui::IsMouseReleased(ImGuiMouseButton_Left); | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| struct DragDropPayload | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "This draws to the background draw list so shadows appear behind windows", but the FlushPendingShadows implementation in Shadows.cpp line 44 actually uses the foreground draw list (ImGui::GetForegroundDrawList()). This comment is incorrect and should be updated to match the actual behavior.