Skip to content

Commit 73178af

Browse files
authored
Merge pull request #781 from o-sdn-o/gui-bridge
Allows precise (1:1) scrolling using the orthogonal axis
2 parents 77459b1 + b88d6eb commit 73178af

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/netxs/desktopio/application.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace netxs::app
2222

2323
namespace netxs::app::shared
2424
{
25-
static const auto version = "v2025.08.03b";
25+
static const auto version = "v2025.08.04";
2626
static const auto repository = "https://github.com/directvt/vtm";
2727
static const auto usr_config = "~/.config/vtm/settings.xml"s;
2828
static const auto sys_config = "/etc/vtm/settings.xml"s;

src/netxs/desktopio/controls.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4644,9 +4644,13 @@ namespace netxs::ui
46444644
scroll_len = std::max(1, new_size[Axis]);
46454645
m_to_s();
46464646
}
4647-
void stepby(fp32 delta)
4647+
void stepby(fp2d delta)
46484648
{
4649-
scroll_air = grip_origin + delta;
4649+
static constexpr auto Sixa = !Axis; // Orthogonal axis.
4650+
auto d1 = std::abs(delta[Axis]);
4651+
auto d2 = std::abs(delta[Sixa]);
4652+
if (d1 > d2) scroll_air = grip_origin + delta[Axis];
4653+
else scroll_air = grip_origin + delta[Sixa] * r; // Allows precise (1:1) scrolling using the orthogonal axis.
46504654
s_to_m();
46514655
}
46524656
void commit(rect& handle)
@@ -4755,7 +4759,7 @@ namespace netxs::ui
47554759
}
47564760
else
47574761
{
4758-
if (auto delta = (gear.coord - drag_origin)[Axis])
4762+
if (auto delta = gear.coord - drag_origin)
47594763
{
47604764
calc.stepby(delta);
47614765
send<e2::form::upon::scroll::bycoor::_<Axis>>();
@@ -4775,10 +4779,10 @@ namespace netxs::ui
47754779
auto dir = calc.inside(twod{ gear.coord }[Axis]);
47764780
if (dir == 0) // Inside the grip.
47774781
{
4778-
calc.captured = true;
47794782
drag_origin = gear.coord;
47804783
calc.m_to_s();
47814784
calc.grip_origin = calc.scroll_air;
4785+
calc.captured = true;
47824786
}
47834787
else // Outside the grip.
47844788
{

src/netxs/desktopio/lixx.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2669,10 +2669,10 @@ namespace netxs::lixx // li++, libinput++.
26692669
}
26702670
}
26712671
break;
2672-
case M_VERSION: if (m->version == s->match->version) matched_flags |= flag; break;
2673-
case M_DMI: if (::fnmatch(s->match->dmi2.data(), m->dmi2.data(), 0) == 0) matched_flags |= flag; break;
2674-
case M_DT: if (::fnmatch(s->match->dt2.data(), m->dt2.data(), 0) == 0) matched_flags |= flag; break;
2675-
case M_UDEV_TYPE: if (s->match->ud_type & m->ud_type) matched_flags |= flag; break;
2672+
case M_VERSION: if (m->version == s->match->version) { matched_flags |= flag; } break;
2673+
case M_DMI: if (::fnmatch(s->match->dmi2.data(), m->dmi2.data(), 0) == 0) { matched_flags |= flag; } break;
2674+
case M_DT: if (::fnmatch(s->match->dt2.data(), m->dt2.data(), 0) == 0) { matched_flags |= flag; } break;
2675+
case M_UDEV_TYPE: if (s->match->ud_type & m->ud_type) { matched_flags |= flag; } break;
26762676
default: ::abort();
26772677
}
26782678
if (prev_matched_flags != matched_flags)

0 commit comments

Comments
 (0)