Skip to content

Commit c3956f8

Browse files
committed
Fix tab boundary freezing in viewport selection
- prevent GPU operations from hanging when the mouse is near the top edge of the viewport, enhancing user interaction stability.
1 parent 15b28e4 commit c3956f8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

gizmos/preselection.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ def draw(self, context):
3737
pass
3838

3939
def test_select(self, context, location):
40+
mouse_x, mouse_y = location
41+
region = context.region
42+
43+
# Fix for tab boundary freezing: GPU operations hang near viewport/tab boundary
44+
# Only the top edge (where tabs are) causes this issue, other edges are fine
45+
BORDER_MARGIN = 5
46+
if mouse_y >= (region.height - BORDER_MARGIN):
47+
return -1
48+
4049
# reset gizmo highlight
4150
if global_data.highlight_constraint:
4251
global_data.highlight_constraint = None
@@ -78,11 +87,11 @@ def test_select(self, context, location):
7887

7988

8089
def _spiral(N, M):
81-
x,y = 0,0
90+
x,y = 0,0
8291
dx, dy = 0, -1
8392

8493
for dumb in range(N*M):
85-
if abs(x) == abs(y) and [dx,dy] != [1,0] or x>0 and y == 1-x:
94+
if abs(x) == abs(y) and [dx,dy] != [1,0] or x>0 and y == 1-x:
8695
dx, dy = -dy, dx # corner, change direction
8796

8897
if abs(x)>N/2 or abs(y)>M/2: # non-square

0 commit comments

Comments
 (0)