diff --git a/src/graphicswin.cpp b/src/graphicswin.cpp index 414c6ec4..b1d9f85b 100644 --- a/src/graphicswin.cpp +++ b/src/graphicswin.cpp @@ -390,6 +390,7 @@ void GraphicsWindow::Init() { showSnapGrid = false; context.active = false; + toolbarHovered = Command::NONE; if(!window) { window = Platform::CreateWindow(); diff --git a/src/toolbar.cpp b/src/toolbar.cpp index 756cba07..ca88d750 100644 --- a/src/toolbar.cpp +++ b/src/toolbar.cpp @@ -154,6 +154,9 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, bool withinToolbar = (mx >= aleft && mx <= aright && my <= atop && my >= abot); + + // Initialize/clear menuHit. + if(menuHit) *menuHit = Command::NONE; if(!canvas && !withinToolbar) { // This gets called every MouseMove event, so return quickly. @@ -224,9 +227,5 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, } } - if(!withinToolbar) { - if(menuHit) *menuHit = Command::NONE; - } - return withinToolbar; }