mirror of https://git.suyu.dev/suyu/suyu
Merge pull request #10950 from german77/mouse_tune
input_common: Tune mouse controls
This commit is contained in:
commit
595d55d485
|
@ -527,12 +527,10 @@ struct Values {
|
||||||
Setting<bool> mouse_panning{false, "mouse_panning"};
|
Setting<bool> mouse_panning{false, "mouse_panning"};
|
||||||
Setting<u8, true> mouse_panning_x_sensitivity{50, 1, 100, "mouse_panning_x_sensitivity"};
|
Setting<u8, true> mouse_panning_x_sensitivity{50, 1, 100, "mouse_panning_x_sensitivity"};
|
||||||
Setting<u8, true> mouse_panning_y_sensitivity{50, 1, 100, "mouse_panning_y_sensitivity"};
|
Setting<u8, true> mouse_panning_y_sensitivity{50, 1, 100, "mouse_panning_y_sensitivity"};
|
||||||
Setting<u8, true> mouse_panning_deadzone_x_counterweight{
|
Setting<u8, true> mouse_panning_deadzone_counterweight{20, 0, 100,
|
||||||
0, 0, 100, "mouse_panning_deadzone_x_counterweight"};
|
"mouse_panning_deadzone_counterweight"};
|
||||||
Setting<u8, true> mouse_panning_deadzone_y_counterweight{
|
Setting<u8, true> mouse_panning_decay_strength{18, 0, 100, "mouse_panning_decay_strength"};
|
||||||
0, 0, 100, "mouse_panning_deadzone_y_counterweight"};
|
Setting<u8, true> mouse_panning_min_decay{6, 0, 100, "mouse_panning_min_decay"};
|
||||||
Setting<u8, true> mouse_panning_decay_strength{22, 0, 100, "mouse_panning_decay_strength"};
|
|
||||||
Setting<u8, true> mouse_panning_min_decay{5, 0, 100, "mouse_panning_min_decay"};
|
|
||||||
|
|
||||||
Setting<bool> mouse_enabled{false, "mouse_enabled"};
|
Setting<bool> mouse_enabled{false, "mouse_enabled"};
|
||||||
Setting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"};
|
Setting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"};
|
||||||
|
|
|
@ -12,9 +12,13 @@
|
||||||
|
|
||||||
namespace InputCommon {
|
namespace InputCommon {
|
||||||
constexpr int update_time = 10;
|
constexpr int update_time = 10;
|
||||||
constexpr float default_stick_sensitivity = 0.0044f;
|
constexpr float default_panning_sensitivity = 0.0010f;
|
||||||
constexpr float default_motion_sensitivity = 0.0003f;
|
constexpr float default_stick_sensitivity = 0.0006f;
|
||||||
|
constexpr float default_deadzone_counterweight = 0.01f;
|
||||||
|
constexpr float default_motion_panning_sensitivity = 2.5f;
|
||||||
|
constexpr float default_motion_sensitivity = 0.416f;
|
||||||
constexpr float maximum_rotation_speed = 2.0f;
|
constexpr float maximum_rotation_speed = 2.0f;
|
||||||
|
constexpr float maximum_stick_range = 1.5f;
|
||||||
constexpr int mouse_axis_x = 0;
|
constexpr int mouse_axis_x = 0;
|
||||||
constexpr int mouse_axis_y = 1;
|
constexpr int mouse_axis_y = 1;
|
||||||
constexpr int wheel_axis_x = 2;
|
constexpr int wheel_axis_x = 2;
|
||||||
|
@ -81,7 +85,7 @@ void Mouse::UpdateThread(std::stop_token stop_token) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse::UpdateStickInput() {
|
void Mouse::UpdateStickInput() {
|
||||||
if (!Settings::values.mouse_panning) {
|
if (!IsMousePanningEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,26 +93,13 @@ void Mouse::UpdateStickInput() {
|
||||||
|
|
||||||
// Prevent input from exceeding the max range (1.0f) too much,
|
// Prevent input from exceeding the max range (1.0f) too much,
|
||||||
// but allow some room to make it easier to sustain
|
// but allow some room to make it easier to sustain
|
||||||
if (length > 1.2f) {
|
if (length > maximum_stick_range) {
|
||||||
last_mouse_change /= length;
|
last_mouse_change /= length;
|
||||||
last_mouse_change *= 1.2f;
|
last_mouse_change *= maximum_stick_range;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto mouse_change = last_mouse_change;
|
SetAxis(identifier, mouse_axis_x, last_mouse_change.x);
|
||||||
|
SetAxis(identifier, mouse_axis_y, -last_mouse_change.y);
|
||||||
// Bind the mouse change to [0 <= deadzone_counterweight <= 1,1]
|
|
||||||
if (length < 1.0f) {
|
|
||||||
const float deadzone_h_counterweight =
|
|
||||||
Settings::values.mouse_panning_deadzone_x_counterweight.GetValue();
|
|
||||||
const float deadzone_v_counterweight =
|
|
||||||
Settings::values.mouse_panning_deadzone_y_counterweight.GetValue();
|
|
||||||
mouse_change /= length;
|
|
||||||
mouse_change.x *= length + (1 - length) * deadzone_h_counterweight * 0.01f;
|
|
||||||
mouse_change.y *= length + (1 - length) * deadzone_v_counterweight * 0.01f;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetAxis(identifier, mouse_axis_x, mouse_change.x);
|
|
||||||
SetAxis(identifier, mouse_axis_y, -mouse_change.y);
|
|
||||||
|
|
||||||
// Decay input over time
|
// Decay input over time
|
||||||
const float clamped_length = std::min(1.0f, length);
|
const float clamped_length = std::min(1.0f, length);
|
||||||
|
@ -120,14 +111,13 @@ void Mouse::UpdateStickInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse::UpdateMotionInput() {
|
void Mouse::UpdateMotionInput() {
|
||||||
// This may need its own sensitivity instead of using the average
|
const float sensitivity =
|
||||||
const float sensitivity = (Settings::values.mouse_panning_x_sensitivity.GetValue() +
|
IsMousePanningEnabled() ? default_motion_panning_sensitivity : default_motion_sensitivity;
|
||||||
Settings::values.mouse_panning_y_sensitivity.GetValue()) /
|
|
||||||
2.0f * default_motion_sensitivity;
|
|
||||||
|
|
||||||
const float rotation_velocity = std::sqrt(last_motion_change.x * last_motion_change.x +
|
const float rotation_velocity = std::sqrt(last_motion_change.x * last_motion_change.x +
|
||||||
last_motion_change.y * last_motion_change.y);
|
last_motion_change.y * last_motion_change.y);
|
||||||
|
|
||||||
|
// Clamp rotation speed
|
||||||
if (rotation_velocity > maximum_rotation_speed / sensitivity) {
|
if (rotation_velocity > maximum_rotation_speed / sensitivity) {
|
||||||
const float multiplier = maximum_rotation_speed / rotation_velocity / sensitivity;
|
const float multiplier = maximum_rotation_speed / rotation_velocity / sensitivity;
|
||||||
last_motion_change.x = last_motion_change.x * multiplier;
|
last_motion_change.x = last_motion_change.x * multiplier;
|
||||||
|
@ -144,7 +134,7 @@ void Mouse::UpdateMotionInput() {
|
||||||
.delta_timestamp = update_time * 1000,
|
.delta_timestamp = update_time * 1000,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Settings::values.mouse_panning) {
|
if (IsMousePanningEnabled()) {
|
||||||
last_motion_change.x = 0;
|
last_motion_change.x = 0;
|
||||||
last_motion_change.y = 0;
|
last_motion_change.y = 0;
|
||||||
}
|
}
|
||||||
|
@ -154,33 +144,42 @@ void Mouse::UpdateMotionInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse::Move(int x, int y, int center_x, int center_y) {
|
void Mouse::Move(int x, int y, int center_x, int center_y) {
|
||||||
if (Settings::values.mouse_panning) {
|
if (IsMousePanningEnabled()) {
|
||||||
const auto mouse_change =
|
const auto mouse_change =
|
||||||
(Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>();
|
(Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast<float>();
|
||||||
const float x_sensitivity =
|
const float x_sensitivity =
|
||||||
Settings::values.mouse_panning_x_sensitivity.GetValue() * default_stick_sensitivity;
|
Settings::values.mouse_panning_x_sensitivity.GetValue() * default_panning_sensitivity;
|
||||||
const float y_sensitivity =
|
const float y_sensitivity =
|
||||||
Settings::values.mouse_panning_y_sensitivity.GetValue() * default_stick_sensitivity;
|
Settings::values.mouse_panning_y_sensitivity.GetValue() * default_panning_sensitivity;
|
||||||
|
const float deadzone_counterweight =
|
||||||
|
Settings::values.mouse_panning_deadzone_counterweight.GetValue() *
|
||||||
|
default_deadzone_counterweight;
|
||||||
|
|
||||||
last_motion_change += {-mouse_change.y, -mouse_change.x, 0};
|
last_motion_change += {-mouse_change.y * x_sensitivity, -mouse_change.x * y_sensitivity, 0};
|
||||||
last_mouse_change.x += mouse_change.x * x_sensitivity * 0.09f;
|
last_mouse_change.x += mouse_change.x * x_sensitivity;
|
||||||
last_mouse_change.y += mouse_change.y * y_sensitivity * 0.09f;
|
last_mouse_change.y += mouse_change.y * y_sensitivity;
|
||||||
|
|
||||||
|
// Bind the mouse change to [0 <= deadzone_counterweight <= 1.0]
|
||||||
|
if (last_mouse_change.Length() < deadzone_counterweight) {
|
||||||
|
last_mouse_change /= last_mouse_change.Length();
|
||||||
|
last_mouse_change *= deadzone_counterweight;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button_pressed) {
|
if (button_pressed) {
|
||||||
const auto mouse_move = Common::MakeVec<int>(x, y) - mouse_origin;
|
const auto mouse_move = Common::MakeVec<int>(x, y) - mouse_origin;
|
||||||
const float x_sensitivity = Settings::values.mouse_panning_x_sensitivity.GetValue();
|
const float x_sensitivity =
|
||||||
const float y_sensitivity = Settings::values.mouse_panning_y_sensitivity.GetValue();
|
Settings::values.mouse_panning_x_sensitivity.GetValue() * default_stick_sensitivity;
|
||||||
SetAxis(identifier, mouse_axis_x,
|
const float y_sensitivity =
|
||||||
static_cast<float>(mouse_move.x) * x_sensitivity * 0.0012f);
|
Settings::values.mouse_panning_y_sensitivity.GetValue() * default_stick_sensitivity;
|
||||||
SetAxis(identifier, mouse_axis_y,
|
SetAxis(identifier, mouse_axis_x, static_cast<float>(mouse_move.x) * x_sensitivity);
|
||||||
static_cast<float>(-mouse_move.y) * y_sensitivity * 0.0012f);
|
SetAxis(identifier, mouse_axis_y, static_cast<float>(-mouse_move.y) * y_sensitivity);
|
||||||
|
|
||||||
last_motion_change = {
|
last_motion_change = {
|
||||||
static_cast<float>(-mouse_move.y) / 50.0f,
|
static_cast<float>(-mouse_move.y) * x_sensitivity,
|
||||||
static_cast<float>(-mouse_move.x) / 50.0f,
|
static_cast<float>(-mouse_move.x) * y_sensitivity,
|
||||||
last_motion_change.z,
|
last_motion_change.z,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -220,7 +219,7 @@ void Mouse::ReleaseButton(MouseButton button) {
|
||||||
SetButton(real_mouse_identifier, static_cast<int>(button), false);
|
SetButton(real_mouse_identifier, static_cast<int>(button), false);
|
||||||
SetButton(touch_identifier, static_cast<int>(button), false);
|
SetButton(touch_identifier, static_cast<int>(button), false);
|
||||||
|
|
||||||
if (!Settings::values.mouse_panning) {
|
if (!IsMousePanningEnabled()) {
|
||||||
SetAxis(identifier, mouse_axis_x, 0);
|
SetAxis(identifier, mouse_axis_x, 0);
|
||||||
SetAxis(identifier, mouse_axis_y, 0);
|
SetAxis(identifier, mouse_axis_y, 0);
|
||||||
}
|
}
|
||||||
|
@ -234,7 +233,7 @@ void Mouse::ReleaseButton(MouseButton button) {
|
||||||
void Mouse::MouseWheelChange(int x, int y) {
|
void Mouse::MouseWheelChange(int x, int y) {
|
||||||
wheel_position.x += x;
|
wheel_position.x += x;
|
||||||
wheel_position.y += y;
|
wheel_position.y += y;
|
||||||
last_motion_change.z += static_cast<f32>(y) / 100.0f;
|
last_motion_change.z += static_cast<f32>(y);
|
||||||
SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x));
|
SetAxis(identifier, wheel_axis_x, static_cast<f32>(wheel_position.x));
|
||||||
SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y));
|
SetAxis(identifier, wheel_axis_y, static_cast<f32>(wheel_position.y));
|
||||||
}
|
}
|
||||||
|
@ -244,6 +243,11 @@ void Mouse::ReleaseAllButtons() {
|
||||||
button_pressed = false;
|
button_pressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Mouse::IsMousePanningEnabled() {
|
||||||
|
// Disable mouse panning when a real mouse is connected
|
||||||
|
return Settings::values.mouse_panning && !Settings::values.mouse_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<Common::ParamPackage> Mouse::GetInputDevices() const {
|
std::vector<Common::ParamPackage> Mouse::GetInputDevices() const {
|
||||||
std::vector<Common::ParamPackage> devices;
|
std::vector<Common::ParamPackage> devices;
|
||||||
devices.emplace_back(Common::ParamPackage{
|
devices.emplace_back(Common::ParamPackage{
|
||||||
|
|
|
@ -99,6 +99,8 @@ private:
|
||||||
void UpdateStickInput();
|
void UpdateStickInput();
|
||||||
void UpdateMotionInput();
|
void UpdateMotionInput();
|
||||||
|
|
||||||
|
bool IsMousePanningEnabled();
|
||||||
|
|
||||||
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
|
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;
|
||||||
|
|
||||||
Common::Vec2<int> mouse_origin;
|
Common::Vec2<int> mouse_origin;
|
||||||
|
|
|
@ -503,8 +503,7 @@ void Config::ReadMousePanningValues() {
|
||||||
ReadBasicSetting(Settings::values.mouse_panning);
|
ReadBasicSetting(Settings::values.mouse_panning);
|
||||||
ReadBasicSetting(Settings::values.mouse_panning_x_sensitivity);
|
ReadBasicSetting(Settings::values.mouse_panning_x_sensitivity);
|
||||||
ReadBasicSetting(Settings::values.mouse_panning_y_sensitivity);
|
ReadBasicSetting(Settings::values.mouse_panning_y_sensitivity);
|
||||||
ReadBasicSetting(Settings::values.mouse_panning_deadzone_x_counterweight);
|
ReadBasicSetting(Settings::values.mouse_panning_deadzone_counterweight);
|
||||||
ReadBasicSetting(Settings::values.mouse_panning_deadzone_y_counterweight);
|
|
||||||
ReadBasicSetting(Settings::values.mouse_panning_decay_strength);
|
ReadBasicSetting(Settings::values.mouse_panning_decay_strength);
|
||||||
ReadBasicSetting(Settings::values.mouse_panning_min_decay);
|
ReadBasicSetting(Settings::values.mouse_panning_min_decay);
|
||||||
}
|
}
|
||||||
|
@ -1122,8 +1121,7 @@ void Config::SaveMousePanningValues() {
|
||||||
// Don't overwrite values.mouse_panning
|
// Don't overwrite values.mouse_panning
|
||||||
WriteBasicSetting(Settings::values.mouse_panning_x_sensitivity);
|
WriteBasicSetting(Settings::values.mouse_panning_x_sensitivity);
|
||||||
WriteBasicSetting(Settings::values.mouse_panning_y_sensitivity);
|
WriteBasicSetting(Settings::values.mouse_panning_y_sensitivity);
|
||||||
WriteBasicSetting(Settings::values.mouse_panning_deadzone_x_counterweight);
|
WriteBasicSetting(Settings::values.mouse_panning_deadzone_counterweight);
|
||||||
WriteBasicSetting(Settings::values.mouse_panning_deadzone_y_counterweight);
|
|
||||||
WriteBasicSetting(Settings::values.mouse_panning_decay_strength);
|
WriteBasicSetting(Settings::values.mouse_panning_decay_strength);
|
||||||
WriteBasicSetting(Settings::values.mouse_panning_min_decay);
|
WriteBasicSetting(Settings::values.mouse_panning_min_decay);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3105,21 +3105,6 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="mousePanningButton">
|
<widget class="QPushButton" name="mousePanningButton">
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>68</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>68</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">min-width: 68px;</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Configure</string>
|
<string>Configure</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "ui_configure_mouse_panning.h"
|
#include "ui_configure_mouse_panning.h"
|
||||||
|
@ -27,31 +28,34 @@ void ConfigureMousePanning::SetConfiguration(float right_stick_deadzone, float r
|
||||||
ui->enable->setChecked(Settings::values.mouse_panning.GetValue());
|
ui->enable->setChecked(Settings::values.mouse_panning.GetValue());
|
||||||
ui->x_sensitivity->setValue(Settings::values.mouse_panning_x_sensitivity.GetValue());
|
ui->x_sensitivity->setValue(Settings::values.mouse_panning_x_sensitivity.GetValue());
|
||||||
ui->y_sensitivity->setValue(Settings::values.mouse_panning_y_sensitivity.GetValue());
|
ui->y_sensitivity->setValue(Settings::values.mouse_panning_y_sensitivity.GetValue());
|
||||||
ui->deadzone_x_counterweight->setValue(
|
ui->deadzone_counterweight->setValue(
|
||||||
Settings::values.mouse_panning_deadzone_x_counterweight.GetValue());
|
Settings::values.mouse_panning_deadzone_counterweight.GetValue());
|
||||||
ui->deadzone_y_counterweight->setValue(
|
|
||||||
Settings::values.mouse_panning_deadzone_y_counterweight.GetValue());
|
|
||||||
ui->decay_strength->setValue(Settings::values.mouse_panning_decay_strength.GetValue());
|
ui->decay_strength->setValue(Settings::values.mouse_panning_decay_strength.GetValue());
|
||||||
ui->min_decay->setValue(Settings::values.mouse_panning_min_decay.GetValue());
|
ui->min_decay->setValue(Settings::values.mouse_panning_min_decay.GetValue());
|
||||||
|
|
||||||
if (right_stick_deadzone > 0.0f || right_stick_range != 1.0f) {
|
if (right_stick_deadzone > 0.0f || right_stick_range != 1.0f) {
|
||||||
ui->warning_label->setText(QString::fromStdString(
|
const QString right_stick_deadzone_str =
|
||||||
"Mouse panning works better with a deadzone of 0% and a range of 100%.\n"
|
QString::fromStdString(std::to_string(static_cast<int>(right_stick_deadzone * 100.0f)));
|
||||||
"Current values are " +
|
const QString right_stick_range_str =
|
||||||
std::to_string(static_cast<int>(right_stick_deadzone * 100.0f)) + "% and " +
|
QString::fromStdString(std::to_string(static_cast<int>(right_stick_range * 100.0f)));
|
||||||
std::to_string(static_cast<int>(right_stick_range * 100.0f)) + "% respectively."));
|
|
||||||
} else {
|
ui->warning_label->setText(
|
||||||
ui->warning_label->hide();
|
tr("Mouse panning works better with a deadzone of 0% and a range of 100%.\nCurrent "
|
||||||
|
"values are %1% and %2% respectively.")
|
||||||
|
.arg(right_stick_deadzone_str, right_stick_range_str));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Settings::values.mouse_enabled) {
|
||||||
|
ui->warning_label->setText(
|
||||||
|
tr("Emulated mouse is enabled. This is incompatible with mouse panning."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureMousePanning::SetDefaultConfiguration() {
|
void ConfigureMousePanning::SetDefaultConfiguration() {
|
||||||
ui->x_sensitivity->setValue(Settings::values.mouse_panning_x_sensitivity.GetDefault());
|
ui->x_sensitivity->setValue(Settings::values.mouse_panning_x_sensitivity.GetDefault());
|
||||||
ui->y_sensitivity->setValue(Settings::values.mouse_panning_y_sensitivity.GetDefault());
|
ui->y_sensitivity->setValue(Settings::values.mouse_panning_y_sensitivity.GetDefault());
|
||||||
ui->deadzone_x_counterweight->setValue(
|
ui->deadzone_counterweight->setValue(
|
||||||
Settings::values.mouse_panning_deadzone_x_counterweight.GetDefault());
|
Settings::values.mouse_panning_deadzone_counterweight.GetDefault());
|
||||||
ui->deadzone_y_counterweight->setValue(
|
|
||||||
Settings::values.mouse_panning_deadzone_y_counterweight.GetDefault());
|
|
||||||
ui->decay_strength->setValue(Settings::values.mouse_panning_decay_strength.GetDefault());
|
ui->decay_strength->setValue(Settings::values.mouse_panning_decay_strength.GetDefault());
|
||||||
ui->min_decay->setValue(Settings::values.mouse_panning_min_decay.GetDefault());
|
ui->min_decay->setValue(Settings::values.mouse_panning_min_decay.GetDefault());
|
||||||
}
|
}
|
||||||
|
@ -68,12 +72,19 @@ void ConfigureMousePanning::ApplyConfiguration() {
|
||||||
Settings::values.mouse_panning = ui->enable->isChecked();
|
Settings::values.mouse_panning = ui->enable->isChecked();
|
||||||
Settings::values.mouse_panning_x_sensitivity = static_cast<float>(ui->x_sensitivity->value());
|
Settings::values.mouse_panning_x_sensitivity = static_cast<float>(ui->x_sensitivity->value());
|
||||||
Settings::values.mouse_panning_y_sensitivity = static_cast<float>(ui->y_sensitivity->value());
|
Settings::values.mouse_panning_y_sensitivity = static_cast<float>(ui->y_sensitivity->value());
|
||||||
Settings::values.mouse_panning_deadzone_x_counterweight =
|
Settings::values.mouse_panning_deadzone_counterweight =
|
||||||
static_cast<float>(ui->deadzone_x_counterweight->value());
|
static_cast<float>(ui->deadzone_counterweight->value());
|
||||||
Settings::values.mouse_panning_deadzone_y_counterweight =
|
|
||||||
static_cast<float>(ui->deadzone_y_counterweight->value());
|
|
||||||
Settings::values.mouse_panning_decay_strength = static_cast<float>(ui->decay_strength->value());
|
Settings::values.mouse_panning_decay_strength = static_cast<float>(ui->decay_strength->value());
|
||||||
Settings::values.mouse_panning_min_decay = static_cast<float>(ui->min_decay->value());
|
Settings::values.mouse_panning_min_decay = static_cast<float>(ui->min_decay->value());
|
||||||
|
|
||||||
|
if (Settings::values.mouse_enabled && Settings::values.mouse_panning) {
|
||||||
|
Settings::values.mouse_panning = false;
|
||||||
|
QMessageBox::critical(
|
||||||
|
this, tr("Emulated mouse is enabled"),
|
||||||
|
tr("Real mouse input and mouse panning are incompatible. Please disable the "
|
||||||
|
"emulated mouse in input advanced settings to allow mouse panning."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="enable">
|
<widget class="QCheckBox" name="enable">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable</string>
|
<string>Enable mouse panning</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Can be toggled via a hotkey</string>
|
<string>Can be toggled via a hotkey. Default hotkey is Ctrl + F9</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -89,40 +89,14 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="deadzone_x_counterweight_label">
|
<widget class="QLabel" name="deadzone_counterweight_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Horizontal</string>
|
<string>Deadzone</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="deadzone_x_counterweight">
|
<widget class="QSpinBox" name="deadzone_counterweight">
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="suffix">
|
|
||||||
<string>%</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="deadzone_y_counterweight_label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Vertical</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QSpinBox" name="deadzone_y_counterweight">
|
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in New Issue