From 7f26b823ff6f19d4019c3d8395973878bb7f5155 Mon Sep 17 00:00:00 2001 From: ArthurSonzogni Date: Sun, 5 Nov 2023 10:27:20 +0100 Subject: [PATCH] Revert "Prevent drag spamming buttons" This reverts commit 273b933f2269bb0ae5505e32343b73a211db7ea1. --- src/ftxui/component/button.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/ftxui/component/button.cpp b/src/ftxui/component/button.cpp index 60f9fbcf..c983f31f 100644 --- a/src/ftxui/component/button.cpp +++ b/src/ftxui/component/button.cpp @@ -50,11 +50,6 @@ class ButtonBase : public ComponentBase, public ButtonOption { } auto focus_management = focused ? focus : active ? select : nothing; - - if (focus_management == nothing) { - isMousePressed = false; - } - const EntryState state = { *label, false, @@ -130,16 +125,9 @@ class ButtonBase : public ComponentBase, public ButtonOption { } if (event.mouse().button == Mouse::Left && - event.mouse().motion == Mouse::Pressed && isMousePressed == false) { + event.mouse().motion == Mouse::Pressed) { TakeFocus(); OnClick(); - isMousePressed = true; - return true; - } - - if(event.mouse().button == Mouse::Left && - event.mouse().motion == Mouse::Released) { - isMousePressed = false; return true; } @@ -149,7 +137,6 @@ class ButtonBase : public ComponentBase, public ButtonOption { bool Focusable() const final { return true; } private: - bool isMousePressed = false; bool mouse_hover_ = false; Box box_; ButtonOption option_;