From c58ff8d31d17e66051e0f772a7a9fe7ae507cdbb Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 1 Jul 2015 00:13:55 -0500 Subject: [PATCH] #1736 - Allow moving map while shake effect active --- addons/map/XEH_postInitClient.sqf | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index a3f377544b..52c904b1ce 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -18,7 +18,30 @@ call FUNC(determineZoom); GVAR(lastStillTime) = ACE_time; GVAR(isShaking) = false; + //Allow panning the lastStillPosition while mapShake is active + GVAR(rightMouseButtonLastPos) = []; ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {[] call FUNC(updateMapEffects);}]; + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", { + if (GVAR(isShaking) && {(count GVAR(rightMouseButtonLastPos)) == 2}) then { + private["_lastPos", "_newPos"]; + _lastPos = (_this select 0) ctrlMapScreenToWorld GVAR(rightMouseButtonLastPos); + _newPos = (_this select 0) ctrlMapScreenToWorld (_this select [1,2]); + GVAR(lastStillPosition) set [0, (GVAR(lastStillPosition) select 0) + (_lastPos select 0) - (_newPos select 0)]; + GVAR(lastStillPosition) set [1, (GVAR(lastStillPosition) select 1) + (_lastPos select 1) - (_newPos select 1)]; + GVAR(rightMouseButtonLastPos) = _this select [1,2]; + TRACE_3("Mouse Move",_lastPos,_newPos,GVAR(rightMouseButtonLastPos)); + }; + }]; + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonDown", { + if ((_this select 1) == 1) then { + GVAR(rightMouseButtonLastPos) = _this select [2,2]; + }; + }]; + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonUp", { + if ((_this select 1) == 1) then { + GVAR(rightMouseButtonLastPos) = []; + }; + }]; }; ["SettingsInitialized", {