mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Fix crash when using the move tool snapped to the grid
This commit is contained in:
parent
f62770ece9
commit
1b48eac843
|
@ -18,16 +18,18 @@ func _input(event: InputEvent) -> void:
|
|||
_snap_to_grid = true
|
||||
_offset = _offset.snapped(Global.grid_size)
|
||||
if Global.current_project.has_selection and selection_node.is_moving_content:
|
||||
var prev_pos: Vector2 = selection_node.big_bounding_rectangle.position
|
||||
selection_node.big_bounding_rectangle.position = prev_pos.snapped(Global.grid_size)
|
||||
var prev_pos: Vector2i = selection_node.big_bounding_rectangle.position
|
||||
selection_node.big_bounding_rectangle.position = Vector2i(
|
||||
prev_pos.snapped(Global.grid_size)
|
||||
)
|
||||
# The first time transform_snap_grid is enabled then _snap_position() is not called
|
||||
# and the selection had wrong offset, so do selection offsetting here
|
||||
var grid_offset := Global.grid_offset
|
||||
grid_offset = Vector2(
|
||||
fmod(grid_offset.x, Global.grid_size.x), fmod(grid_offset.y, Global.grid_size.y)
|
||||
var grid_offset := Vector2i(
|
||||
fmod(Global.grid_offset.x, Global.grid_size.x),
|
||||
fmod(Global.grid_offset.y, Global.grid_size.y)
|
||||
)
|
||||
selection_node.big_bounding_rectangle.position += grid_offset
|
||||
selection_node.marching_ants_outline.offset += (
|
||||
selection_node.marching_ants_outline.offset += Vector2(
|
||||
selection_node.big_bounding_rectangle.position - prev_pos
|
||||
)
|
||||
elif event.is_action_released("transform_snap_grid"):
|
||||
|
|
Loading…
Reference in a new issue