Skip to content

Commit

Permalink
Add ability to invert panning direction with middle mouse button (FAF…
Browse files Browse the repository at this point in the history
…orever#4578)

Adds option to invert panning with (the middle) mouse (button)

---------

Co-authored-by: lL1l1 <[email protected]>
Co-authored-by: Josh <[email protected]>
  • Loading branch information
3 people authored Jun 20, 2024
1 parent 45ec57e commit ab6c647
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog/snippets/features.4578.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- (#5249) New Invert Panning of the camera

Adds option to invert panning with (the middle) mouse (button)
5 changes: 5 additions & 0 deletions engine/User.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,11 @@ end
function SetVolume(category, volume)
end

--- If set, inverts the middle mouse button
---@param flag boolean
function SetInvertMidMouseButton(flag)
end

--- Performs a callback with the given identifier from `callback.Func` in `/lua/simcallbacks.lua`.
--- Optionally appends the unit selection to the arguments.
---@param callback SimCallback where `Func` represents the callback function and `Args` is additional data
Expand Down
25 changes: 22 additions & 3 deletions lua/options/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,25 @@ options = {
key = '',
},

{
title = "<LOC INVERT_MOUSE_PAN>Invert pan direction with middle mouse button",
key = 'invert_middle_mouse_button',
type = 'toggle',
default = 0,
update = function(control,value)
SetInvertMidMouseButton(value == 1)
end,
set = function(key,value,startup)
SetInvertMidMouseButton(value == 1)
end,
custom = {
states = {
{text = "<LOC _Off>", key = 0},
{text = "<LOC _On>", key = 1},
},
},
},

{
title = "<LOC OPTIONS_0158>Screen Edge Pans Main View",
key = 'screen_edge_pans_main_view',
Expand Down Expand Up @@ -217,9 +236,9 @@ options = {
ConExecute("ui_KeyboardPanSpeed " .. tostring(value))
end,
custom = {
min = 1,
max = 200,
inc = 0,
min = 10,
max = 400,
inc = 10,
},
},
{
Expand Down

0 comments on commit ab6c647

Please sign in to comment.