Open qindapao opened 12 months ago
@qindapao
Anything that is not specific to GTK and may be re-used goes into Selection.pm
polygon selection is very much GTK specific, so everything should go into GTK/Selection.pm, including the drawing function that you'd call from GTK::Asciio::export_event
@nkh all right
@nkh
https://github.com/qindapao/P5-App-Asciio/tree/mouse_polygon_selc
I forced a re-push of this branch.Did as you said.
@qindapao The code is OK and I have merged it locally to test.
I don't understand how it works. I can start it and go around elements which get selected but if I escape this mode the elements are not selected any more.
IMO this mode would be more useful if it worked like lasso selection in other applications. In lasso mode, every time you circle around an element, or group of elements, that element gets selected then you can go on selecting other elements without worrying that the already selected elements get deselected. What do you think about that?
@nkh As I said, our purpose is to select the elements we want to choose and exclude the elements we don't want to choose under special circumstances. As the polygon changes, the elements will switch between selected and unselected, which is our purpose.As long as all the points of the element are inside the polygon, it is considered selected.
You pressx
Start drawing polygons. Press x
to exit after polygon drawing.Then the elements inside the polygon be selected. The lock sleeve you said is to fix the selected elements, and we have linear selection.That will do the trick.It is difficult to realize it in this polygon selection, and I feel that it is not my original intention.If there is a fish that slips through the net. It can also be supplemented by linear selection, which may be better.
I just don't want to make things too complicated. I'm sorry.
@nkh Its principle is ray method, which is a method in geometry to judge whether a point is inside a polygon.I also found it on the Internet recently, and I didn't know it before.
@qindapao To help keep the development branch close, I have merged polygon selection in 3bcb0ce but even though the implementation is good, the UX isn't and it needs to be polished bit; take a look at how lasso selection works in applications like Gimp.
There's also bug, I'll open a ticket.
@nkh All right, all right,High standards, strict requirements, I accept, we have to do it well.
@nkh In fact, the inspiration for this polygon selection comes from
It is implemented in java, but the author has not maintained it for many years, and there is no open source.It should have used a similar algorithm to mine. In fact, the ellipse is also inspired by it.I also asked the author for an algorithm, but he ignored me, so I studied it myself.
There's nothing wrong with your algorithm, it's how it's used that's not very convenient to use.
Here's how I'd like it to work.
I think the polygon tool is also useful as a "cut" tool.
@nkh Good advice, I will optimize it.
@qindapao if you can
I also had a look at the "pen" mode, here are a few thoughts about it
Pen mode can have it's own binding group but I think it should be reacheable via the the "insert group" , 'p' is free in that group.
The pen mode creates a lot of elements (pixels), maybe there should be a way group all those elements while in the pen mode.
There should be an eraser in the pen mode.
@nkh What can we do to cut out some characters from zbuffer?We can cut the exported text. This can indeed be done.
Pen mode I intend to map all ascii keys to its own characters. This seems a little crazy.Combination I think it is a way to turn all small pixels into a large text.This is what the other branch does.In addition, I want to use a simple element, which has only a single character strip and no other attributes.Save more memory than a box.Especially when there are many small pixels.Anyway, the fate of the final pixels is to merge into a text.Into ascii art.
@nkh https://github.com/qindapao/P5-App-Asciio/tree/element_trans
This branch combines pixels and splits any element into pixels.I reuse, uh, box elements. But I want to create pixel elements separately. There is only one single-width character or double-width character in it.
@nkh There are many other ideas spinning in my mind, including using the right mouse button to extract a character. Get characters from the system clipboard. Use the mouse wheel to switch characters. Multi-character input cycle mode (implemented)
Let your imagination flow and have fun.
extracting characters from a ZBuffer is just asking for them, you either et a character or undef if there's nothing there so the polygon tool just needs to generate the coordinates.
@nkh hi, nadim, We haven't spoken for so long
https://github.com/qindapao/P5-App-Asciio/tree/pen_mode
I've been spending some time with pen mode recently, but it's not really finished yet, I've made a custom mouse cursor, I hope you like it. This commit has not been completed yet and does not need to be merged yet. I still have some issues to deal with.
main target
... ...other functions may be needed