Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
25c1628e
Commit
25c1628e
authored
Nov 24, 2020
by
Jean-Baptiste Mardelle
Browse files
Center view when seeking to timeline clip.
Fixes
#844
parent
8fc74398
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/qml/timeline.qml
View file @
25c1628e
...
...
@@ -201,6 +201,10 @@ Rectangle {
}
return
col
}
function
centerViewOnCursor
()
{
scrollView
.
contentX
=
Math
.
max
(
0
,
root
.
consumerPosition
*
timeline
.
scaleFactor
-
(
scrollView
.
width
/
2
))
}
function
clearDropData
()
{
clipBeingDroppedId
=
-
1
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
25c1628e
...
...
@@ -1653,6 +1653,7 @@ void TimelineController::focusItem(int itemId)
{
int
start
=
m_model
->
getItemPosition
(
itemId
);
setPosition
(
start
);
emit
centerView
();
}
int
TimelineController
::
headerWidth
()
const
...
...
src/timeline2/view/timelinecontroller.h
View file @
25c1628e
...
...
@@ -697,6 +697,9 @@ signals:
/* @brief User enabled / disabled snapping, update timeline behavior
*/
void
snapChanged
();
/* @brief Center timeline view on current position
*/
void
centerView
();
Q_INVOKABLE
void
ungrabHack
();
};
...
...
src/timeline2/view/timelinetabs.cpp
View file @
25c1628e
...
...
@@ -87,6 +87,7 @@ void TimelineTabs::connectTimeline(TimelineWidget *timeline)
connect
(
timeline
->
controller
(),
&
TimelineController
::
updateZoom
,
this
,
[
&
](
double
value
)
{
emit
updateZoom
(
getCurrentTimeline
()
->
zoomForScale
(
value
));
});
connect
(
timeline
->
controller
(),
&
TimelineController
::
showItemEffectStack
,
this
,
&
TimelineTabs
::
showItemEffectStack
);
connect
(
timeline
->
controller
(),
&
TimelineController
::
showSubtitle
,
this
,
&
TimelineTabs
::
showSubtitle
);
connect
(
timeline
->
controller
(),
&
TimelineController
::
centerView
,
timeline
,
&
TimelineWidget
::
slotCenterView
);
}
void
TimelineTabs
::
disconnectTimeline
(
TimelineWidget
*
timeline
)
...
...
src/timeline2/view/timelinewidget.cpp
View file @
25c1628e
...
...
@@ -365,6 +365,11 @@ void TimelineWidget::slotChangeZoom(int value, bool zoomOnMouse)
m_proxy
->
setScaleFactorOnMouse
(
pixelScale
/
comboScale
[
value
],
zoomOnMouse
);
}
void
TimelineWidget
::
slotCenterView
()
{
QMetaObject
::
invokeMethod
(
rootObject
(),
"centerViewOnCursor"
);
}
void
TimelineWidget
::
slotFitZoom
()
{
QVariant
returnedValue
;
...
...
src/timeline2/view/timelinewidget.h
View file @
25c1628e
...
...
@@ -66,6 +66,8 @@ protected:
public
slots
:
void
slotChangeZoom
(
int
value
,
bool
zoomOnMouse
);
void
slotFitZoom
();
/* @brief Center timeline view on current timeline cursor position */
void
slotCenterView
();
void
zoneUpdated
(
const
QPoint
&
zone
);
void
zoneUpdatedWithUndo
(
const
QPoint
&
oldZone
,
const
QPoint
&
newZone
);
/* @brief Favorite effects have changed, reload model for context menu */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment