Capture mouse for the slider component.

This commit is contained in:
ArthurSonzogni
2021-05-01 18:13:56 +02:00
parent 0af8201023
commit eb399d20c5
15 changed files with 157 additions and 35 deletions

View File

@@ -1,4 +1,5 @@
#include "ftxui/component/button.hpp"
#include "ftxui/component/screen_interactive.hpp"
#include <functional>
@@ -11,6 +12,9 @@ Element Button::Render() {
bool Button::OnEvent(Event event) {
if (event.is_mouse() && box_.Contain(event.mouse().x, event.mouse().y)) {
if (!event.screen()->CaptureMouse())
return false;
TakeFocus();
if (event.mouse().button == Mouse::Left &&