Improve Indicator transport touch UI
This commit is contained in:
1 parent
5af7b73ff9
commit
2e026caf4a
10 files changed
+212
-38
No files matched your search
@@ -30,6 +30,17 @@ struct CompactCompanionPairingLayout {
|
||||
int pairing_value_y;
|
||||
};
|
||||
|
||||
// Full-size Indicator builds keep the established 160x160 logical coordinate
|
||||
// system even when they obtain a native 480x480 render buffer. Expose that
|
||||
// distinction to the home page so it can spend the extra pixel density on
|
||||
// larger, deliberately reflowed text without changing the 320 BLE profile or
|
||||
// unrelated displays that happen to have a tall viewport.
|
||||
inline bool usesExpandedCompanionHomeTypography(
|
||||
int width, int height, int render_width, int render_height) {
|
||||
return width == 160 && height == 160
|
||||
&& render_width == 480 && render_height == 480;
|
||||
}
|
||||
|
||||
// The common Companion OLED/TFT viewport is 128x64. Its normal instruction
|
||||
// and network rows occupy the same lower area needed by the Bluetooth status,
|
||||
// so an active PIN/connection replaces those rows with this compact block.
|
||||
@@ -56,7 +67,19 @@ inline CompactCompanionPairingLayout makeCompactCompanionPairingLayout(
|
||||
// fifths of the display height. The Indicator renders a 160x160 logical UI,
|
||||
// for which this produces a 48-pixel-tall block centered at y=128.
|
||||
inline CompanionHomeLayout makeLargeCompanionHomeLayout(int width,
|
||||
int height) {
|
||||
int height,
|
||||
bool expanded = false) {
|
||||
if (expanded && width == 160 && height == 160) {
|
||||
return {
|
||||
{2, 51, 156, 46},
|
||||
{8, 100, 144, 58},
|
||||
52,
|
||||
76,
|
||||
102,
|
||||
126,
|
||||
};
|
||||
}
|
||||
|
||||
// Ordinary one-line status needs almost the full logical width when the
|
||||
// Indicator's recovered mono font is active. The PIN block gets the larger
|
||||
// inset so it remains visibly distinct from the page background.
|
||||
|
||||
@@ -23,10 +23,10 @@ inline CompanionTransportSelectorLayout makeCompanionTransportSelectorLayout(
|
||||
const bool tall_display = height >= 96;
|
||||
const int margin = 2;
|
||||
const int gap = 4;
|
||||
const int box_y = tall_display ? 40 : 20;
|
||||
const int prompt_y = height - (tall_display ? 22 : 11);
|
||||
int box_height = prompt_y - box_y - 8;
|
||||
if (box_height > 72) box_height = 72;
|
||||
const int box_y = tall_display ? 36 : 20;
|
||||
const int prompt_y = height - (tall_display ? 20 : 11);
|
||||
int box_height = prompt_y - box_y - (tall_display ? 6 : 8);
|
||||
if (box_height > 98) box_height = 98;
|
||||
if (box_height < 20) box_height = 20;
|
||||
const int box_width = (width - margin * 2 - gap) / 2;
|
||||
const int bluetooth_x = margin + box_width + gap;
|
||||
|
||||
@@ -89,9 +89,13 @@ public:
|
||||
_active = false;
|
||||
_release_samples = 0;
|
||||
|
||||
// A contact seen only once has no measurable direction. Ignoring it is
|
||||
// safer than treating the endpoint of a fast swipe as an opposite tap.
|
||||
if (_touch_samples < 2 || width <= 0 || height <= 0) {
|
||||
// A contact seen only once has no measurable direction. Keep ignoring it
|
||||
// on ordinary pages so the endpoint of a fast swipe cannot become an
|
||||
// opposite tap. An explicit split selector is different: its bounded
|
||||
// boxes are unambiguous stationary targets, and rejecting a quick contact
|
||||
// makes a normal tap disappear when it lands within one polling interval.
|
||||
if (_touch_samples == 0 || width <= 0 || height <= 0
|
||||
|| (_touch_samples < 2 && split_selector == nullptr)) {
|
||||
return TouchAction::None;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user