Skip to content

Commit d379898

Browse files
author
MatthieuMeert
committed
horizontal scrolling with SHIFT+scroll functional
1 parent 837cc15 commit d379898

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/timeline/js/controllers.js

+7
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,13 @@ App.controller("TimelineCtrl", function ($scope) {
284284
scrolling_tracks.scrollLeft(new_cursor_x);
285285
};
286286

287+
// Scroll the timeline horizontally of a certain amount (scrol_value)
288+
$scope.scrollLeft = function (scroll_value) {
289+
var scrolling_tracks = $("#scrolling_tracks");
290+
var horz_scroll_offset = scrolling_tracks.scrollLeft();
291+
scrolling_tracks.scrollLeft(horz_scroll_offset + scroll_value);
292+
};
293+
287294
// Center the timeline on a given time position
288295
$scope.centerOnTime = function (centerTime) {
289296
// Get the width of the timeline

src/windows/views/webview.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -2703,6 +2703,12 @@ def centerOnPlayhead(self):
27032703
# Execute JavaScript to center the timeline
27042704
self.run_js(JS_SCOPE_SELECTOR + '.centerOnPlayhead();')
27052705

2706+
@pyqtSlot()
2707+
def scrollLeft(self, scroll_value):
2708+
""" --------------------------- """
2709+
# Execute JavaScript to -----------------
2710+
self.run_js(JS_SCOPE_SELECTOR + '.scrollLeft(%s);' % int(scroll_value))
2711+
27062712
@pyqtSlot(int)
27072713
def SetSnappingMode(self, enable_snapping):
27082714
""" Enable / Disable snapping mode """
@@ -2781,13 +2787,18 @@ def update_zoom(self, newValue):
27812787
get_app().updates.update(["scale"], newScale)
27822788
get_app().updates.ignore_history = False
27832789

2784-
# Capture wheel event to alter zoom slider control
2790+
# Capture wheel event to alter zoom slider control or to use SHIFT+scroll for horizontal scroll
27852791
def wheelEvent(self, event):
27862792
if int(QCoreApplication.instance().keyboardModifiers() & Qt.ControlModifier) > 0:
27872793
# For each 120 (standard scroll unit) adjust the zoom slider
27882794
tick_scale = 120
27892795
steps = int(event.angleDelta().y() / tick_scale)
27902796
self.window.sliderZoom.setValue(self.window.sliderZoom.value() - self.window.sliderZoom.pageStep() * steps)
2797+
elif int(QCoreApplication.instance().keyboardModifiers() & Qt.ShiftModifier) > 0:
2798+
# For each 120 (standard scroll unit) scroll horizontally
2799+
tick_scale = 120
2800+
steps = int(event.angleDelta().y() / tick_scale)
2801+
self.scrollLeft(-steps*100)
27912802
else:
27922803
# Otherwise pass on to implement default functionality (scroll in QWebEngineView)
27932804
super(type(self), self).wheelEvent(event)

0 commit comments

Comments
 (0)