Add Mouse drag to options
Allow to modify pixel distance when mouse input is detected as drag e.g. for selection box. Differential revision: D4624 Refs: #6506 Comments by: @vladislavbelow @Freagarach Tested by: @psypherium This was SVN commit r26843.
This commit is contained in:
parent
59fdc5e591
commit
d0b2168879
@ -421,6 +421,7 @@ settingsslide = true ; Enable/Disable settings panel slide
|
||||
progressdescription = false ; Whether to display the progress percent or a textual description
|
||||
|
||||
[gui.session]
|
||||
dragdelta = 4 ; Number of pixels the mouse can move before the action is considered a drag
|
||||
camerajump.threshold = 40 ; How close do we have to be to the actual location in order to jump back to the previous one?
|
||||
timeelapsedcounter = false ; Show the game duration in the top right corner
|
||||
ceasefirecounter = false ; Show the remaining ceasefire time in the top right corner
|
||||
|
@ -168,6 +168,14 @@
|
||||
{ "value": 2.25, "label": "225%" },
|
||||
{ "value": 2.50, "label": "250%" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"label": "Mouse drag",
|
||||
"tooltip": "Number of pixels the mouse can move before the action is considered a drag.",
|
||||
"config": "gui.session.dragdelta",
|
||||
"min": "1",
|
||||
"max": "200"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -64,11 +64,6 @@ const g_FreehandSelection_MinLengthOfLine = 8;
|
||||
*/
|
||||
const g_FreehandSelection_MinNumberOfUnits = 2;
|
||||
|
||||
/**
|
||||
* Number of pixels the mouse can move before the action is considered a drag.
|
||||
*/
|
||||
const g_MaxDragDelta = 4;
|
||||
|
||||
/**
|
||||
* Used for remembering mouse coordinates at start of drag operations.
|
||||
*/
|
||||
@ -96,6 +91,11 @@ const doublePressTime = 500;
|
||||
var doublePressTimer = 0;
|
||||
var prevHotkey = 0;
|
||||
|
||||
function getMaxDragDelta()
|
||||
{
|
||||
return Engine.ConfigDB_GetValue("user", "gui.session.dragdelta"));
|
||||
}
|
||||
|
||||
function updateCursorAndTooltip()
|
||||
{
|
||||
let cursorSet = false;
|
||||
@ -580,8 +580,7 @@ function handleInputBeforeGui(ev, hoveredObject)
|
||||
case "mousemotion":
|
||||
// If the mouse moved far enough from the original click location,
|
||||
// then switch to drag-orientation mode.
|
||||
let maxDragDelta = 16;
|
||||
if (g_DragStart.distanceTo(ev) >= maxDragDelta)
|
||||
if (g_DragStart.distanceTo(ev) >= Math.square(getMaxDragDelta()))
|
||||
{
|
||||
inputState = INPUT_BUILDING_DRAG;
|
||||
return false;
|
||||
@ -720,8 +719,7 @@ function handleInputBeforeGui(ev, hoveredObject)
|
||||
switch (ev.type)
|
||||
{
|
||||
case "mousemotion":
|
||||
let maxDragDelta = 16;
|
||||
if (g_DragStart.distanceTo(ev) >= maxDragDelta)
|
||||
if (g_DragStart.distanceTo(ev) >= Math.square(getMaxDragDelta()))
|
||||
// Rotate in the direction of the cursor.
|
||||
placementSupport.angle = placementSupport.position.horizAngleTo(Engine.GetTerrainAtScreenPoint(ev.x, ev.y));
|
||||
else
|
||||
@ -922,7 +920,7 @@ function handleInputAfterGui(ev)
|
||||
switch (ev.type)
|
||||
{
|
||||
case "mousemotion":
|
||||
if (g_DragStart.distanceTo(ev) >= g_MaxDragDelta)
|
||||
if (g_DragStart.distanceTo(ev) >= getMaxDragDelta())
|
||||
{
|
||||
inputState = INPUT_BANDBOXING;
|
||||
return false;
|
||||
@ -1005,7 +1003,7 @@ function handleInputAfterGui(ev)
|
||||
switch (ev.type)
|
||||
{
|
||||
case "mousemotion":
|
||||
if (g_DragStart.distanceToSquared(ev) >= Math.square(g_MaxDragDelta))
|
||||
if (g_DragStart.distanceToSquared(ev) >= Math.square(getMaxDragDelta()))
|
||||
{
|
||||
inputState = INPUT_UNIT_POSITION;
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user