-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
1. Increase the seekbar height on hovering (exclude touch device and tiny player) 2. Redesign the virtual progress indicator 3. Hide the seekbar preview in tiny player Solves FEC-10311
- Loading branch information
Showing
23 changed files
with
474 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {Managers} from './managers'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
//@flow | ||
import {UIManager} from '../../ui-manager'; | ||
import getLogger from '../../utils/logger'; | ||
import {EventManager} from 'event/event-manager'; | ||
|
||
/** | ||
* @class Managers | ||
*/ | ||
class Managers { | ||
static _logger: any; | ||
_managerRegistry: Map<string, Object> = new Map(); | ||
_eventManager: EventManager; | ||
|
||
/** | ||
* @constructor | ||
* @param {UIManager} uiManager - The UI manager. | ||
* @param {any} store - The store. | ||
* @param {any} player - The player. | ||
*/ | ||
constructor(uiManager: UIManager, store: any, player: any) { | ||
Managers._logger = getLogger('Managers'); | ||
this._eventManager = new EventManager(); | ||
this._eventManager.listen(player, player.Event.Core.PLAYER_RESET, () => this.reset()); | ||
} | ||
|
||
/** | ||
* @param {string} name - the manager name | ||
* @param {Object} manager - the manager object | ||
* @returns {void} | ||
*/ | ||
register(name: string, manager: Object): void { | ||
if (this._managerRegistry.has(name)) { | ||
Managers._logger.debug(`${name} manager already exists`); | ||
} else { | ||
this._managerRegistry.set(name, manager); | ||
Managers._logger.debug(`${name} manager registered`); | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* @param {string} name - the manager name | ||
* @returns {Object} - the manager object | ||
*/ | ||
get(name: string): Object | void { | ||
return this._managerRegistry.get(name); | ||
} | ||
|
||
/** | ||
* | ||
* @param {string} name - the manager name | ||
* @returns {boolean} - if the manager exist | ||
*/ | ||
has(name: string): boolean { | ||
return this._managerRegistry.has(name); | ||
} | ||
|
||
/** | ||
* @returns {void} | ||
*/ | ||
reset() { | ||
this._managerRegistry.forEach(manager => typeof manager.reset === 'function' && manager.reset()); | ||
} | ||
|
||
/** | ||
* @returns {void} | ||
*/ | ||
destroy() { | ||
this._managerRegistry.forEach(manager => typeof manager.destroy === 'function' && manager.destroy()); | ||
this._eventManager.removeAll(); | ||
this._managerRegistry.clear(); | ||
} | ||
} | ||
|
||
export {Managers}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {SeekBarPreview} from './seekbar-preview'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//@flow | ||
import style from '../../styles/style.scss'; | ||
import {h, Component} from 'preact'; | ||
import {connect} from 'react-redux'; | ||
|
||
/** | ||
* mapping state to props | ||
* @param {*} state - redux store state | ||
* @returns {Object} - mapped state to this component | ||
*/ | ||
const mapStateToProps = state => ({ | ||
duration: state.engine.duration | ||
}); | ||
|
||
/** | ||
* SeekBarPreview component | ||
* | ||
* @class SeekBarPreview | ||
* @extends {Component} | ||
*/ | ||
@connect(mapStateToProps) | ||
class SeekBarPreview extends Component { | ||
/** | ||
* utility function to get the thumb sprite background position | ||
* @returns {string} background-position string value | ||
*/ | ||
getThumbSpriteOffset(): string { | ||
const percent = this.props.virtualTime / this.props.duration; | ||
const sliceIndex = Math.ceil(this.props.thumbsSlices * percent); | ||
return -(sliceIndex * this.props.thumbsWidth) + 'px 0px'; | ||
} | ||
|
||
/** | ||
* Gets the style of the frame preview image. | ||
* @returns {string} - The css style string. | ||
* @private | ||
*/ | ||
_getFramePreviewImgStyle(): string { | ||
let framePreviewImgStyle = `background-image: url(${this.props.thumbsSprite});`; | ||
framePreviewImgStyle += `background-position: ${this.getThumbSpriteOffset()};`; | ||
framePreviewImgStyle += `background-size: ${this.props.thumbsSlices * this.props.thumbsWidth}px 100%;`; | ||
return framePreviewImgStyle; | ||
} | ||
|
||
/** | ||
* render component | ||
* @returns {React$Element} - component element | ||
*/ | ||
render() { | ||
if (!this.props.thumbsSprite || !this.props.thumbsSlices || !this.props.thumbsWidth) return undefined; | ||
return ( | ||
<div className={[style.framePreviewImgContainer, style.nonSticky].join(' ')}> | ||
<div className={style.framePreviewImg} style={this._getFramePreviewImgStyle()} /> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
SeekBarPreview.displayName = 'SeekBarPreview'; | ||
export {SeekBarPreview}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@import '~styles/variables'; | ||
|
||
.frame-preview { | ||
.frame-preview-img-container { | ||
height: $frame-preview-img-height + 4px; | ||
width: $frame-preview-img-width + 4px; | ||
border: 2px solid rgba(255, 255, 255, 0.2); | ||
border-radius: 4px; | ||
|
||
.frame-preview-img { | ||
background-size: auto 100%; | ||
width: 100%; | ||
height: 100%; | ||
position: relative; | ||
} | ||
} | ||
} |
Oops, something went wrong.