mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Improve unit switching UX
This commit is contained in:
parent
458fe363ff
commit
20f05d9906
@ -146,9 +146,9 @@ class GVAR(overlay) {
|
|||||||
class unitTree: RscTree {
|
class unitTree: RscTree {
|
||||||
idc = IDC_TREE;
|
idc = IDC_TREE;
|
||||||
x = safeZoneX;
|
x = safeZoneX;
|
||||||
y = safezoneY + TOOL_H;
|
y = safezoneY + TOOL_H * 2;
|
||||||
w = TOOL_W * 2;
|
w = TOOL_W * 2;
|
||||||
h = safeZoneH - TOOL_H;
|
h = safeZoneH - TOOL_H * 4;
|
||||||
borderSize = 1;
|
borderSize = 1;
|
||||||
colorBorder[] = {1,1,1,1};
|
colorBorder[] = {1,1,1,1};
|
||||||
colorBackground[] = {0.1,0.1,0.1,0.8};
|
colorBackground[] = {0.1,0.1,0.1,0.8};
|
||||||
@ -161,7 +161,6 @@ class GVAR(overlay) {
|
|||||||
multiselectEnabled = 0;
|
multiselectEnabled = 0;
|
||||||
maxHistoryDelay = 1;
|
maxHistoryDelay = 1;
|
||||||
onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface));
|
onTreeDblClick = QUOTE([ARR_2('onTreeDblClick',_this)] call FUNC(handleInterface));
|
||||||
onTreeSelChanged = QUOTE([ARR_2('onTreeSelChanged',_this)] call FUNC(handleInterface));
|
|
||||||
};
|
};
|
||||||
class spectatorMap: RscMapControl {
|
class spectatorMap: RscMapControl {
|
||||||
idc = IDC_MAP;
|
idc = IDC_MAP;
|
||||||
|
@ -278,30 +278,20 @@ switch (toLower _mode) do {
|
|||||||
};
|
};
|
||||||
// Tree events
|
// Tree events
|
||||||
case "ontreedblclick": {
|
case "ontreedblclick": {
|
||||||
if (GVAR(camMode) != 0) then {
|
// Update camera view when listbox unit is double clicked on
|
||||||
private ["_sel","_netID"];
|
private ["_sel","_netID"];
|
||||||
_sel = _args select 1;
|
_sel = _args select 1;
|
||||||
|
|
||||||
// Ensure a unit was selected
|
// Ensure a unit was selected
|
||||||
if (count _sel == 2) then {
|
if (count _sel == 2) then {
|
||||||
_netID = (_args select 0) tvData _sel;
|
_netID = (_args select 0) tvData _sel;
|
||||||
GVAR(camUnit) = objectFromNetId _netID;
|
GVAR(camUnit) = objectFromNetId _netID;
|
||||||
};
|
|
||||||
} else {
|
|
||||||
GVAR(camMode) = 1;
|
|
||||||
};
|
|
||||||
call FUNC(updateView);
|
|
||||||
};
|
|
||||||
case "ontreeselchanged": {
|
|
||||||
if (GVAR(camMode) == 0) then {
|
|
||||||
private ["_sel","_netID"];
|
|
||||||
_sel = _args select 1;
|
|
||||||
|
|
||||||
// Ensure a unit was selected
|
// Only update camera mode when in free cam
|
||||||
if (count _sel == 2) then {
|
if (GVAR(camMode) == 0) then {
|
||||||
_netID = (_args select 0) tvData _sel;
|
GVAR(camMode) = 1;
|
||||||
GVAR(camUnit) = objectFromNetId _netID;
|
|
||||||
};
|
};
|
||||||
|
call FUNC(updateView);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -27,6 +27,9 @@ disableSerialization;
|
|||||||
_display = GETUVAR(GVAR(display),displayNull);
|
_display = GETUVAR(GVAR(display),displayNull);
|
||||||
_ctrl = _display displayCtrl IDC_TREE;
|
_ctrl = _display displayCtrl IDC_TREE;
|
||||||
|
|
||||||
|
// Cache current selection
|
||||||
|
_curSelData = _ctrl tvData (tvCurSel _ctrl);
|
||||||
|
|
||||||
// Clear the tree
|
// Clear the tree
|
||||||
_ctrl tvDelete [];
|
_ctrl tvDelete [];
|
||||||
|
|
||||||
@ -53,6 +56,11 @@ _cachedGrps = [];
|
|||||||
_ctrl tvAdd [[_node], name _x];
|
_ctrl tvAdd [[_node], name _x];
|
||||||
_ctrl tvSetData [[_node,_index], netID _x];
|
_ctrl tvSetData [[_node,_index], netID _x];
|
||||||
|
|
||||||
|
// Preserve the previous selection
|
||||||
|
if (_curSelData == (_ctrl tvData [_node,_index])) then {
|
||||||
|
_ctrl tvSetCurSel [_node,_index];
|
||||||
|
};
|
||||||
|
|
||||||
_ctrl tvSort [[_node],false];
|
_ctrl tvSort [[_node],false];
|
||||||
} forEach GVAR(unitList);
|
} forEach GVAR(unitList);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user