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

CanvasItem.draw_polyline does not draw 1px lines when width<=1.0 #44332

Closed
briansemrau opened this issue Dec 13, 2020 · 4 comments · Fixed by #71679
Closed

CanvasItem.draw_polyline does not draw 1px lines when width<=1.0 #44332

briansemrau opened this issue Dec 13, 2020 · 4 comments · Fixed by #71679

Comments

@briansemrau
Copy link
Contributor

briansemrau commented Dec 13, 2020

Godot version:

4.0 7195f6b

OS/device including version:

Vulkan

Issue description:

Following changes in 3ec972f, support for drawing thin lines with draw_polyline seems to have been removed. I believe this is in error.

Using the code:

func _draw():
	draw_arc(Vector2(0, 0), 50, 0, PI * 0.75, 25, Color.white)

when zoomed in, the line should be 1px wide, but it looks like this:
image

Steps to reproduce:
See above

Minimal reproduction project:

@briansemrau briansemrau changed the title CanvasItem.draw_polyline does not draw thin lines when width<=1.0 CanvasItem.draw_polyline does not draw 1px lines when width<=1.0 Dec 13, 2020
@briansemrau
Copy link
Contributor Author

@Chaosus

@Calinou
Copy link
Member

Calinou commented Dec 13, 2020

This may actually be intended, see godotengine/godot-proposals#1363.

We should support both use cases but we probably have to find another way to do that. I think scaling 1-pixel lines by default is a better idea, but there should still be a way to draw "hairline" width lines that don't scale with the viewport.

@briansemrau
Copy link
Contributor Author

briansemrau commented Dec 13, 2020

I do agree that width=1 shouldn't create pixel-thin lines and I generally prefer the behavior demonstrated in this issue. Hairline width I think would be better implemented with width=0, not 1. (The solution in the proposal is better). However, right now this function is inconsistent with other line drawing functions and behaves unexpectedly.

@Chaosus
Copy link
Member

Chaosus commented Dec 13, 2020

I think adding the add_thin_polyline method family is not a bad idea. So instead of draw_arc, you would write draw_thin_arc.

But if this is not desired I can restore it to the old state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment