Skip to content
GitLab
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
eb206e1d
Commit
eb206e1d
authored
Jul 08, 2019
by
Jean-Baptiste Mardelle
Browse files
Minor improvement to clip grabbing
parent
88d71bfa
Pipeline
#5048
passed with stage
in 19 minutes and 9 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/qml/Clip.qml
View file @
eb206e1d
...
...
@@ -83,11 +83,15 @@ Rectangle {
onIsGrabbedChanged
:
{
if
(
clipRoot
.
isGrabbed
)
{
clipRoot
.
forceActiveFocus
();
mouseArea
.
focus
=
true
grabItem
()
}
}
function
grabItem
()
{
clipRoot
.
forceActiveFocus
()
mouseArea
.
focus
=
true
}
function
clearAndMove
(
offset
)
{
controller
.
requestClearSelection
()
controller
.
requestClipMove
(
clipRoot
.
clipId
,
clipRoot
.
trackId
,
clipRoot
.
modelStart
-
offset
,
true
,
true
,
true
)
...
...
src/timeline2/view/qml/Composition.qml
View file @
eb206e1d
...
...
@@ -83,10 +83,15 @@ Item {
onIsGrabbedChanged
:
{
if
(
compositionRoot
.
isGrabbed
)
{
compositionRoot
.
forceActiveFocus
();
mouseArea
.
focus
=
true
grabItem
()
}
}
function
grabItem
()
{
compositionRoot
.
forceActiveFocus
()
mouseArea
.
focus
=
true
}
onTrackIdChanged
:
{
compositionRoot
.
parentTrack
=
Logic
.
getTrackById
(
trackId
)
compositionRoot
.
y
=
compositionRoot
.
originalTrackId
==
-
1
||
trackId
==
originalTrackId
?
0
:
parentTrack
.
y
-
Logic
.
getTrackById
(
compositionRoot
.
originalTrackId
).
y
;
...
...
src/timeline2/view/qml/timeline.qml
View file @
eb206e1d
...
...
@@ -1144,11 +1144,13 @@ Rectangle {
var
x
=
controller
.
getItemPosition
(
dragProxy
.
draggedItem
)
var
posx
=
Math
.
round
((
parent
.
x
)
/
root
.
timeScale
)
var
clickAccepted
=
true
if
(
controller
.
normalEdit
()
&&
(
tk
!=
Logic
.
getTrackIdFromPos
(
parent
.
y
)
||
x
!=
posx
))
{
var
currentMouseTrack
=
Logic
.
getTrackIdFromPos
(
parent
.
y
)
if
(
controller
.
normalEdit
()
&&
(
tk
!=
currentMouseTrack
||
x
!=
posx
))
{
console
.
log
(
'
INCORRECT DRAG, Trying to recover item:
'
,
parent
.
y
,
'
XPOS:
'
,
x
,
'
=
'
,
posx
,
'
on track:
'
,
tk
,
'
\n
!!!!!!!!!!
'
)
// Try to find correct item
var
tentativeClip
=
getItemAtPos
(
t
k
,
mouseX
+
parent
.
x
,
dragProxy
.
isComposition
)
var
tentativeClip
=
getItemAtPos
(
currentMouseTrac
k
,
mouseX
+
parent
.
x
,
dragProxy
.
isComposition
)
if
(
tentativeClip
&&
tentativeClip
.
clipId
)
{
console
.
log
(
'
FOUND MISSING ITSM:
'
,
tentativeClip
.
clipId
)
clickAccepted
=
true
dragProxy
.
draggedItem
=
tentativeClip
.
clipId
dragProxy
.
x
=
tentativeClip
.
x
...
...
@@ -1160,6 +1162,7 @@ Rectangle {
dragProxy
.
sourceFrame
=
tentativeClip
.
modelStart
dragProxy
.
isComposition
=
tentativeClip
.
isComposition
}
else
{
console
.
log
(
'
COULD NOT FIND ITSM
'
)
clickAccepted
=
false
mouse
.
accepted
=
false
dragProxy
.
draggedItem
=
-
1
...
...
@@ -1249,6 +1252,9 @@ Rectangle {
timeline
.
endFakeMove
(
dragProxy
.
draggedItem
,
dragFrame
,
true
,
true
,
true
)
}
}
if
(
dragProxy
.
masterObject
&&
dragProxy
.
masterObject
.
isGrabbed
)
{
dragProxy
.
masterObject
.
grabItem
()
}
dragProxy
.
x
=
controller
.
getItemPosition
(
dragProxy
.
draggedItem
)
*
timeline
.
scaleFactor
dragProxy
.
sourceFrame
=
dragFrame
bubbleHelp
.
hide
()
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
eb206e1d
...
...
@@ -2149,6 +2149,7 @@ void TimelineController::grabCurrent()
}
std
::
unordered_set
<
int
>
ids
=
m_model
->
getCurrentSelection
();
std
::
unordered_set
<
int
>
items_list
;
int
mainId
=
-
1
;
for
(
int
i
:
ids
)
{
if
(
m_model
->
isGroup
(
i
))
{
std
::
unordered_set
<
int
>
children
=
m_model
->
m_groups
->
getLeaves
(
i
);
...
...
@@ -2158,6 +2159,10 @@ void TimelineController::grabCurrent()
}
}
for
(
int
id
:
items_list
)
{
if
(
mainId
==
-
1
&&
m_model
->
getItemTrackId
(
id
)
==
m_activeTrack
)
{
mainId
=
id
;
continue
;
}
if
(
m_model
->
isClip
(
id
))
{
std
::
shared_ptr
<
ClipModel
>
clip
=
m_model
->
getClipPtr
(
id
);
clip
->
setGrab
(
!
clip
->
isGrabbed
());
...
...
@@ -2166,6 +2171,15 @@ void TimelineController::grabCurrent()
clip
->
setGrab
(
!
clip
->
isGrabbed
());
}
}
if
(
mainId
>
-
1
)
{
if
(
m_model
->
isClip
(
mainId
))
{
std
::
shared_ptr
<
ClipModel
>
clip
=
m_model
->
getClipPtr
(
mainId
);
clip
->
setGrab
(
!
clip
->
isGrabbed
());
}
else
if
(
m_model
->
isComposition
(
mainId
))
{
std
::
shared_ptr
<
CompositionModel
>
clip
=
m_model
->
getCompositionPtr
(
mainId
);
clip
->
setGrab
(
!
clip
->
isGrabbed
());
}
}
}
int
TimelineController
::
getItemMovingTrack
(
int
itemId
)
const
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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