Take a slider let go within a centimetre of the glass edge as its end, because the panel loses a finger swiped off the screen before the slider's end (0.2.80)
A fast swipe off the right side of a Guition ended at 93-98 %: the GT911 reports the finger for the last time 33-48 px inside the edge while a wide tile's slider ends 29 px from it, and LVGL keeps the last point it saw. cyd::edge_snap() takes a release inside the band (SLIDER_EDGE_SNAP_PX: Guition 67, CYD 56) as the end that lies in that band, for the tile sliders and the light card's sliders; the log names each snap. App 0.2.80, firmware 0.2.67. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -219,4 +219,17 @@ inline bool release_jump(int held, int released, int minimum, int maximum) {
|
||||
const bool at_end = released <= minimum || released >= maximum;
|
||||
return at_end && std::abs(released - held) * 4 > maximum - minimum;
|
||||
}
|
||||
|
||||
// A slider whose end lies within `band` pixels of the screen's edge cannot be dragged to that end:
|
||||
// the panel loses a finger swiped off the glass before it gets there (a GT911 reports a fast swipe
|
||||
// for the last time 30-50 px inside the edge), and LVGL keeps the last point it saw. A finger let go
|
||||
// inside that band meant the end, as a pointer clamped to the bar does in Home Assistant's slider.
|
||||
// `point`, `start` and `end` lie along the slider's axis; returns -1 for the start, 1 for the end.
|
||||
inline int edge_snap(int point, int start, int end, int screen, int band) {
|
||||
if (band <= 0 || screen <= 0) return 0;
|
||||
if (end >= screen - band && point >= screen - band) return 1;
|
||||
if (start < band && point < band) return -1;
|
||||
return 0;
|
||||
}
|
||||
inline int edge_snap_band = 0;
|
||||
} // namespace cyd
|
||||
|
||||
Reference in New Issue
Block a user