1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

LibGUI: Standardize automatic scrolling in TextEditor+GlyphMapWidget

Both widgets now make use of their base class's scrolling timer and
now always accept drag selection updates on mousemove_event().

This guarantees much snappier feeling selections when actively moving
the mouse.
This commit is contained in:
thankyouverycool 2022-12-25 15:51:04 -05:00 committed by Andreas Kling
parent d938b9effe
commit 804baa42f9
4 changed files with 45 additions and 30 deletions

View file

@ -8,7 +8,6 @@
#pragma once
#include <LibCore/Timer.h>
#include <LibGUI/AbstractScrollableWidget.h>
#include <LibGUI/TextRange.h>
#include <LibGfx/Font/BitmapFont.h>
@ -92,6 +91,9 @@ private:
virtual void resize_event(ResizeEvent&) override;
virtual void did_change_font() override;
virtual void context_menu_event(ContextMenuEvent&) override;
virtual void enter_event(Core::Event&) override;
virtual void leave_event(Core::Event&) override;
virtual void automatic_scrolling_timer_did_fire() override;
virtual Optional<UISize> calculated_min_size() const override;
Gfx::IntRect get_outer_rect(int glyph) const;
@ -115,7 +117,6 @@ private:
bool m_show_system_emoji { false };
HashTable<u32> m_modified_glyphs;
Unicode::CodePointRange m_active_range { 0x0000, 0x10FFFF };
RefPtr<Core::Timer> m_automatic_selection_scroll_timer;
Gfx::IntPoint m_last_mousemove_position;
};