Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
5e50c347
Commit
5e50c347
authored
Jul 31, 2016
by
luyikei
Browse files
Track.qml: Simplify the collision detection
parent
d72d6209
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Gui/timeline/Track.qml
View file @
5e50c347
...
...
@@ -90,34 +90,20 @@ Item {
// Set a right position
//
// HACK: If magnetic mode, consider clips bigger.
if
(
useMagneticMode
===
true
)
{
if
(
cx
+
cw
>
newX
&&
newX
+
sw
>
cx
)
isCollided
=
true
;
cw
+=
magneticMargin
*
2
cx
-=
magneticMargin
if
(
cx
+
cw
>
newX
&&
newX
+
sw
>
cx
)
{
if
(
cx
>
newX
)
{
if
(
cx
-
sw
>
0
)
newX
=
cx
-
sw
+
magneticMargin
;
else
newX
=
oldX
;
}
else
{
newX
=
cx
+
cw
-
magneticMargin
;
}
}
}
else
{
if
(
cx
+
cw
>
newX
&&
newX
+
sw
>
cx
)
{
isCollided
=
true
;
if
(
cx
>
newX
)
{
if
(
cx
-
sw
>
0
)
newX
=
cx
-
sw
;
else
newX
=
oldX
;
}
else
{
newX
=
cx
+
cw
;
}
var
clipMargin
=
useMagneticMode
?
magneticMargin
:
0
;
if
(
cx
+
cw
>
newX
&&
newX
+
sw
>
cx
)
isCollided
=
true
;
cw
+=
clipMargin
*
2
cx
-=
clipMargin
if
(
cx
+
cw
>
newX
&&
newX
+
sw
>
cx
)
{
if
(
cx
>
newX
)
{
if
(
cx
-
sw
>
0
)
newX
=
cx
-
sw
+
clipMargin
;
else
newX
=
oldX
;
}
else
{
newX
=
cx
+
cw
-
clipMargin
;
}
}
if
(
isCollided
)
...
...
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