Added pen options to android menu
This commit is contained in:
parent
4c557b8d8a
commit
eaef736be5
5 changed files with 14 additions and 7 deletions
|
|
@ -68,10 +68,10 @@ nlohmann::json GlobalConfig::get_config_json(const InputManager& input) const {
|
|||
|
||||
json tablet;
|
||||
tablet["pressureAffectsBrushWidth"] = tabletOptions.pressureAffectsBrushWidth;
|
||||
tablet["smoothingSamplingTime"] = tabletOptions.smoothingSamplingTime;
|
||||
tablet["middleClickButton"] = tabletOptions.middleClickButton;
|
||||
tablet["rightClickButton"] = tabletOptions.rightClickButton;
|
||||
tablet["ignoreMouseMovementWhenPenInProximity"] = tabletOptions.ignoreMouseMovementWhenPenInProximity;
|
||||
tablet["disableTouchWhenPenInProximity"] = tabletOptions.disableTouchWhenPenInProximity;
|
||||
tablet["brushMinimumSize"] = tabletOptions.brushMinimumSize;
|
||||
tablet["zoomWhilePenDownAndButtonHeld"] = tabletOptions.zoomWhilePenDownAndButtonHeld;
|
||||
toRet["tablet"] = tablet;
|
||||
|
|
@ -137,10 +137,10 @@ void GlobalConfig::set_config_json(InputManager& input, const nlohmann::json& j,
|
|||
try{j.at("antialiasing").get_to(antialiasing);} catch(...) {}
|
||||
|
||||
try{j.at("tablet").at("pressureAffectsBrushWidth").get_to(tabletOptions.pressureAffectsBrushWidth);} catch(...) {}
|
||||
try{j.at("tablet").at("smoothingSamplingTime").get_to(tabletOptions.smoothingSamplingTime);} catch(...) {}
|
||||
try{j.at("tablet").at("middleClickButton").get_to(tabletOptions.middleClickButton);} catch(...) {}
|
||||
try{j.at("tablet").at("rightClickButton").get_to(tabletOptions.rightClickButton);} catch(...) {}
|
||||
try{j.at("tablet").at("ignoreMouseMovementWhenPenInProximity").get_to(tabletOptions.ignoreMouseMovementWhenPenInProximity);} catch(...) {}
|
||||
try{j.at("tablet").at("disableTouchWhenPenInProximity").get_to(tabletOptions.disableTouchWhenPenInProximity);} catch(...) {}
|
||||
try{j.at("tablet").at("brushMinimumSize").get_to(tabletOptions.brushMinimumSize);} catch(...) {}
|
||||
try{j.at("tablet").at("zoomWhilePenDownAndButtonHeld").get_to(tabletOptions.zoomWhilePenDownAndButtonHeld);} catch(...) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,10 +67,10 @@ class GlobalConfig {
|
|||
|
||||
struct TabletOptions {
|
||||
bool pressureAffectsBrushWidth = true;
|
||||
float smoothingSamplingTime = 0.04f;
|
||||
uint8_t middleClickButton = 1;
|
||||
uint8_t rightClickButton = 2;
|
||||
bool ignoreMouseMovementWhenPenInProximity = false;
|
||||
bool disableTouchWhenPenInProximity = false;
|
||||
float brushMinimumSize = 0.0f;
|
||||
bool zoomWhilePenDownAndButtonHeld = true;
|
||||
} tabletOptions;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "../GUIStuff/ElementHelpers/LayoutHelpers.hpp"
|
||||
#include "../GUIStuff/ElementHelpers/ColorPickerHelpers.hpp"
|
||||
#include "../GUIStuff/ElementHelpers/CheckBoxHelpers.hpp"
|
||||
#include "../GUIStuff/ElementHelpers/NumberSliderHelpers.hpp"
|
||||
#include "../World.hpp"
|
||||
#include "Helpers/StringHelpers.hpp"
|
||||
#include "PhoneDrawingProgramScreen.hpp"
|
||||
|
|
@ -938,7 +939,10 @@ void FileSelectScreen::settings_view() {
|
|||
.onEdit = [&] { main.g.window_update(); }
|
||||
});
|
||||
input_scalar_field(gui, "jump transition time", "Jump transition time", &main.conf.jumpTransitionTime, 0.01f, 1000.0f, {.decimalPrecision = 2});
|
||||
checkbox_boolean_field(gui, "disable touch when pen in proximity", "Disable touch when pen in proximity", &main.conf.tabletOptions.disableTouchWhenPenInProximity);
|
||||
checkbox_boolean_field(gui, "make all tools share same size", "Make all tools share size", &main.toolConfig.globalConf.useGlobalRelativeWidth);
|
||||
slider_scalar_field(gui, "tablet brush minimum size", "Brush relative minimum size", &main.conf.tabletOptions.brushMinimumSize, 0.0f, 1.0f, {.decimalPrecision = 3});
|
||||
checkbox_boolean_field(gui, "pen pressure width", "Pen pressure affects brush size", &main.conf.tabletOptions.pressureAffectsBrushWidth);
|
||||
#ifndef __ANDROID__
|
||||
checkbox_boolean_field(gui, "use mobile UI", "Use mobile UI (requires restart)", &main.conf.mobileUI);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1590,7 +1590,6 @@ void Toolbar::general_settings_inner_gui() {
|
|||
case GSETTINGS_TABLET: {
|
||||
general_scroll_area("tablet settings", [&] {
|
||||
checkbox_boolean_field(gui, "pen pressure width", "Pen pressure affects brush size", &main.conf.tabletOptions.pressureAffectsBrushWidth);
|
||||
slider_scalar_field(gui, "smoothing time", "Smoothing sampling time", &main.conf.tabletOptions.smoothingSamplingTime, 0.001f, 1.0f, {.decimalPrecision = 3});
|
||||
input_scalar_field<uint8_t>(gui, "middle click", "Middle click pen button", &main.conf.tabletOptions.middleClickButton, 1, 255);
|
||||
input_scalar_field<uint8_t>(gui, "right click", "Right click pen button", &main.conf.tabletOptions.rightClickButton, 1, 255);
|
||||
slider_scalar_field(gui, "tablet brush minimum size", "Brush relative minimum size", &main.conf.tabletOptions.brushMinimumSize, 0.0f, 1.0f, {.decimalPrecision = 3});
|
||||
|
|
@ -1598,6 +1597,7 @@ void Toolbar::general_settings_inner_gui() {
|
|||
#ifdef _WIN32
|
||||
checkbox_boolean_field(gui, "mouse ignore when pen proximity", "Ignore mouse movement when pen in proximity", &main.conf.tabletOptions.ignoreMouseMovementWhenPenInProximity);
|
||||
#endif
|
||||
checkbox_boolean_field(gui, "disable touch when pen in proximity", "Disable touch when pen in proximity", &main.conf.tabletOptions.disableTouchWhenPenInProximity);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -786,15 +786,18 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
|
|||
break;
|
||||
}
|
||||
case SDL_EVENT_FINGER_DOWN: {
|
||||
mS.m->input.backend_touch_finger_down_update(event->tfinger);
|
||||
if(!mS.m->conf.tabletOptions.disableTouchWhenPenInProximity || !mS.m->input.pen.inProximity)
|
||||
mS.m->input.backend_touch_finger_down_update(event->tfinger);
|
||||
break;
|
||||
}
|
||||
case SDL_EVENT_FINGER_UP: {
|
||||
mS.m->input.backend_touch_finger_up_update(event->tfinger);
|
||||
if(!mS.m->conf.tabletOptions.disableTouchWhenPenInProximity || !mS.m->input.pen.inProximity)
|
||||
mS.m->input.backend_touch_finger_up_update(event->tfinger);
|
||||
break;
|
||||
}
|
||||
case SDL_EVENT_FINGER_MOTION: {
|
||||
mS.m->input.backend_touch_finger_motion_update(event->tfinger);
|
||||
if(!mS.m->conf.tabletOptions.disableTouchWhenPenInProximity || !mS.m->input.pen.inProximity)
|
||||
mS.m->input.backend_touch_finger_motion_update(event->tfinger);
|
||||
break;
|
||||
}
|
||||
case SDL_EVENT_DISPLAY_ORIENTATION:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue