Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow to close a poly line #404

Closed
wolfscaptain opened this issue Mar 29, 2013 · 7 comments
Closed

Allow to close a poly line #404

wolfscaptain opened this issue Mar 29, 2013 · 7 comments

Comments

@wolfscaptain
Copy link

If an end point of a poly line is next to the starting point, it should snap to it to form a closed shape.

In addition, allow to join the starting and ending points of an already constructed poly line.

@bjorn
Copy link
Member

bjorn commented Mar 30, 2013

If you want to make a closed polygon, why not just use the Polygon tool rather than the Polyline tool? Do you intend to create a non-filled but closed polyline?

Also, how would you "unjoin" the start and end points? I'm afraid such features will make the polygon editing a lot more complicated. Of course, that's no problem if you want to implement it yourself or pay reasonably for the effort.

What would be straight-forward would be an option to convert a polyline to a polygon and vica versa.

@wolfscaptain
Copy link
Author

In my case, yes I want a non filled closed poly line. I am using poly lines to create paths for my AI, and want them to act differently based on whether they are open or closed. For now I just set it so that if the starting and ending points reside on the same location, it should be considered closed. I could use a polygon, but that makes a mess graphically.

Not sure why it would be complicated, but then I didn't look at Tiled's source. Maybe I'll check it out some time.

@bjorn
Copy link
Member

bjorn commented Apr 1, 2013

@wolfscaptain It's not complicated to snap to the starting node. It's complicated to think about the situation that comes afterwards, unless you think it requires no special handling. If start and end point are on the same position, you will no longer recognize them as end-points and it may take a few trial and error before you locate the point where you can "untie" the polygon.

Maybe you're just looking for an option to disable the filling of polygons?

@gamedevsam
Copy link

Disabling polygon filling would be a nifty feature, especially if that is saved in the tmx file as an attribute or something.

@wolfscaptain
Copy link
Author

You don't need to search for a point, you could break it at any. It's just a linked list as far as I can tell.

This can be taken a step further so that you could break any point and if the poly line itself is broken than it creates the needed object for the newly broken line, but that's not really related to a 2D level editor. :)

Don't bother if it's a hassle though, I can just put the starting and ending points on the same position, and then handle the rest in my code.
I am probably the only one this bothers anyway.

@bjorn
Copy link
Member

bjorn commented Apr 2, 2013

@wolfscaptain Those kind of things is what I would call complicated. If not done right, it's very easy to get a confusing UI and an ugly implementation. I currently do not have the time nor motivation to work on it, especially since it's not exactly a core feature anyway, but if it's important to you feel free to contribute a patch.

I had a choice between supporting polygons that can be arbitrarily broken apart or closed, etc. (like in Inkscape), or supporting closed and open polygons as separate objects. I went for the latter because I preferred its simplicity. Also, it was a sponsored feature and as it is it fulfilled the use-case. Taking it further would have increased the budget.

ketanhwr added a commit to ketanhwr/tiled that referenced this issue Aug 6, 2017
)

Need to select two consecutive nodes in a polygon to delete an edge.
@bjorn
Copy link
Member

bjorn commented Mar 23, 2018

In the current master version it is possible to close a polyline to make a polygon, either while creating it or while extending it (change aa8d731). These improvements are scheduled to be released as part of Tiled 1.2, and are already available in the development snapshots.

@bjorn bjorn closed this as completed Mar 23, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants