Skip to content

Commit

Permalink
refined logics for adding new instance at a specific location
Browse files Browse the repository at this point in the history
  • Loading branch information
7174Andy committed Jul 19, 2024
1 parent 70b7977 commit 2018df5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sleap/gui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3014,6 +3014,7 @@ def set_visible_nodes(
scale_width = new_size_width / old_size_width
scale_height = new_size_height / old_size_height

print(new_size_height, new_size_width)
# Default the offset is 0
offset_x = 0
offset_y = 0
Expand Down Expand Up @@ -3050,12 +3051,13 @@ def set_visible_nodes(
# Apply offset if in bounds
x_new_offset = x_new + offset_x
y_new_offset = y_new + offset_y


if x_new_offset < new_size_width:

print(x_new_offset, ",", y_new_offset)

if x_new_offset >= 0 and x_new_offset < new_size_width:
x_new = x_new_offset

if y_new_offset < new_size_height:
if y_new_offset >= 0 and y_new_offset < new_size_height:
y_new = y_new_offset

new_instance[node] = Point(
Expand Down

0 comments on commit 2018df5

Please sign in to comment.