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
de46c150
Commit
de46c150
authored
Dec 16, 2020
by
Jean-Baptiste Mardelle
Browse files
Fix timeline vertical scrolling too fast.
Fixes
#868
parent
7623b16b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/qml/timeline.qml
View file @
de46c150
...
...
@@ -118,25 +118,26 @@ Rectangle {
function
continuousScrolling
(
x
,
y
)
{
// This provides continuous scrolling at the left/right edges.
if
(
x
>
scrollView
.
contentX
+
scrollView
.
width
-
root
.
baseUnit
*
3
)
{
scrollTimer
.
horizontal
=
10
scrollTimer
.
horizontal
=
root
.
baseUnit
scrollTimer
.
start
()
}
else
if
(
x
<
50
)
{
scrollView
.
contentX
=
0
;
scrollTimer
.
horizontal
=
0
scrollTimer
.
stop
()
}
else
if
(
x
<
scrollView
.
contentX
+
root
.
baseUnit
*
3
)
{
scrollTimer
.
horizontal
=
-
10
scrollTimer
.
horizontal
=
-
root
.
baseUnit
scrollTimer
.
start
()
}
else
{
if
(
y
>
scrollView
.
contentY
+
scrollView
.
height
+
ruler
.
height
-
root
.
baseUnit
*
3
)
{
scrollTimer
.
vertical
=
root
.
baseUnit
/
3
if
(
y
>
scrollView
.
contentY
+
scrollView
.
height
+
ruler
.
height
-
root
.
baseUnit
)
{
scrollTimer
.
vertical
=
root
.
baseUnit
scrollTimer
.
horizontal
=
0
scrollTimer
.
start
()
}
else
if
(
y
-
scrollView
.
contentY
-
ruler
.
height
<
root
.
baseUnit
*
3
)
{
scrollTimer
.
vertical
=
-
root
.
baseUnit
/
3
}
else
if
(
scrollView
.
contentY
>
0
&&
(
y
-
(
scrollView
.
contentY
+
ruler
.
height
)
<
root
.
baseUnit
)
)
{
scrollTimer
.
vertical
=
-
root
.
baseUnit
scrollTimer
.
horizontal
=
0
scrollTimer
.
start
()
}
else
{
console
.
log
(
'
TRIGGERING VERTICAL STOP:
'
,
y
,
'
, SCROLL:
'
,
scrollView
.
contentY
,
'
SCH:
'
,
scrollView
.
height
)
scrollTimer
.
vertical
=
0
scrollTimer
.
horizontal
=
0
scrollTimer
.
stop
()
...
...
@@ -345,10 +346,10 @@ Rectangle {
onViewActiveTrackChanged
:
{
var
tk
=
Logic
.
getTrackById
(
timeline
.
activeTrack
)
if
(
tk
.
y
<
scrollView
.
contentY
)
{
scrollView
.
contentY
=
Math
.
max
(
0
,
tk
.
y
-
s
crollView
.
height
/
3
)
}
else
if
(
tk
.
y
+
tk
.
height
>
scrollView
.
contentY
+
scrollView
.
height
)
{
var
newY
=
Math
.
min
(
trackHeaders
.
height
-
scrollView
.
height
+
scrollView
.
ScrollBar
.
horizontal
.
height
,
tk
.
y
-
scrollView
.
height
/
3
)
if
(
tk
.
y
+
subtitleTrack
.
height
<
scrollView
.
contentY
)
{
scrollView
.
contentY
=
Math
.
max
(
0
,
tk
.
y
+
s
ubtitleTrack
.
height
)
}
else
if
(
tk
.
y
+
tk
.
height
+
subtitleTrack
.
height
>
scrollView
.
contentY
+
scrollView
.
height
)
{
var
newY
=
Math
.
min
(
trackHeaders
.
height
+
subtitleTrack
.
height
-
scrollView
.
height
+
scrollView
.
ScrollBar
.
horizontal
.
height
,
tk
.
y
+
tk
.
height
-
scrollView
.
height
+
subtitleTrack
.
height
)
if
(
newY
>=
0
)
{
scrollView
.
contentY
=
newY
}
...
...
@@ -1102,19 +1103,22 @@ Rectangle {
var
y
=
rubberSelect
.
y
-
ruler
.
height
+
scrollView
.
contentY
var
selectSubs
=
false
var
selectOnlySubs
=
false
var
selectionHeight
=
rubberSelect
.
height
if
(
showSubtitles
)
{
selectSubs
=
y
<
subtitleTrack
.
height
if
(
y
+
rubberSelect
.
height
>
subtitleTrack
.
height
)
{
var
bottomRubber
=
y
+
rubberSelect
.
height
if
(
bottomRubber
>
subtitleTrack
.
height
)
{
y
=
Math
.
max
(
0
,
y
-
subtitleTrack
.
height
)
selectionHeight
=
bottomRubber
-
subtitleTrack
.
height
}
else
{
y
-=
subtitleTrack
.
height
selectOnlySubs
=
true
}
}
var
topTrack
=
Logic
.
getTrackIndexFromPos
(
Math
.
max
(
0
,
y
))
var
bottomTrack
=
Logic
.
getTrackIndexFromPos
(
Math
.
max
(
0
,
y
)
+
rubberS
elect
.
h
eight
)
var
bottomTrack
=
Logic
.
getTrackIndexFromPos
(
Math
.
max
(
0
,
y
)
+
s
elect
ionH
eight
)
// Check if bottom of rubber selection covers the last track compositions
var
selectBottomCompositions
=
((
y
+
rubberS
elect
.
h
eight
)
-
Logic
.
getTrackYFromId
(
tracksRepeater
.
itemAt
(
bottomTrack
).
trackInternalId
)
-
scrollView
.
contentY
)
>
(
Logic
.
getTrackHeightByPos
(
bottomTrack
)
*
0.6
)
var
selectBottomCompositions
=
((
y
+
s
elect
ionH
eight
)
-
Logic
.
getTrackYFromId
(
tracksRepeater
.
itemAt
(
bottomTrack
).
trackInternalId
)
-
scrollView
.
contentY
)
>
(
Logic
.
getTrackHeightByPos
(
bottomTrack
)
*
0.6
)
if
(
bottomTrack
>=
topTrack
)
{
var
t
=
[]
if
(
!
selectOnlySubs
)
{
...
...
@@ -1367,7 +1371,7 @@ Rectangle {
return
}
if
(
dragProxy
.
draggedItem
>
-
1
&&
mouse
.
buttons
===
Qt
.
LeftButton
&&
(
controller
.
isClip
(
dragProxy
.
draggedItem
)
||
controller
.
isComposition
(
dragProxy
.
draggedItem
)))
{
continuousScrolling
(
mouse
.
x
+
parent
.
x
,
mouse
.
y
+
parent
.
y
)
continuousScrolling
(
mouse
.
x
+
parent
.
x
,
dragProxyArea
.
mouse
Y
+
parent
.
y
-
dragProxy
.
verticalOffset
+
ruler
.
height
+
subtitleTrack
.
height
)
snapping
=
(
mouse
.
modifiers
&
Qt
.
ShiftModifier
)
?
0
:
root
.
snapping
moveItem
()
}
...
...
@@ -1439,6 +1443,7 @@ Rectangle {
timeline
.
showToolTip
()
//bubbleHelp.hide()
}
tracksArea
.
focus
=
true
}
onDoubleClicked
:
{
if
(
dragProxy
.
masterObject
.
keyframeModel
)
{
...
...
@@ -1674,7 +1679,7 @@ Rectangle {
// This provides continuous scrolling at the left/right edges.
Timer
{
id
:
scrollTimer
interval
:
25
interval
:
80
repeat
:
true
triggeredOnStart
:
true
property
int
horizontal
:
0
...
...
@@ -1691,7 +1696,7 @@ Rectangle {
vertical
=
0
stop
()
}
else
{
var
maxScroll
=
trackHeaders
.
height
-
tracksArea
.
height
+
horScroll
.
height
+
ruler
.
height
var
maxScroll
=
trackHeaders
.
height
-
tracksArea
.
height
+
horScroll
.
height
+
ruler
.
height
+
subtitleTrack
.
height
if
(
scrollView
.
contentY
>
maxScroll
)
{
scrollView
.
contentY
=
Math
.
max
(
0
,
maxScroll
)
vertical
=
0
...
...
Write
Preview
Markdown
is supported
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