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

Map Tools - Use polyline marker for straight lines #9174

Merged
merged 1 commit into from
Apr 3, 2023
Merged
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
15 changes: 4 additions & 11 deletions addons/maptools/functions/fnc_handleMouseButton.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,11 @@ if ((_button == 0) && {GVAR(freedrawing) || _ctrlKey}) exitWith {
if ((count GVAR(freeDrawingData)) != 3) exitWith {TRACE_1("never touched roamer",GVAR(freeDrawingData));};

GVAR(freeDrawingData) params ["", "_startStraightPos", "_endStraightPos"];
_startStraightPos set [2, 0];
_endStraightPos set [2, 0];

// Convert marker to rectangle and change it's pos/size/dir
_markerName setMarkerShape "RECTANGLE";

private _difPos = _endStraightPos vectorDiff _startStraightPos;
private _mag = vectorMagnitude _difPos;
_markerName setMarkerPos (_startStraightPos vectorAdd (_difPos vectorMultiply 0.5));
_markerName setMarkerSize [10, _mag / 2];
_markerName setMarkerDir (_difPos call CBA_fnc_vectDir);

_markerName setMarkerPolyline [
_startStraightPos#0, _startStraightPos#1,
_endStraightPos#0, _endStraightPos#1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still ugly as fuck 5 years later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_endStraightPos#0, _endStraightPos#1
_endStraightPos # 0, _endStraightPos # 1

is a little easier to read imho

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree 🤷🏻

];
}, []] call CBA_fnc_execNextFrame;
} else {
if (_ctrlKey && {_dir == 1}) then {
Expand Down