Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MicroDAGR - Select newly created WP in List #10457

Merged
merged 7 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/microdagr/XEH_clientInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ GVAR(settingShowAllWaypointsOnMap) = true;
GVAR(newWaypointPosition) = [];
GVAR(currentWaypoint) = -1;
GVAR(rangeFinderPositionASL) = [];
GVAR(prevWaypointsCount) = 0;

GVAR(mgrsGridZoneDesignator) = format ["%1 %2",EGVAR(common,MGRS_data) select 0, EGVAR(common,MGRS_data) select 1];
4 changes: 2 additions & 2 deletions addons/microdagr/functions/fnc_saveCurrentAndSetNewMode.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private _display = uiNamespace getVariable [[QGVAR(RscTitleDisplay), QGVAR(Dialo

if (isNull _display) exitWith {LOG("No Display");};

if (GVAR(currentApplicationPage) == 2) then {
if (GVAR(currentApplicationPage) == APP_MODE_MAP) then {
private _theMap = [_display displayCtrl IDC_MAPDETAILS, _display displayCtrl IDC_MAPPLAIN] select (!GVAR(mapShowTexture));
private _mapCtrlPos = ctrlPosition _theMap;

Expand All @@ -32,7 +32,7 @@ if (GVAR(currentApplicationPage) == 2) then {
GVAR(mapZoom) = (ctrlMapScale _theMap) * _mapSize;

//Hit button again, toggle map modes:
if (_newMode == 2) then {
if (_newMode == APP_MODE_MAP) then {
if (GVAR(mapShowTexture)) then {
GVAR(mapShowTexture) = false;
} else {
Expand Down
9 changes: 8 additions & 1 deletion addons/microdagr/functions/fnc_updateDisplay.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,20 @@ case (APP_MODE_WAYPOINTS): {
_wpListBox lbSetTextRight [_forEachIndex, (format ["%1km", _2dDistanceKm toFixed GVAR(waypointPrecision)])];
} forEach _waypoints;

_currentIndex = (_currentIndex max 0) min ((count _waypoints) - 1);
// Select last created waypoint
private _currWaypointsCount = count _waypoints;
if (_currWaypointsCount > (GVAR(prevWaypointsCount))) then {
_currentIndex = _currWaypointsCount - 1;
} else {
_currentIndex = (_currentIndex max 0) min (_currWaypointsCount - 1);
};
if ((lbCurSel _wpListBox) != _currentIndex) then {
_wpListBox lbSetCurSel _currentIndex;
};

//Reset focus to a dummy ctrl (top button), otherwise HOME/POS1 key goes to top of listBox and has keybind blocked
ctrlSetFocus (_display displayCtrl IDC_TOPMENUBUTTON);
GVAR(prevWaypointsCount) = _currWaypointsCount;
};

case (APP_MODE_SETUP): {
Expand Down