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

config, callback, drawing, main: add LINE and RECT tools, and arrowtype… #192

Conversation

pascal-niklaus
Copy link
Contributor

This adds a LINE and RECT option to draw straight lines and rectangles. Also, arrows can have heads at either or both ends, owing to the new arrowtype option which can be "<-" "->" or "<->".
Here is an example with the corresponding config file.

"red Pen" = PEN (size=5 color="red", arrowsize=2, arrowtype="<->");
"blue Pen" = RECT (color="cyan", size=2);
"yellow Pen" = LINE (color="yellow" size=2 arrowsize=2 arrowtype="->");
"green Marker" = PEN (size=6 color="green" arrowsize=1);

LINE_RECT_arrowtype_example

@bk138
Copy link
Owner

bk138 commented Feb 26, 2024

This looks exciting as it's an often requested feature (#67)! Can you split the PR into one for each tool and one for the arrow type? That'd be awesome!

@pascal-niklaus
Copy link
Contributor Author

This looks exciting as it's an often requested feature (#67)! Can you split the PR into one for each tool and one for the arrow type? That'd be awesome!

That is possible, but LINE and RECT are very related, since both use the same buffer of the original state (basically, at on_button_press a copy of back_buffer is made, and during on_motion the rectangle or line are drawn onto this copy, allowing to dynamically "drag" the rectangle or line.

I could separate out the arrow head code, if this helps, but it really is quite straightforward, and this modification is not independent of LINE (since LINE can have two arrow heads as well).

So if a split is indeed required, I would keep LINE and RECT together, and then produce a 2nd PR with the arrow style that can be applied on top of the first PR.

@bk138
Copy link
Owner

bk138 commented Feb 26, 2024

Yeah that sounds good!

@bk138
Copy link
Owner

bk138 commented Mar 2, 2024

Closing in favour of #193.

@bk138 bk138 closed this Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants