Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
56d11492
Commit
56d11492
authored
Aug 14, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved timeout to a variable
parent
449a84fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
app/assets/javascripts/fly_out_nav.js
app/assets/javascripts/fly_out_nav.js
+8
-4
No files found.
app/assets/javascripts/fly_out_nav.js
View file @
56d11492
import
Cookies
from
'
js-cookie
'
;
import
bp
from
'
./breakpoints
'
;
const
HIDE_INTERVAL_TIMEOUT
=
300
;
const
IS_OVER_CLASS
=
'
is-over
'
;
const
IS_ABOVE_CLASS
=
'
is-above
'
;
const
IS_SHOWING_FLY_OUT_CLASS
=
'
is-showing-fly-out
'
;
...
...
@@ -10,7 +11,7 @@ let timeoutId;
export
const
mousePos
=
[];
export
const
setOpenMenu
=
(
menu
)
=>
{
currentOpenMenu
=
menu
;
};
export
const
setOpenMenu
=
(
menu
=
null
)
=>
{
currentOpenMenu
=
menu
;
};
export
const
slope
=
(
a
,
b
)
=>
(
b
.
y
-
a
.
y
)
/
(
b
.
x
-
a
.
x
);
...
...
@@ -39,7 +40,7 @@ export const getHideSubItemsInterval = () => {
if
(
slope
(
prevMousePos
,
menuBottom
)
<
slope
(
currentMousePos
,
menuBottom
)
&&
slope
(
prevMousePos
,
menuTop
)
>
slope
(
currentMousePos
,
menuTop
))
{
return
300
;
return
HIDE_INTERVAL_TIMEOUT
;
}
return
0
;
...
...
@@ -64,7 +65,7 @@ export const hideMenu = (el) => {
parentEl
.
classList
.
remove
(
IS_OVER_CLASS
);
parentEl
.
classList
.
remove
(
IS_SHOWING_FLY_OUT_CLASS
);
setOpenMenu
(
null
);
setOpenMenu
();
};
export
const
moveSubItemsToPosition
=
(
el
,
subItems
)
=>
{
...
...
@@ -129,7 +130,10 @@ export const mouseLeaveTopItem = (el) => {
};
export
const
documentMouseMove
=
(
e
)
=>
{
mousePos
.
push
({
x
:
e
.
clientX
,
y
:
e
.
clientY
});
mousePos
.
push
({
x
:
e
.
clientX
,
y
:
e
.
clientY
,
});
if
(
mousePos
.
length
>
6
)
mousePos
.
shift
();
};
...
...
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