mirror of
https://github.com/pelgraine/Meck.git
synced 2026-08-08 09:42:43 +02:00
tdpro - fixed notes screen touch recog and file open bug
This commit is contained in:
@@ -1225,14 +1225,24 @@ static void lastHeardToggleContact() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Notes editing: tap → open keyboard for typing
|
||||
// Notes screen: mode-dependent touch
|
||||
if (ui_task.isOnNotesScreen()) {
|
||||
NotesScreen* notes = (NotesScreen*)ui_task.getNotesScreen();
|
||||
if (notes && notes->isEditing()) {
|
||||
if (notes) {
|
||||
if (notes->isInFileList()) {
|
||||
int result = notes->selectRowAtVY(vy);
|
||||
if (result == 1) { ui_task.forceRefresh(); return 0; } // Moved selection
|
||||
if (result == 2) return KEY_ENTER; // Same row — open
|
||||
return 0;
|
||||
}
|
||||
if (notes->isEditing()) {
|
||||
#if defined(LilyGo_T5S3_EPaper_Pro)
|
||||
ui_task.showVirtualKeyboard(VKB_NOTES, "Edit Note", "", 137);
|
||||
ui_task.showVirtualKeyboard(VKB_NOTES, "Edit Note", "", 137);
|
||||
#endif
|
||||
return 0; // T-Deck Pro: keyboard handles typing directly
|
||||
return 0; // T-Deck Pro: keyboard handles typing directly
|
||||
}
|
||||
// READING, RENAMING, CONFIRM_DELETE: tap = confirm/enter
|
||||
return KEY_ENTER;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1220,6 +1220,35 @@ public:
|
||||
bool isConfirmingDelete() const { return _mode == CONFIRM_DELETE; }
|
||||
bool isEmpty() const { return _bufLen == 0; }
|
||||
|
||||
// Touch: select file list row by virtual Y coordinate
|
||||
// Returns: 0 = outside list, 1 = moved selection, 2 = tapped same row (open)
|
||||
int selectRowAtVY(int vy) {
|
||||
if (_mode != FILE_LIST) return 0;
|
||||
const int startY = 14, footerH = 14;
|
||||
const int listLineH = _prefs ? _prefs->smallLineH() : 9;
|
||||
#if defined(LilyGo_T5S3_EPaper_Pro)
|
||||
const int bodyTop = startY;
|
||||
#else
|
||||
const int bodyTop = startY + (_prefs ? _prefs->smallHighlightOff() : 5);
|
||||
#endif
|
||||
if (vy < bodyTop || vy >= 128 - footerH) return 0;
|
||||
|
||||
int totalItems = 1 + (int)_fileList.size();
|
||||
if (totalItems == 0) return 0;
|
||||
int maxVisible = (128 - startY - footerH) / listLineH;
|
||||
if (maxVisible < 3) maxVisible = 3;
|
||||
if (maxVisible > 15) maxVisible = 15;
|
||||
int startIdx = max(0, min(_selectedFile - maxVisible / 2,
|
||||
totalItems - maxVisible));
|
||||
|
||||
int tappedRow = startIdx + (vy - bodyTop) / listLineH;
|
||||
if (tappedRow < 0 || tappedRow >= totalItems) return 0;
|
||||
|
||||
if (tappedRow == _selectedFile) return 2;
|
||||
_selectedFile = tappedRow;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ---- Cursor Navigation (called from main.cpp) ----
|
||||
|
||||
void moveCursorLeft() {
|
||||
|
||||
Reference in New Issue
Block a user