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
4ef24fb7
Commit
4ef24fb7
authored
Mar 24, 2021
by
Jean-Baptiste Mardelle
Browse files
Ruler zones and guides now also snap to timeline cursor, drag+ shift disables snapping
Fix mouse wheel over track head should scroll vertical
parent
c63280d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
4ef24fb7
...
...
@@ -3861,7 +3861,10 @@ void TimelineModel::setUndoStack(std::weak_ptr<DocUndoStack> undo_stack)
int
TimelineModel
::
suggestSnapPoint
(
int
pos
,
int
snapDistance
)
{
int
cursorPosition
=
pCore
->
getTimelinePosition
();
m_snaps
->
addPoint
(
cursorPosition
);
int
snapped
=
m_snaps
->
getClosestPoint
(
pos
);
m_snaps
->
removePoint
(
cursorPosition
);
return
(
qAbs
(
snapped
-
pos
)
<
snapDistance
?
snapped
:
pos
);
}
...
...
src/timeline2/view/qml/Ruler.qml
View file @
4ef24fb7
...
...
@@ -103,7 +103,7 @@ Item {
color
:
'
orange
'
visible
:
rulerRoot
.
workingPreview
>
-
1
}
// Guides
Repeater
{
model
:
guidesModel
...
...
@@ -165,7 +165,7 @@ Item {
onPositionChanged
:
{
if
(
pressed
)
{
var
newFrame
=
Math
.
round
(
model
.
frame
+
(
mouseX
-
xOffset
)
/
timeline
.
scaleFactor
)
newFrame
=
controller
.
suggestSnapPoint
(
newFrame
,
root
.
snapping
)
newFrame
=
controller
.
suggestSnapPoint
(
newFrame
,
mouse
.
modifiers
&
Qt
.
ShiftModifier
?
-
1
:
root
.
snapping
)
timeline
.
moveGuideWithoutUndo
(
markerBase
.
markerId
,
newFrame
)
}
}
...
...
src/timeline2/view/qml/RulerZone.qml
View file @
4ef24fb7
...
...
@@ -83,10 +83,10 @@ Rectangle {
resizeActive
=
true
var
offset
=
Math
.
round
(
mouseX
/
timeline
.
scaleFactor
)
if
(
offset
!=
0
)
{
var
newPos
=
Math
.
max
(
0
,
controller
.
suggestSnapPoint
(
frameIn
+
offset
,
root
.
snapping
))
var
newPos
=
Math
.
max
(
0
,
controller
.
suggestSnapPoint
(
frameIn
+
offset
,
mouse
.
modifiers
&
Qt
.
ShiftModifier
?
-
1
:
root
.
snapping
))
if
(
newPos
==
frameIn
+
offset
)
{
// No snap at start, check end
var
newPos
=
Math
.
max
(
0
,
controller
.
suggestSnapPoint
(
frameOut
+
offset
,
root
.
snapping
))
var
newPos
=
Math
.
max
(
0
,
controller
.
suggestSnapPoint
(
frameOut
+
offset
,
mouse
.
modifiers
&
Qt
.
ShiftModifier
?
-
1
:
root
.
snapping
))
if
(
newPos
==
frameOut
+
offset
)
{
newPos
=
frameIn
+
offset
}
else
{
...
...
@@ -192,7 +192,7 @@ Rectangle {
onPositionChanged
:
{
if
(
mouse
.
buttons
===
Qt
.
LeftButton
)
{
resizeActive
=
true
var
newPos
=
controller
.
suggestSnapPoint
(
frameIn
+
Math
.
round
(
trimIn
.
x
/
timeline
.
scaleFactor
),
root
.
snapping
)
var
newPos
=
controller
.
suggestSnapPoint
(
frameIn
+
Math
.
round
(
trimIn
.
x
/
timeline
.
scaleFactor
),
mouse
.
modifiers
&
Qt
.
ShiftModifier
?
-
1
:
root
.
snapping
)
if
(
newPos
<
0
)
{
newPos
=
0
}
...
...
@@ -241,7 +241,7 @@ Rectangle {
onPositionChanged
:
{
if
(
mouse
.
buttons
===
Qt
.
LeftButton
)
{
resizeActive
=
true
frameOut
=
Math
.
max
(
controller
.
suggestSnapPoint
(
frameIn
+
Math
.
round
((
trimOut
.
x
+
trimOut
.
width
)
/
timeline
.
scaleFactor
),
root
.
snapping
),
frameIn
+
1
)
frameOut
=
Math
.
max
(
controller
.
suggestSnapPoint
(
frameIn
+
Math
.
round
((
trimOut
.
x
+
trimOut
.
width
)
/
timeline
.
scaleFactor
),
mouse
.
modifiers
&
Qt
.
ShiftModifier
?
-
1
:
root
.
snapping
),
frameIn
+
1
)
}
}
}
...
...
src/timeline2/view/qml/timeline.qml
View file @
4ef24fb7
...
...
@@ -727,23 +727,14 @@ Rectangle {
var
track
=
Logic
.
getTrackIndexFromPos
(
drag
.
y
+
scrollView
.
contentY
-
yOffset
)
if
(
track
>=
0
&&
track
<
tracksRepeater
.
count
)
{
timeline
.
activeTrack
=
tracksRepeater
.
itemAt
(
track
).
trackInternalId
var
frame
=
Math
.
round
((
drag
.
x
+
scrollView
.
contentX
)
/
timeline
.
scaleFactor
)
if
(
clipBeingDroppedId
>=
0
)
{
//fakeFrame = controller.suggestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, root.consumerPosition, Math.floor(root.snapping))
//fakeTrack = timeline.activeTrack
//controller.requestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, true, false, false)
continuousScrolling
(
drag
.
x
+
scrollView
.
contentX
,
drag
.
y
+
scrollView
.
contentY
)
}
else
{
frame
=
controller
.
suggestSnapPoint
(
frame
,
root
.
snapping
)
if
(
controller
.
normalEdit
())
{
//clipBeingDroppedId = insertAndMaybeGroup(timeline.activeTrack, frame, drag.getDataAsString('kdenlive/producerslist'), false, true)
}
else
{
continuousScrolling
(
drag
.
x
+
scrollView
.
contentX
,
drag
.
y
+
scrollView
.
contentY
)
if
(
clipBeingDroppedId
==
-
1
)
{
if
(
controller
.
normalEdit
()
==
false
)
{
// we want insert/overwrite mode, make a fake insert at end of timeline, then move to position
//clipBeingDroppedId = insertAndMaybeGroup(timeline.activeTrack, timeline.fullDuration, clipBeingDroppedData)
//fakeFrame = controller.suggestClipMove(clipBeingDroppedId, timeline.activeTrack, frame, root.consumerPosition, Math.floor(root.snapping))
fakeTrack
=
timeline
.
activeTrack
}
continuousScrolling
(
drag
.
x
+
scrollView
.
contentX
,
drag
.
y
+
scrollView
.
contentY
)
}
}
}
...
...
@@ -837,7 +828,8 @@ Rectangle {
height
:
trackHeaders
.
height
+
subtitleTrackHeader
.
height
acceptedButtons
:
Qt
.
NoButton
onWheel
:
{
zoomByWheel
(
wheel
)
verticalScroll
(
wheel
)
wheel
.
accepted
=
true
}
}
Rectangle
{
...
...
@@ -1171,8 +1163,11 @@ Rectangle {
}
else
if
(
root
.
activeTool
===
0
||
mouse
.
y
<=
ruler
.
height
)
{
if
(
mouse
.
y
>
ruler
.
height
)
{
controller
.
requestClearSelection
();
proxy
.
position
=
Math
.
min
((
scrollView
.
contentX
+
mouse
.
x
)
/
timeline
.
scaleFactor
,
timeline
.
fullDuration
-
1
)
}
else
if
(
mouse
.
y
>
ruler
.
guideLabelHeight
)
{
proxy
.
position
=
Math
.
min
((
scrollView
.
contentX
+
mouse
.
x
)
/
timeline
.
scaleFactor
,
timeline
.
fullDuration
-
1
)
}
proxy
.
position
=
Math
.
min
((
scrollView
.
contentX
+
mouse
.
x
)
/
timeline
.
scaleFactor
,
timeline
.
fullDuration
-
1
)
}
}
else
if
(
mouse
.
button
&
Qt
.
RightButton
)
{
if
(
mouse
.
y
>
ruler
.
height
)
{
...
...
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