MCPcopy Create free account
hub / github.com/XorTroll/Goldleaf / OnInput

Method OnInput

Goldleaf/source/ui/ui_FileContentLayout.cpp:30–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace ui {
29
30 void FileContentLayout::OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const pu::ui::TouchPoint touch_pos) {
31 if(keys_down & HidNpadButton_B) {
32 g_MainApplication->ReturnToParentLayout();
33 }
34
35 auto update_lines = false;
36 if((keys_down & HidNpadButton_Down) || (keys_down & HidNpadButton_StickLDown) || (keys_held & HidNpadButton_StickRDown)) {
37 update_lines |= this->ScrollDown();
38 }
39 else if((keys_down & HidNpadButton_Up) || (keys_down & HidNpadButton_StickLUp) || (keys_held & HidNpadButton_StickRUp)) {
40 update_lines |= this->ScrollUp();
41 }
42
43 if(!this->read_hex) {
44 // Horizontal movement only on text files
45 if((keys_down & HidNpadButton_Right) || (keys_down & HidNpadButton_StickLRight) || (keys_held & HidNpadButton_StickRRight)) {
46 update_lines |= this->MoveRight();
47 }
48 else if((keys_down & HidNpadButton_Left) || (keys_down & HidNpadButton_StickLLeft) || (keys_held & HidNpadButton_StickRLeft)) {
49 update_lines |= this->MoveLeft();
50 }
51 }
52
53 if(update_lines) {
54 this->UpdateLines();
55 }
56 }
57
58 bool FileContentLayout::ScrollUp() {
59 if(this->line_offset > 0) {

Callers

nothing calls this directly

Calls 6

ScrollDownMethod · 0.95
ScrollUpMethod · 0.95
MoveRightMethod · 0.95
MoveLeftMethod · 0.95
UpdateLinesMethod · 0.95
ReturnToParentLayoutMethod · 0.80

Tested by

no test coverage detected