pan with two finger scroll
All checks were successful
Python CI / test (push) Successful in 1m31s
Lint / lint (push) Successful in 1m8s
Tests / test (3.11) (push) Successful in 1m42s
Tests / test (3.12) (push) Successful in 1m43s
Tests / test (3.13) (push) Successful in 1m37s
Tests / test (3.14) (push) Successful in 1m16s
All checks were successful
Python CI / test (push) Successful in 1m31s
Lint / lint (push) Successful in 1m8s
Tests / test (3.11) (push) Successful in 1m42s
Tests / test (3.12) (push) Successful in 1m43s
Tests / test (3.13) (push) Successful in 1m37s
Tests / test (3.14) (push) Successful in 1m16s
This commit is contained in:
parent
8f1e906884
commit
a7f32e73b9
@ -310,10 +310,18 @@ class MouseInteractionMixin:
|
||||
if hasattr(main_window, "update_scrollbars"):
|
||||
main_window.update_scrollbars()
|
||||
else:
|
||||
# Regular wheel: Vertical scroll
|
||||
scroll_amount = delta * 0.5
|
||||
# Regular wheel: Two-finger scroll (vertical and horizontal)
|
||||
delta_x = event.angleDelta().x()
|
||||
delta_y = event.angleDelta().y()
|
||||
|
||||
scroll_amount_x = delta_x * 0.5
|
||||
scroll_amount_y = delta_y * 0.5
|
||||
|
||||
old_pan_x = self.pan_offset[0]
|
||||
old_pan_y = self.pan_offset[1]
|
||||
self.pan_offset[1] += scroll_amount
|
||||
|
||||
self.pan_offset[0] += scroll_amount_x
|
||||
self.pan_offset[1] += scroll_amount_y
|
||||
|
||||
# Clamp pan offset to content bounds
|
||||
if hasattr(self, "clamp_pan_offset"):
|
||||
@ -321,8 +329,9 @@ class MouseInteractionMixin:
|
||||
|
||||
# If dragging, adjust drag_start_pos to account for pan_offset change
|
||||
if self.is_dragging and self.drag_start_pos:
|
||||
pan_delta_x = self.pan_offset[0] - old_pan_x
|
||||
pan_delta_y = self.pan_offset[1] - old_pan_y
|
||||
self.drag_start_pos = (self.drag_start_pos[0], self.drag_start_pos[1] + pan_delta_y)
|
||||
self.drag_start_pos = (self.drag_start_pos[0] + pan_delta_x, self.drag_start_pos[1] + pan_delta_y)
|
||||
|
||||
self.update()
|
||||
|
||||
|
||||
@ -448,7 +448,7 @@ class TestWheelEvent:
|
||||
initial_pan = widget.pan_offset[1]
|
||||
|
||||
event = Mock()
|
||||
event.angleDelta = Mock(return_value=Mock(y=Mock(return_value=-120))) # Scroll down
|
||||
event.angleDelta = Mock(return_value=Mock(x=Mock(return_value=0), y=Mock(return_value=-120))) # Scroll down
|
||||
event.modifiers = Mock(return_value=Qt.KeyboardModifier.NoModifier)
|
||||
|
||||
widget.wheelEvent(event)
|
||||
@ -489,7 +489,7 @@ class TestWheelEvent:
|
||||
initial_pan = widget.pan_offset[1]
|
||||
|
||||
event = Mock()
|
||||
event.angleDelta = Mock(return_value=Mock(y=Mock(return_value=120))) # Scroll up
|
||||
event.angleDelta = Mock(return_value=Mock(x=Mock(return_value=0), y=Mock(return_value=120))) # Scroll up
|
||||
event.modifiers = Mock(return_value=Qt.KeyboardModifier.NoModifier)
|
||||
|
||||
widget.wheelEvent(event)
|
||||
@ -510,7 +510,7 @@ class TestWheelEvent:
|
||||
initial_pan = widget.pan_offset[1]
|
||||
|
||||
event = Mock()
|
||||
event.angleDelta = Mock(return_value=Mock(y=Mock(return_value=-120))) # Scroll down
|
||||
event.angleDelta = Mock(return_value=Mock(x=Mock(return_value=0), y=Mock(return_value=-120))) # Scroll down
|
||||
event.modifiers = Mock(return_value=Qt.KeyboardModifier.NoModifier)
|
||||
|
||||
widget.wheelEvent(event)
|
||||
@ -890,7 +890,7 @@ class TestWheelEventWhileDragging:
|
||||
initial_drag_y = widget.drag_start_pos[1]
|
||||
|
||||
event = Mock()
|
||||
event.angleDelta = Mock(return_value=Mock(y=Mock(return_value=120))) # Scroll up
|
||||
event.angleDelta = Mock(return_value=Mock(x=Mock(return_value=0), y=Mock(return_value=120))) # Scroll up
|
||||
event.modifiers = Mock(return_value=Qt.KeyboardModifier.NoModifier)
|
||||
|
||||
widget.wheelEvent(event)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user