maptools - Improve behaviour upon first open (show under mouse position instead of bottom-left corner) (#8848)

* open map tools in center of screen upon first open

Don't show the map tools at the bottom-left corner of the map when you first open it, but right where your mouse is.

* always move to mouse position when opened (not just once)

incorporated feedback from co-authors

Co-Authored-By: Drofseh <Drofseh@users.noreply.github.com>
Co-Authored-By: PabstMirror <pabstmirror@gmail.com>

* replace tabs by 4x whitespaces in order for checks to complete successfully

* move code to fnc_updateMapToolMarkers so it always runs

Co-authored-by: Drofseh <Drofseh@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
b-mayr-1984 2022-04-06 23:49:27 +02:00 committed by GitHub
parent d135371319
commit 020cf2ddd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -32,14 +32,14 @@ class CfgVehicles {
class ACE_MapToolsShowNormal {
displayName = CSTRING(MapToolsShowNormal);
condition = QUOTE(GVAR(mapTool_Shown) != 1);
statement = QUOTE(GVAR(mapTool_Shown) = 1;);
statement = QUOTE(if (GVAR(mapTool_Shown) == 0) then {GVAR(mapTool_moveToMouse) = true}; GVAR(mapTool_Shown) = 1;);
exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"};
showDisabled = 1;
};
class ACE_MapToolsShowSmall {
displayName = CSTRING(MapToolsShowSmall);
condition = QUOTE(GVAR(mapTool_Shown) != 2);
statement = QUOTE(GVAR(mapTool_Shown) = 2;);
statement = QUOTE(if (GVAR(mapTool_Shown) == 0) then {GVAR(mapTool_moveToMouse) = true}; GVAR(mapTool_Shown) = 2;);
exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"};
showDisabled = 1;
};

View File

@ -13,6 +13,7 @@ GVAR(mapTool_pos) = [0,0];
GVAR(mapTool_angle) = 0;
GVAR(mapTool_isDragging) = false;
GVAR(mapTool_isRotating) = false;
GVAR(mapTool_moveToMouse) = true; // used to display it in center of screen when opened
//Install the event handers for the map tools on the main in-game map
[{!isNull findDisplay 12},

View File

@ -19,6 +19,13 @@ params ["_theMap"];
if ((GVAR(mapTool_Shown) == 0) || {!("ACE_MapTools" in (ACE_player call EFUNC(common,uniqueItems)))}) exitWith {};
// open map tools in center of screen when toggled to be shown
if (GVAR(mapTool_moveToMouse)) then {
private _mousePosition = _theMap ctrlMapScreenToWorld getMousePosition;
GVAR(mapTool_pos) = _mousePosition;
GVAR(mapTool_moveToMouse) = false; // we only need to do this once after opening the map tool
};
private _rotatingTexture = "";
private _textureWidth = 0;
if (GVAR(mapTool_Shown) == 1) then {