Skip to content
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

Build fixes #197

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make context menu disappear after mouse leaves rect
ZeppelinGames committed Dec 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 7290146bd20d3dd200e6c2a56d22738d60dede78
19 changes: 18 additions & 1 deletion Prowl.Editor/Editor/ProjectsWindow.cs
Original file line number Diff line number Diff line change
@@ -252,7 +252,7 @@ void OpenSelectedProject()
// Text pos + offset/padding
Vector2 openInfoTextPos = footer.Position + new Vector2(8f, 8f);
gui.Draw2D.DrawText($"Opening '{SelectedProject.Name}'...", openInfoTextPos);

// Add more information about progress here (even console output)

// Cover controls (fill EditorWindow)
@@ -393,6 +393,7 @@ private void DrawCreateProject()
}

Project contextMenuProject = null;
bool contextMenuIsHovered = false;
private void DisplayProject(Project project)
{
Rect rootRect = gui.CurrentNode.LayoutData.Rect;
@@ -465,6 +466,7 @@ private void DisplayProject(Project project)
{
gui.Draw2D.DrawRectFilled(rect, EditorStylePrefs.Instance.Highlighted, (float)EditorStylePrefs.Instance.WindowRoundness, CornerRounding.All);
contextMenuProject = project;
contextMenuIsHovered = false;
gui.OpenPopup("ProjectOptionsContextMenu", null, gui.CurrentNode.Parent);
}
else if (optionsInteract.IsHovered())
@@ -490,8 +492,21 @@ private void DrawProjectContextMenu(Project project)
{
using (popupHolder.Width(180).Padding(5).Layout(LayoutType.Column).Spacing(5).FitContentHeight().Enter())
{
// Getting Interactable (IsHovered) removes interaction from styled buttons?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit odd, IsHovered and Interactables are just rectangles, this should work just fine with IsHovered?
Could you elaborate on what happened here? Did interaction just completely fail?

Other then this (which isn't really a problem preventing merging) everything looks good!

if (popupHolder.LayoutData.Rect.Contains(gui.PointerPos))
{
if (!contextMenuIsHovered)
contextMenuIsHovered = true;
}
else
{
if (contextMenuIsHovered)
closePopup = true;
}

// Add options
// - Delete project (with popup confirmation)

if (EditorGUI.StyledButton("Show In Explorer"))
{
AssetDatabase.OpenPath(project.ProjectDirectory, type: FileOpenType.FileExplorer);
@@ -502,6 +517,8 @@ private void DrawProjectContextMenu(Project project)
ProjectCache.Instance.RemoveProject(project);
closePopup = true;
}


}
}
if (closePopup)