Disabled scroll in editor when user is interacting with the top menu.

This commit is contained in:
Justin Marshall
2020-07-09 08:46:17 -07:00
parent 31e868bb54
commit c7ba544c94
3 changed files with 15 additions and 2 deletions
+5 -1
View File
@@ -109,7 +109,11 @@ void ScrollClass::AI(KeyNumType &input, int x, int y)
int screen_width = SeenBuff.Get_Width();
int screen_height = SeenBuff.Get_Height();
bool at_screen_edge = (y == 0 || x == 0 || x >= screen_width - 1 || y >= screen_height - 1);
bool at_screen_edge = false;
if (!Debug_Map || !Debug_LockScroll) {
at_screen_edge = (y == 0 || x == 0 || x >= screen_width - 1 || y >= screen_height - 1);
}
/*
** Verify that the mouse is over a scroll region.
+7
View File
@@ -4,6 +4,8 @@
#include "function.h"
#include "image.h"
bool Debug_LockScroll = false;
void SidebarEditor::init() {
metalplt = LoadEditorImage("metalplt.shp");
@@ -36,10 +38,12 @@ void SidebarEditor::draw_it(void) {
ImGuiStyle& style = ImGui::GetStyle();
style.FramePadding = ImVec2(0, 0);
Debug_LockScroll = false;
if (ImGui::BeginMainMenuBar())
{
if (ImGui::BeginMenu("File"))
{
Debug_LockScroll = true;
if (ImGui::MenuItem("New Scenario")) { mainmenu_selection = 0; }
if (ImGui::MenuItem("Load Scenario")) { mainmenu_selection = 1; }
if (ImGui::MenuItem("Save Scenario")) { mainmenu_selection = 2; }
@@ -48,6 +52,7 @@ void SidebarEditor::draw_it(void) {
}
if (ImGui::BeginMenu("Map"))
{
Debug_LockScroll = true;
if (ImGui::MenuItem("Size Map")) { mainmenu_selection = 3; }
if (ImGui::MenuItem("Scenario Options")) { mainmenu_selection = 5; }
if (ImGui::MenuItem("AI Options")) { mainmenu_selection = 6; }
@@ -55,12 +60,14 @@ void SidebarEditor::draw_it(void) {
}
if (ImGui::BeginMenu("Objects"))
{
Debug_LockScroll = true;
if (ImGui::MenuItem("Add Game Object")) { mainmenu_selection = 4; }
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Run"))
{
Debug_LockScroll = true;
if (ImGui::MenuItem("Play Scenario")) { mainmenu_selection = 7; }
ImGui::EndMenu();
}
+3 -1
View File
@@ -13,4 +13,6 @@ private:
Image_t* LoadEditorImage(const char* name);
private:
Image_t* metalplt;
};
};
extern bool Debug_LockScroll;