feat(addresses): improve address labeling and view-only handling
- Add expanded address icon picker with search, bottom-aligned actions, and improved modal sizing - Embed a pickaxe icon font subset and wire it into typography/address icon rendering - Track view-only shielded addresses and prevent sends from non-spendable z-addresses - Improve address transfer dialog sizing, max amount handling, and text clipping - Tune main header layout values in ui.toml - Update README, codebase overview, and third-party license documentation
This commit is contained in:
@@ -90,10 +90,40 @@ inline void DrawTextShadow(ImDrawList* dl, const ImVec2& pos, ImU32 col,
|
||||
// and will return true even when a modal popup covers the rect, which
|
||||
// causes background elements to show hover highlights through dialogs.
|
||||
|
||||
inline int& OverlayDialogActiveFrame()
|
||||
{
|
||||
static int s_frame = -1;
|
||||
return s_frame;
|
||||
}
|
||||
|
||||
inline void MarkOverlayDialogActive()
|
||||
{
|
||||
OverlayDialogActiveFrame() = ImGui::GetFrameCount();
|
||||
}
|
||||
|
||||
inline bool IsCurrentWindowOverlayDialog()
|
||||
{
|
||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||
for (ImGuiWindow* node = window; node; node = node->ParentWindow) {
|
||||
if (node->Name && strcmp(node->Name, "##OverlayScrim") == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool IsOverlayDialogBlockingInput()
|
||||
{
|
||||
int activeFrame = OverlayDialogActiveFrame();
|
||||
int currentFrame = ImGui::GetFrameCount();
|
||||
return activeFrame == currentFrame || activeFrame == (currentFrame - 1);
|
||||
}
|
||||
|
||||
inline bool IsRectHovered(const ImVec2& r_min, const ImVec2& r_max, bool clip = true)
|
||||
{
|
||||
if (!ImGui::IsMouseHoveringRect(r_min, r_max, clip))
|
||||
return false;
|
||||
if (IsOverlayDialogBlockingInput() && !IsCurrentWindowOverlayDialog())
|
||||
return false;
|
||||
// If a modal popup is open and it is not the current window, treat
|
||||
// the content as non-hoverable (same logic ImGui uses internally
|
||||
// inside IsWindowContentHoverable for modal blocking).
|
||||
@@ -885,8 +915,11 @@ inline bool DrawDialogTitleBar(const char* title, bool* p_open, ImU32 accent_col
|
||||
// Creates a fullscreen semi-transparent overlay with a centered card dialog.
|
||||
// Similar to the shutdown screen pattern but for interactive dialogs.
|
||||
|
||||
inline bool BeginOverlayDialog(const char* title, bool* p_open, float cardWidth = 460.0f, float scrimOpacity = 0.92f)
|
||||
inline bool BeginOverlayDialog(const char* title, bool* p_open, float cardWidth = 460.0f, float scrimOpacity = 0.92f,
|
||||
float cardBottomViewportRatio = 0.85f)
|
||||
{
|
||||
MarkOverlayDialogActive();
|
||||
|
||||
ImGuiViewport* vp = ImGui::GetMainViewport();
|
||||
ImVec2 vp_pos = vp->Pos;
|
||||
ImVec2 vp_size = vp->Size;
|
||||
@@ -914,6 +947,14 @@ inline bool BeginOverlayDialog(const char* title, bool* p_open, float cardWidth
|
||||
}
|
||||
|
||||
ImDrawList* dl = ImGui::GetWindowDrawList();
|
||||
|
||||
// Consume pointer input on the scrim so the overlay owns clicks and wheel
|
||||
// events even when the click lands outside the card content.
|
||||
ImGui::SetCursorScreenPos(vp_pos);
|
||||
ImGui::InvisibleButton("##OverlayInputBlocker", vp_size,
|
||||
ImGuiButtonFlags_MouseButtonLeft |
|
||||
ImGuiButtonFlags_MouseButtonRight |
|
||||
ImGuiButtonFlags_MouseButtonMiddle);
|
||||
|
||||
// Calculate card position (centered)
|
||||
float cardX = vp_pos.x + (vp_size.x - cardWidth) * 0.5f;
|
||||
@@ -921,7 +962,7 @@ inline bool BeginOverlayDialog(const char* title, bool* p_open, float cardWidth
|
||||
|
||||
// Draw glass card background
|
||||
ImVec2 cardMin(cardX, cardY);
|
||||
ImVec2 cardMax(cardX + cardWidth, vp_pos.y + vp_size.y * 0.85f);
|
||||
ImVec2 cardMax(cardX + cardWidth, vp_pos.y + vp_size.y * cardBottomViewportRatio);
|
||||
|
||||
// Card background with glass effect
|
||||
GlassPanelSpec cardGlass;
|
||||
@@ -930,6 +971,11 @@ inline bool BeginOverlayDialog(const char* title, bool* p_open, float cardWidth
|
||||
cardGlass.borderAlpha = 50;
|
||||
cardGlass.borderWidth = 1.0f;
|
||||
DrawGlassPanel(dl, cardMin, cardMax, cardGlass);
|
||||
|
||||
if (p_open && ImGui::IsMouseClicked(ImGuiMouseButton_Left) &&
|
||||
!ImGui::IsMouseHoveringRect(cardMin, cardMax, false)) {
|
||||
*p_open = false;
|
||||
}
|
||||
|
||||
// Set up child region for card content
|
||||
ImGui::SetCursorScreenPos(ImVec2(cardX, cardY));
|
||||
|
||||
Reference in New Issue
Block a user