1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Properly fix polygon select tool circle radius not scaling properly with zoom

For real this time
This commit is contained in:
Emmanouil Papadeas 2024-05-21 03:01:23 +03:00
parent 3f8799f25a
commit e5d0a661f7

View file

@ -74,10 +74,7 @@ func draw_preview() -> void:
for line in _create_polylines(indicator): for line in _create_polylines(indicator):
canvas.draw_polyline(PackedVector2Array(line), Color.BLACK) canvas.draw_polyline(PackedVector2Array(line), Color.BLACK)
var circle_radius := Global.camera.zoom / 10.0 var circle_radius := Vector2.ONE * (10.0 / Global.camera.zoom.x)
circle_radius.x = clampf(circle_radius.x, 2, circle_radius.x)
circle_radius.y = clampf(circle_radius.y, 2, circle_radius.y)
if _last_position == _draw_points[0] and _draw_points.size() > 1: if _last_position == _draw_points[0] and _draw_points.size() > 1:
draw_empty_circle( draw_empty_circle(
canvas, Vector2(_draw_points[0]) + Vector2.ONE * 0.5, circle_radius, Color.BLACK canvas, Vector2(_draw_points[0]) + Vector2.ONE * 0.5, circle_radius, Color.BLACK
@ -230,5 +227,5 @@ func draw_empty_circle(
draw_counter += 1 draw_counter += 1
line_origin = line_end line_origin = line_end
line_end = circle_radius.rotated(deg_to_rad(360)) + circle_center line_end = circle_radius.rotated(TAU) + circle_center
canvas.draw_line(line_origin, line_end, color) canvas.draw_line(line_origin, line_end, color)