From 7b09a5399d7a6b10af8d0d1ba17d2117003994aa Mon Sep 17 00:00:00 2001 From: kcleal Date: Fri, 26 Jul 2024 08:52:26 +0100 Subject: [PATCH] Monitor scaling for menu items --- src/menu.cpp | 10 +++++----- src/menu.h | 2 +- src/plot_controls.cpp | 2 +- src/plot_manager.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/menu.cpp b/src/menu.cpp index 0f2e3c7..1056c63 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -104,8 +104,8 @@ namespace Menu { SkRect rect; SkPath path; float pad = fonts.overlayHeight; - float v_gap = 5; - float control_box_h = 35; + float v_gap = 3 * monitorScale; + float control_box_h = 18 * monitorScale; //35; float y = v_gap; float x = v_gap; float m_width = 28 * fonts.overlayWidth; @@ -344,13 +344,13 @@ namespace Menu { } } - void menuMousePos(Themes::IniOptions &opts, Themes::Fonts &fonts, float xPos, float yPos, float fb_height, float fb_width, bool *redraw) { + void menuMousePos(Themes::IniOptions &opts, Themes::Fonts &fonts, float xPos, float yPos, float fb_height, float fb_width, float monitorScale, bool *redraw) { if (opts.editing_underway) { return; } float pad = fonts.overlayHeight; - float v_gap = 5; - float control_box_h = 35; + float v_gap = 3 * monitorScale; //5; + float control_box_h = 18 * monitorScale; //35; float y = v_gap; float x = v_gap; auto m_height = (float)(pad * 1.5); diff --git a/src/menu.h b/src/menu.h index f49a725..3ed9da5 100644 --- a/src/menu.h +++ b/src/menu.h @@ -39,7 +39,7 @@ namespace Menu { void drawMenu(SkCanvas *canvas, Themes::IniOptions &opts, Themes::Fonts &fonts, float monitorScale, float fb_width, float fb_height, std::string inputText, int charIndex); - void menuMousePos(Themes::IniOptions &opts, Themes::Fonts &fonts, float xPos, float yPos, float fb_height, float fb_width, bool *redraw); + void menuMousePos(Themes::IniOptions &opts, Themes::Fonts &fonts, float xPos, float yPos, float fb_height, float fb_width, float monitorScale, bool *redraw); bool menuSelect(Themes::IniOptions &opts); diff --git a/src/plot_controls.cpp b/src/plot_controls.cpp index a90aa36..2af9772 100644 --- a/src/plot_controls.cpp +++ b/src/plot_controls.cpp @@ -2199,7 +2199,7 @@ namespace Manager { Term::printVariantFileInfo(label, mouseOverTileIndex + currentVarTrack->blockStart, out); } } else if (mode == SETTINGS) { - Menu::menuMousePos(opts, fonts, (float)xPos_fb, (float)yPos_fb, (float)fb_height, (float)fb_width, &redraw); + Menu::menuMousePos(opts, fonts, (float)xPos_fb, (float)yPos_fb, (float)fb_height, (float)fb_width, monitorScale, &redraw); } } } diff --git a/src/plot_manager.cpp b/src/plot_manager.cpp index 92f6865..a9cbcf2 100644 --- a/src/plot_manager.cpp +++ b/src/plot_manager.cpp @@ -1271,7 +1271,7 @@ namespace Manager { fonts.setFontSize(yScaling, monitorScale); SkRect rect{}; float height_f = fonts.overlayHeight * 2; - float x = 50; + float x = 25 * monitorScale; SkPaint bg = opts.theme.bgMenu; float y = fb_height - (fb_height * 0.025); float y2 = fb_height - (height_f * 2.5);