Skip to content

Commit

Permalink
Markers - Add direction/scale reset on Right Mouse Button (#8319)
Browse files Browse the repository at this point in the history
Co-authored-by: PabstMirror <[email protected]>
Co-authored-by: mharis001 <[email protected]>
Co-authored-by: jonpas <[email protected]>
  • Loading branch information
4 people authored Jul 23, 2021
1 parent 5e56885 commit d3ee39d
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,4 @@ zGuba
Fyuran <[email protected]>
dabako <[email protected]>
Frank <[email protected]>
10Dozen a.k.a Dusin
2 changes: 2 additions & 0 deletions addons/markers/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ PREP(onLBSelChangedChannel);
PREP(onLBSelChangedColor);
PREP(onLBSelChangedShape);
PREP(onSliderPosChangedAngle);
PREP(onSliderMouseButtonUpAngle);
PREP(onSliderPosChangedScale);
PREP(onSliderMouseButtonUpScale);
PREP(placeMarker);
PREP(sendMarkersJIP);
PREP(setMarkerJIP);
Expand Down
4 changes: 4 additions & 0 deletions addons/markers/functions/fnc_initInsertMarker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,12 @@

private _curSelAngle = GETGVAR(currentMarkerAngle,0);
_aceAngleSlider sliderSetPosition _curSelAngle;
_aceAngleSlider ctrlSetTooltip LLSTRING(MarkerDirectionScaleSlider_Tooltip);

//Update now and add eventHandler:
[_aceAngleSlider, _curSelAngle] call FUNC(onSliderPosChangedAngle);
_aceAngleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedAngle)}];
_aceAngleSlider ctrlAddEventHandler ["MouseButtonUp", {_this call FUNC(onSliderMouseButtonUpAngle)}];

////////////////////
// init marker scale slider
Expand All @@ -348,8 +350,10 @@

private _curSelScale = GETGVAR(currentMarkerScale,1);
_aceScaleSlider sliderSetPosition _curSelScale;
_aceScaleSlider ctrlSetTooltip LLSTRING(MarkerDirectionScaleSlider_Tooltip);

//Update now and add eventHandler:
[_aceScaleSlider, _curSelScale] call FUNC(onSliderPosChangedScale);
_aceScaleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedScale)}];
_aceScaleSlider ctrlAddEventHandler ["MouseButtonUp", {_this call FUNC(onSliderMouseButtonUpScale)}];
}, _this] call CBA_fnc_execNextFrame;
25 changes: 25 additions & 0 deletions addons/markers/functions/fnc_onSliderMouseButtonUpAngle.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "script_component.hpp"
/*
* Author: 10Dozen
* Angle slider clicked handler. Resets slider pos to 0 on RMB button up.
*
* Arguments:
* 0: Slider (idc 1210) is expected <CONTROL>
* 1: Button released (0 - Left mouse btn, 1 - Right mouse btn) <NUMBER>
*
* Return Value:
* None
*
* Example:
* [Slider, 1] call ace_markers_fnc_onSliderMouseButtonUpAngle
*
* Public: No
*/

params ["_aceAngleSlider", "_button"];
TRACE_2("params",_aceAngleSlider,_button);

if (_button isNotEqualTo 1) exitWith {};

_aceAngleSlider sliderSetPosition 0;
[_aceAngleSlider, 0] call FUNC(onSliderPosChangedAngle);
25 changes: 25 additions & 0 deletions addons/markers/functions/fnc_onSliderMouseButtonUpScale.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "script_component.hpp"
/*
* Author: 10Dozen
* Scale slider clicked handler. Resets slider pos to 1 on RMB button up.
*
* Arguments:
* 0: Slider (idc 1420) is expected <CONTROL>
* 1: Button released (0 - Left mouse btn, 1 - Right mouse btn) <NUMBER>
*
* Return Value:
* None
*
* Example:
* [Slider, 1] call ace_markers_fnc_onSliderMouseButtonUpScale
*
* Public: No
*/

params ["_aceScaleSlider", "_button"];
TRACE_2("params",_aceScaleSlider,_button);

if (_button isNotEqualTo 1) exitWith {};

_aceScaleSlider sliderSetPosition 1;
[_aceScaleSlider, 1] call FUNC(onSliderPosChangedScale);
4 changes: 4 additions & 0 deletions addons/markers/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
<Chinese>方位: %1°</Chinese>
<Turkish>Yön: %1°</Turkish>
</Key>
<Key ID="STR_ACE_Markers_MarkerDirectionScaleSlider_Tooltip">
<English>Click RMB to reset</English>
<Russian>Нажми ПКМ чтобы сбросить</Russian>
</Key>
<Key ID="STR_ACE_Markers_Module_DisplayName">
<English>Markers</English>
<German>Markierungen</German>
Expand Down

0 comments on commit d3ee39d

Please sign in to comment.