Skip to content

Commit

Permalink
open map tools in center of screen upon first open
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
b-mayr-1984 committed Mar 16, 2022
1 parent f85ed21 commit db30215
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/maptools/XEH_postInitClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ GVAR(mapTool_pos) = [0,0];
GVAR(mapTool_angle) = 0;
GVAR(mapTool_isDragging) = false;
GVAR(mapTool_isRotating) = false;
GVAR(mapTool_isFirstShown) = true; // used to display it in center of screen when first opened

//Install the event handers for the map tools on the main in-game map
[{!isNull findDisplay 12},
Expand Down
6 changes: 6 additions & 0 deletions addons/maptools/functions/fnc_handleMouseMove.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ if (GVAR(mapTool_Shown) == 0) exitWith {false};

private _mousePosition = _control ctrlMapScreenToWorld [_mousePosX, _mousePosY];

// open map tools in center of screen upon first open
if (GVAR(mapTool_isFirstShown)) then {
GVAR(mapTool_pos) = _mousePosition;
GVAR(mapTool_isFirstShown) = false; // we only need to do this once
};

// Translation
if (GVAR(mapTool_isDragging)) exitWith {
GVAR(mapTool_pos) set [0, (GVAR(mapTool_startPos) select 0) + (_mousePosition select 0) - (GVAR(mapTool_startDragPos) select 0)];
Expand Down

0 comments on commit db30215

Please sign in to comment.