mirror of
https://github.com/RGBCube/serenity
synced 2025-06-28 17:02:12 +00:00
LibGUI: Allow selecting glyphs by dragging in GlyphMapWidget
This commit is contained in:
parent
c094bb60bc
commit
66e72ed5e6
2 changed files with 34 additions and 0 deletions
|
@ -160,10 +160,41 @@ void GlyphMapWidget::mousedown_event(MouseEvent& event)
|
|||
m_selection.set_size(1);
|
||||
m_selection.set_start(glyph);
|
||||
}
|
||||
m_in_drag_select = true;
|
||||
set_active_glyph(glyph, ShouldResetSelection::No);
|
||||
}
|
||||
}
|
||||
|
||||
void GlyphMapWidget::mouseup_event(GUI::MouseEvent& event)
|
||||
{
|
||||
Frame::mouseup_event(event);
|
||||
|
||||
if (!m_in_drag_select)
|
||||
return;
|
||||
|
||||
if (auto maybe_glyph = glyph_at_position(event.position()); maybe_glyph.has_value()) {
|
||||
auto glyph = maybe_glyph.value();
|
||||
m_selection.extend_to(glyph);
|
||||
m_in_drag_select = false;
|
||||
set_active_glyph(glyph, ShouldResetSelection::No);
|
||||
}
|
||||
}
|
||||
|
||||
void GlyphMapWidget::mousemove_event(GUI::MouseEvent& event)
|
||||
{
|
||||
Frame::mousemove_event(event);
|
||||
|
||||
if (!m_in_drag_select)
|
||||
return;
|
||||
|
||||
if (auto maybe_glyph = glyph_at_position(event.position()); maybe_glyph.has_value()) {
|
||||
auto glyph = maybe_glyph.value();
|
||||
m_selection.extend_to(glyph);
|
||||
scroll_to_glyph(glyph);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void GlyphMapWidget::doubleclick_event(MouseEvent& event)
|
||||
{
|
||||
Widget::doubleclick_event(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue