scrolling update
This commit is contained in:
+2
-2
@@ -752,11 +752,11 @@ QVector<int> Timeline::get_tracks_of_linked_clips(int i) {
|
||||
}
|
||||
|
||||
void Timeline::zoom_in() {
|
||||
multiply_zoom(true);
|
||||
multiply_zoom(2.0);
|
||||
}
|
||||
|
||||
void Timeline::zoom_out() {
|
||||
multiply_zoom(false);
|
||||
multiply_zoom(0.5);
|
||||
}
|
||||
|
||||
bool is_clip_selected(Clip* clip, bool containing) {
|
||||
|
||||
+3
-2
@@ -232,9 +232,10 @@ public slots:
|
||||
|
||||
void nest();
|
||||
|
||||
void zoom_in();
|
||||
void zoom_out();
|
||||
|
||||
private slots:
|
||||
void zoom_in();
|
||||
void zoom_out();
|
||||
void snapping_clicked(bool checked);
|
||||
void add_btn_click();
|
||||
void add_menu_item(QAction*);
|
||||
|
||||
+2
-2
@@ -213,7 +213,7 @@ void FocusFilter::zoom_in() {
|
||||
} else if (focused_panel == panel_sequence_viewer) {
|
||||
panel_sequence_viewer->set_zoom(true);
|
||||
} else {
|
||||
panel_timeline->multiply_zoom(true);
|
||||
panel_timeline->zoom_in();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ void FocusFilter::zoom_out() {
|
||||
} else if (focused_panel == panel_sequence_viewer) {
|
||||
panel_sequence_viewer->set_zoom(false);
|
||||
} else {
|
||||
panel_timeline->multiply_zoom(false);
|
||||
panel_timeline->zoom_out();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -12,7 +12,12 @@ ScrollArea::ScrollArea(QWidget* parent) : QScrollArea(parent) {}
|
||||
void ScrollArea::wheelEvent(QWheelEvent *e) {
|
||||
if (config.scroll_zooms) {
|
||||
e->ignore();
|
||||
if (e->angleDelta().y() != 0) panel_timeline->multiply_zoom(e->angleDelta().y() > 0);
|
||||
|
||||
if (e->angleDelta().y() > 0) {
|
||||
panel_timeline->zoom_in();
|
||||
} else if (e->angleDelta().y() < 0) {
|
||||
panel_timeline->zoom_out();
|
||||
}
|
||||
} else {
|
||||
QScrollArea::wheelEvent(e);
|
||||
}
|
||||
|
||||
+39
-14
@@ -341,21 +341,46 @@ void TimelineWidget::dragMoveEvent(QDragMoveEvent *event) {
|
||||
}
|
||||
|
||||
void TimelineWidget::wheelEvent(QWheelEvent *event) {
|
||||
bool alt = (event->modifiers() & Qt::AltModifier);
|
||||
int scroll_amount = alt ? (event->angleDelta().x()) : (event->angleDelta().y());
|
||||
if (scroll_amount != 0) {
|
||||
bool shift = (event->modifiers() & Qt::ShiftModifier);
|
||||
bool in = (scroll_amount > 0);
|
||||
if (config.scroll_zooms != shift) {
|
||||
panel_timeline->multiply_zoom(in);
|
||||
} else {
|
||||
QScrollBar* bar = alt ? scrollBar : panel_timeline->horizontalScrollBar;
|
||||
// shift used to toggle zooming instead of scrolling
|
||||
bool shift = (event->modifiers() & Qt::ShiftModifier);
|
||||
|
||||
int step = bar->singleStep();
|
||||
if (in) step = -step;
|
||||
bar->setValue(bar->value() + step);
|
||||
}
|
||||
}
|
||||
if (!event->pixelDelta().isNull()) {
|
||||
// if we got pixel scrolling data, prefer it over the angleDelta data
|
||||
|
||||
QScrollBar* horiz_bar = panel_timeline->horizontalScrollBar;
|
||||
QScrollBar* vert_bar = scrollBar;
|
||||
|
||||
horiz_bar->setValue(horiz_bar->value() + event->pixelDelta().x());
|
||||
vert_bar->setValue(vert_bar->value() + event->pixelDelta().y());
|
||||
|
||||
} else if (!event->angleDelta().isNull()) {
|
||||
|
||||
// alt is used to swap horizontal and vertical scrolling
|
||||
bool alt = (event->modifiers() & Qt::AltModifier);
|
||||
|
||||
int scroll_amount = alt ? (event->angleDelta().x()) : (event->angleDelta().y());
|
||||
|
||||
bool in = (scroll_amount > 0);
|
||||
if (config.scroll_zooms != shift) {
|
||||
|
||||
// if config.scroll_zooms is enabled or shift is held, zoom instead of scrolling
|
||||
if (in) {
|
||||
panel_timeline->multiply_zoom(1.5);
|
||||
} else {
|
||||
panel_timeline->multiply_zoom(0.75);
|
||||
}
|
||||
|
||||
} else {
|
||||
// pass the scrolling to the Timeline's main scrollbar for horizontal scrolling, or this widget's
|
||||
// scrollbar for vertical scrolling
|
||||
|
||||
QScrollBar* bar = alt ? scrollBar : panel_timeline->horizontalScrollBar;
|
||||
|
||||
int step = bar->singleStep();
|
||||
if (in) step = -step;
|
||||
bar->setValue(bar->value() + step);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidget::dragLeaveEvent(QDragLeaveEvent* event) {
|
||||
|
||||
Reference in New Issue
Block a user