Skip to content

Commit

Permalink
Map Tools - Fix drawing straight lines (#10635)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrschick authored Jan 13, 2025
1 parent 1d64afb commit c671bb6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions addons/maptools/XEH_postInitClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if (!hasInterface) exitWith {};
// Init variables
GVAR(mapGpsShow) = true;
GVAR(mapGpsNextUpdate) = -1;
GVAR(lastDrawnLine) = "";

GVAR(mapTool_Shown) = 0;
GVAR(mapTool_pos) = [0, 0];
Expand Down Expand Up @@ -47,6 +48,12 @@ GVAR(plottingBoard_markers) = createHashMap;

addMissionEventHandler ["MarkerCreated", {
[_this, false] call FUNC(handlePlottingBoardMarkers);

// Cache last user-drawn polyline marker
private _marker = _this select 0;
if ((markerPolyline _marker) isNotEqualTo []) then {
GVAR(lastDrawnLine) = _marker;
};
}];

addMissionEventHandler ["MarkerDeleted", {
Expand Down
2 changes: 1 addition & 1 deletion addons/maptools/functions/fnc_handleMouseButton.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if ((_button == 0) && {GVAR(freedrawing) || _ctrlKey}) exitWith {

if (_allMarkers isEqualTo []) exitWith {};

private _markerName = _allMarkers select -1;
private _markerName = GVAR(lastDrawnLine);
private _markerPos = getMarkerPos _markerName;
private _distanceCheck = _markerPos distance2D GVAR(drawPosStart);

Expand Down

0 comments on commit c671bb6

Please sign in to comment.