mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-05-05 16:24:49 -04:00
Fix rectangle selection clipping
This commit is contained in:
parent
cc69730eff
commit
5160c74e99
1 changed files with 6 additions and 2 deletions
|
@ -202,6 +202,8 @@ func select_rect(merge := true) -> void:
|
||||||
queue_free()
|
queue_free()
|
||||||
return
|
return
|
||||||
merge_multiple_selections(merge)
|
merge_multiple_selections(merge)
|
||||||
|
if not merge:
|
||||||
|
queue_free()
|
||||||
# var undo_data = _get_undo_data(false)
|
# var undo_data = _get_undo_data(false)
|
||||||
# Global.current_project.selected_rect = _selected_rect
|
# Global.current_project.selected_rect = _selected_rect
|
||||||
# commit_undo("Rectangle Select", undo_data)
|
# commit_undo("Rectangle Select", undo_data)
|
||||||
|
@ -226,13 +228,15 @@ func merge_multiple_selections(merge := true) -> void:
|
||||||
self.local_selected_pixels = selected_pixels_copy
|
self.local_selected_pixels = selected_pixels_copy
|
||||||
else:
|
else:
|
||||||
var arr = Geometry.clip_polygons_2d(selection.polygon, polygon)
|
var arr = Geometry.clip_polygons_2d(selection.polygon, polygon)
|
||||||
if arr.size() == 1: # if the selections intersect
|
if arr.size() == 0: # if the new selection completely overlaps the current
|
||||||
|
selection.queue_free()
|
||||||
|
elif arr.size() == 1: # if the selections intersect
|
||||||
selection.set_polygon(arr[0])
|
selection.set_polygon(arr[0])
|
||||||
var selected_pixels_copy = selection.local_selected_pixels.duplicate()
|
var selected_pixels_copy = selection.local_selected_pixels.duplicate()
|
||||||
for pixel in local_selected_pixels:
|
for pixel in local_selected_pixels:
|
||||||
selected_pixels_copy.erase(pixel)
|
selected_pixels_copy.erase(pixel)
|
||||||
selection.local_selected_pixels = selected_pixels_copy
|
selection.local_selected_pixels = selected_pixels_copy
|
||||||
queue_free()
|
|
||||||
|
|
||||||
func move_start(move_pixel : bool) -> void:
|
func move_start(move_pixel : bool) -> void:
|
||||||
if not move_pixel:
|
if not move_pixel:
|
||||||
|
|
Loading…
Add table
Reference in a new issue