Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
85c26318
Commit
85c26318
authored
Jul 29, 2016
by
luyikei
Browse files
Track.qml: Fix some errors and strange behavior on locating clips
parent
9f7ef136
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Gui/timeline/Track.qml
View file @
85c26318
...
...
@@ -77,7 +77,7 @@ Item {
if
(
currentTrack
)
var
clips
=
currentTrack
[
"
clips
"
];
else
currentTrack
.
append
(
{
"
clips
"
:
[]
}
)
;
return
oldX
;
for
(
j
=
0
;
j
<
clips
.
count
+
2
&&
isCollided
;
++
j
)
{
isCollided
=
false
;
for
(
k
=
0
;
k
<
clips
.
count
;
++
k
)
{
...
...
@@ -239,14 +239,17 @@ Item {
scrollToTarget
(
drag
.
source
);
// Optimization: Delta delta X should be 0
if
(
ptof
(
deltaX
)
===
ptof
(
drag
.
source
.
x
-
lastX
)
&&
drag
.
source
.
x
!==
0
)
{
lastX
=
drag
.
source
.
x
;
return
;
if
(
drag
.
source
.
x
!==
findNewPosition
(
drag
.
source
.
x
,
drag
.
source
,
false
)
)
deltaX
=
0
;
else
{
// Optimization: Delta delta X should be 0
if
(
ptof
(
deltaX
)
===
ptof
(
drag
.
source
.
x
-
lastX
)
&&
drag
.
source
.
x
!==
0
)
{
lastX
=
drag
.
source
.
x
;
return
;
}
else
deltaX
=
drag
.
source
.
x
-
lastX
;
}
else
deltaX
=
drag
.
source
.
x
-
lastX
;
}
else
deltaX
=
drag
.
x
-
lastX
;
...
...
@@ -259,7 +262,7 @@ Item {
target
.
newTrackId
=
trackId
;
for
(
var
j
=
0
;
j
<
selectedClips
.
length
;
++
j
)
{
if
(
drag
.
source
!==
selectedClips
[
j
]
)
selectedClips
[
j
].
newTrackId
=
trackId
-
oldTrackId
+
selectedClips
[
j
].
trackId
;
selectedClips
[
j
].
newTrackId
=
Math
.
max
(
0
,
trackId
-
oldTrackId
+
selectedClips
[
j
].
trackId
)
;
}
}
...
...
@@ -267,15 +270,6 @@ Item {
var
oldX
=
target
.
pixelPosition
();
var
newX
=
Math
.
max
(
oldX
+
deltaX
,
0
);
// Recalculate deltaX in case of drag.source being moved
if
(
drag
.
source
===
target
)
{
if
(
oldTrackId
===
target
.
newTrackId
)
deltaX
=
Math
.
round
(
newX
-
oldX
);
else
// Don't move other clips if drag.source's track is changed
deltaX
=
0
;
}
newX
=
findNewPosition
(
newX
,
target
,
isMagneticMode
);
// Let's find newX of the linked clip
...
...
@@ -311,6 +305,15 @@ Item {
length
=
ptof
(
newX
+
target
.
width
);
}
// Recalculate deltaX in case of drag.source being moved
if
(
drag
.
source
===
target
)
{
if
(
oldTrackId
===
target
.
newTrackId
)
deltaX
=
newX
-
oldX
;
else
// Don't move other clips if drag.source's track is changed
deltaX
=
0
;
}
target
.
setPixelPosition
(
newX
);
alreadyCalculated
.
push
(
target
.
uuid
);
}
...
...
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