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

Fixed rotation gixmo (#976)

This commit is contained in:
Variable 2024-01-20 05:06:44 +05:00 committed by GitHub
parent bc8fadb67c
commit 561a374cc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -250,13 +250,14 @@ func _on_Indicator_draw() -> void:
else:
conversion_scale = ratio.y
var pivot_position := pivot * conversion_scale
pivot_indicator.draw_arc(pivot_position, 2, 0, 360, 360, Color.YELLOW, 0.5)
pivot_indicator.draw_arc(pivot_position, 6, 0, 360, 360, Color.WHITE, 0.5)
var width = 1
pivot_indicator.draw_arc(pivot_position, 2, 0, 360, 360, Color.YELLOW, width)
pivot_indicator.draw_arc(pivot_position, 6, 0, 360, 360, Color.WHITE, width)
pivot_indicator.draw_line(
pivot_position - Vector2.UP * 10, pivot_position - Vector2.DOWN * 10, Color.WHITE, 0.5
pivot_position - Vector2.UP * 10, pivot_position - Vector2.DOWN * 10, Color.WHITE, width
)
pivot_indicator.draw_line(
pivot_position - Vector2.RIGHT * 10, pivot_position - Vector2.LEFT * 10, Color.WHITE, 0.5
pivot_position - Vector2.RIGHT * 10, pivot_position - Vector2.LEFT * 10, Color.WHITE, width
)
@ -267,8 +268,7 @@ func _on_Indicator_gui_input(event: InputEvent) -> void:
drag_pivot = false
if drag_pivot:
var img_size := preview_image.get_size()
# var mouse_pos := get_local_mouse_position() - pivot_indicator.position
var mouse_pos := pivot_indicator.position
var mouse_pos := pivot_indicator.get_local_mouse_position()
var ratio := Vector2(img_size) / pivot_indicator.size
# we need to set the scale according to the larger side
var conversion_scale: float