Context touch

This commit is contained in:
James Barnsley
2016-12-14 16:41:05 +13:00
parent cccac2b159
commit a4f5f25636
5 changed files with 23 additions and 11 deletions

View File

@ -14,22 +14,31 @@ class ContextMenu extends React.Component{
constructor(props) {
super(props);
//this.handleScroll = this.handleScroll.bind(this);
this.handleScroll = this.handleScroll.bind(this)
this.handleClick = this.handleClick.bind(this)
}
/*
componentDidMount(){
window.addEventListener("scroll", this.handleScroll, false);
window.addEventListener("scroll", this.handleScroll, false)
window.addEventListener("click", this.handleClick, false)
}
componentWillUnmount(){
window.removeEventListener("scroll", this.handleScroll, false);
window.removeEventListener("scroll", this.handleScroll, false)
window.removeEventListener("click", this.handleClick, false)
}
handleScroll(){
if( this.props.context_menu.show ){
if( this.props.context_menu.show && this.props.context_menu.trigger == 'click' ){
this.props.uiActions.hideContextMenu();
}
}*/
}
handleClick(){
if( this.props.context_menu.show && this.props.context_menu.trigger == 'click' ){
this.props.uiActions.hideContextMenu();
}
}
playQueueItem(){
var selectedTracks = this.props.context_menu.data.selected_tracks;
@ -191,7 +200,7 @@ class ContextMenu extends React.Component{
}
return (
<div className="context-menu" style={style}>
<div className={ this.props.context_menu.trigger+" context-menu"} style={style}>
{ this.renderItems() }
</div>
);

View File

@ -81,7 +81,7 @@ class TrackList extends React.Component{
selected_tracks: selected_tracks,
selected_tracks_indexes: this.tracksIndexes( selected_tracks )
}
this.props.uiActions.showContextMenu( e, this.props.context, data )
this.props.uiActions.showContextMenu( e, data, this.props.context, 'touch' )
}else{
this.props.uiActions.hideContextMenu()
}
@ -136,7 +136,7 @@ class TrackList extends React.Component{
selected_tracks: selected_tracks,
selected_tracks_indexes: this.tracksIndexes( selected_tracks )
}
this.props.uiActions.showContextMenu( e, this.props.context, data )
this.props.uiActions.showContextMenu( e, data, this.props.context, 'click' )
}
toggleTrackSelections(e, index){

View File

@ -1,12 +1,13 @@
import * as helpers from '../../helpers'
export function showContextMenu( e, context = false, data ){
export function showContextMenu( e, data, context = false, trigger = 'click' ){
return {
type: 'SHOW_CONTEXT_MENU',
position_x: e.clientX,
position_y: e.clientY,
context: context,
trigger: trigger,
data: data
}
}

View File

@ -29,6 +29,7 @@ export default function reducer(ui = {}, action){
position_x: action.position_x,
position_y: action.position_y,
context: action.context,
trigger: action.trigger,
data: action.data
}
});

View File

@ -60,7 +60,8 @@
}
}
@include responsive( $bp_medium ){
&.touch{
bottom: 0 !important;
left: 0 !important;
right: 0 !important;