Move pattern finishSelection out of SDL-triggered pointUp, and replace with ImGui release trigger in drawPattern. This prevents down/up events from being processed out of order by two separate event systems, causing selection to be stuck on if the up event is recieved within 1 frame of the down event.

This commit is contained in:
bbbradsmith 2023-07-12 05:45:30 -04:00
parent edb48d47be
commit a37260bcaa
2 changed files with 15 additions and 13 deletions

View file

@ -3235,19 +3235,6 @@ void FurnaceGUI::pointUp(int x, int y, int button) {
if (dragMobileEditButton) { if (dragMobileEditButton) {
dragMobileEditButton=false; dragMobileEditButton=false;
} }
if (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);
}
}
}
}
} }
void FurnaceGUI::pointMotion(int x, int y, int xrel, int yrel) { void FurnaceGUI::pointMotion(int x, int y, int xrel, int yrel) {

View file

@ -934,6 +934,21 @@ 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();
oldRow=curRow; oldRow=curRow;