hide header on video after mouse idle

This commit is contained in:
Nate Goldman
2016-03-05 20:33:00 -08:00
parent 569111d336
commit 7c1c430097
3 changed files with 34 additions and 5 deletions

View File

@@ -102,11 +102,24 @@ a:not(.disabled):hover, i:not(.disabled):hover {
*/ */
.header { .header {
background: rgb(40, 40, 40);
border-bottom: 1px solid rgb(20, 20, 20); border-bottom: 1px solid rgb(20, 20, 20);
height: 37px; height: 38px;
padding-top: 6px; padding-top: 6px;
overflow: hidden; overflow: hidden;
flex: 0 1 auto; flex: 0 1 auto;
opacity: 1;
position: fixed;
left: 0;
top: 0;
right: 0;
z-index: 1000;
transition: opacity 0.1s ease-out;
}
.header.hide {
opacity: 0;
cursor: none;
} }
.header .title { .header .title {
@@ -196,6 +209,10 @@ body.drag::before {
* TORRENT LIST * TORRENT LIST
*/ */
.torrent-list {
margin-top: 38px;
}
.torrent { .torrent {
height: 120px; height: 120px;
padding: 20px; padding: 20px;

View File

@@ -143,6 +143,8 @@ function dispatch (action, ...args) {
setDimensions(args[0] /* dimensions */) setDimensions(args[0] /* dimensions */)
} }
if (action === 'back') { if (action === 'back') {
// TODO
// window.history.back()
if (state.url === '/player') { if (state.url === '/player') {
restoreBounds() restoreBounds()
closeServer() closeServer()
@@ -150,6 +152,10 @@ function dispatch (action, ...args) {
state.url = '/' state.url = '/'
update() update()
} }
if (action === 'forward') {
// TODO
// window.history.forward()
}
if (action === 'playPause') { if (action === 'playPause') {
state.video.isPaused = !state.video.isPaused state.video.isPaused = !state.video.isPaused
update() update()

View File

@@ -5,21 +5,26 @@ var hyperx = require('hyperx')
var hx = hyperx(h) var hx = hyperx(h)
function Header (state, dispatch) { function Header (state, dispatch) {
var navLeftStyle = process.platform === 'darwin' var hideControls = state.url === '/player' &&
? {marginLeft: '78px'} /* OSX needs room on the left for min/max/close buttons */ state.video.mouseStationarySince !== 0 &&
: null /* On Windows and Linux, the header is separate & underneath the title bar */ new Date().getTime() - state.video.mouseStationarySince > 2000
var navLeftStyle = (process.platform === 'darwin' && !state.isFullScreen)
? { marginLeft: '78px' } /* OSX needs room on the left for min/max/close buttons */
: {} /* On Windows and Linux, the header is separate & underneath the title bar */
return hx` return hx`
<div class='header'> <div class='header ${hideControls ? 'hide' : ''}'>
${getTitle()} ${getTitle()}
<div class='nav left' style=${navLeftStyle}> <div class='nav left' style=${navLeftStyle}>
<i <i
class='icon back' class='icon back'
title='back'
onclick=${() => dispatch('back')}> onclick=${() => dispatch('back')}>
chevron_left chevron_left
</i> </i>
<i <i
class='icon forward' class='icon forward'
title='forward'
onclick=${() => dispatch('forward')}> onclick=${() => dispatch('forward')}>
chevron_right chevron_right
</i> </i>
@@ -41,6 +46,7 @@ function Header (state, dispatch) {
return hx` return hx`
<i <i
class='icon add' class='icon add'
title='add torrent'
onclick=${() => dispatch('addTorrent')}> onclick=${() => dispatch('addTorrent')}>
add add
</i> </i>