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

Draw Straight Lines with maptool #4410

Merged
merged 4 commits into from
Oct 7, 2016
Merged

Draw Straight Lines with maptool #4410

merged 4 commits into from
Oct 7, 2016

Conversation

PabstMirror
Copy link
Contributor

Close #4153

As you draw lines, if you draw inside of the maptools it will snap your mouse outward to the edge.
As you draw on the edge it records the points on the line.
On finishing drawing, the polyline is converted into a rectangle.

Video has debug on it, the red dots are the corners of the map tools, blue dots are points on the line that we've draw on that are closest to the 2 corners.

https://www.youtube.com/watch?v=hXQbeKrAffg

2 downsides:
setMousePosition fails if resolution scaling is not 100% (keep cursor centered has same problem)
To delete you need to hover in the center of the line, it's somewhat forgiving but it is different than the normal poly lines.

Should be good, tagging wip as I still need to test in mp. Also very useful for clean tic tac toe boards.

@PabstMirror PabstMirror added status/WIP kind/feature Release Notes: **ADDED:** labels Sep 16, 2016
@PabstMirror PabstMirror added this to the 3.7.1 milestone Sep 16, 2016
@nicolasbadano
Copy link
Contributor

Brilliant

@jonpas
Copy link
Member

jonpas commented Sep 16, 2016

Looks great! Documentation update would be nice http://ace3mod.com/wiki/feature/maptools.html

@jonpas jonpas modified the milestones: 3.7.1, 3.8.0 Sep 18, 2016
@PabstMirror
Copy link
Contributor Author

Working good in mp tests.
Just like all markers in 1.66 they show the user who created it
(at the midpoint; same area as the were you need to hover to delete)
image

_pa = _a vectorDiff _p;
_c = _n vectorMultiply ((_pa vectorDotProduct _n) / (_n vectorDotProduct _n));
_d = _pa vectorDiff _c;
sqrt (_d vectorDotProduct _d);
Copy link
Contributor

Choose a reason for hiding this comment

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

private ?
might also want more descriptive variable names

@PabstMirror PabstMirror merged commit de1c4bc into master Oct 7, 2016
@PabstMirror PabstMirror deleted the drawStraightLines branch October 7, 2016 22:21
@JohnnyShootos
Copy link

Nice work! Any chance of extending this functionality to be able to draw circles or arcs?

@PabstMirror
Copy link
Contributor Author

As far as I know there are no commands to modify the new polyLine marker type;
which is what you get when free drawing.
Drawing straight lines was possible because we can just make it a rectangle marker.

But I don't know anyway to only draw parts of a arc;
or how we would implement the user drawing part of it.

@JohnnyShootos
Copy link

would there be a way to say lock the drawing cursor to the maptool when rotating the map tool to get a fixed radius from the center as the polyline is drawn?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Release Notes: **ADDED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: Bring straight Line Drawing back
5 participants