relocate pattern mouse release handling to FurnaceGui::Loop

This commit is contained in:
bbbradsmith 2023-07-27 01:04:48 -04:00
parent a37260bcaa
commit fd27a41c08
2 changed files with 15 additions and 14 deletions

View file

@ -4488,6 +4488,21 @@ bool FurnaceGUI::loop() {
MEASURE(effectList,drawEffectList()); MEASURE(effectList,drawEffectList());
} }
// release selection if mouse released
if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) && selecting) {
if (!selectingFull) cursor=selEnd;
finishSelection();
if (!mobileUI) {
demandScrollX=true;
if (cursor.xCoarse==selStart.xCoarse && cursor.xFine==selStart.xFine && cursor.y==selStart.y &&
cursor.xCoarse==selEnd.xCoarse && cursor.xFine==selEnd.xFine && cursor.y==selEnd.y) {
if (!settings.cursorMoveNoScroll) {
updateScroll(cursor.y);
}
}
}
}
activateTutorial(GUI_TUTORIAL_OVERVIEW); activateTutorial(GUI_TUTORIAL_OVERVIEW);
if (inspectorOpen) ImGui::ShowMetricsWindow(&inspectorOpen); if (inspectorOpen) ImGui::ShowMetricsWindow(&inspectorOpen);

View file

@ -934,20 +934,6 @@ void FurnaceGUI::drawPattern() {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
} }
} }
// release selection if mouse released
if (ImGui::IsMouseReleased(ImGuiMouseButton_Left) && selecting) {
if (!selectingFull) cursor=selEnd;
finishSelection();
if (!mobileUI) {
demandScrollX=true;
if (cursor.xCoarse==selStart.xCoarse && cursor.xFine==selStart.xFine && cursor.y==selStart.y &&
cursor.xCoarse==selEnd.xCoarse && cursor.xFine==selEnd.xFine && cursor.y==selEnd.y) {
if (!settings.cursorMoveNoScroll) {
updateScroll(cursor.y);
}
}
}
}
ImGui::EndDisabled(); ImGui::EndDisabled();
ImGui::PopStyleVar(); ImGui::PopStyleVar();