diff --git a/src/js/components/ContextMenu.js b/src/js/components/ContextMenu.js index 83210176..4cbf87b7 100755 --- a/src/js/components/ContextMenu.js +++ b/src/js/components/ContextMenu.js @@ -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 ( -
+
{ this.renderItems() }
); diff --git a/src/js/components/TrackList.js b/src/js/components/TrackList.js index f398346d..2149bfe5 100755 --- a/src/js/components/TrackList.js +++ b/src/js/components/TrackList.js @@ -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){ diff --git a/src/js/services/ui/actions.js b/src/js/services/ui/actions.js index 54463659..880f51c2 100755 --- a/src/js/services/ui/actions.js +++ b/src/js/services/ui/actions.js @@ -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 } } diff --git a/src/js/services/ui/reducer.js b/src/js/services/ui/reducer.js index a7af652d..d43dfb2e 100755 --- a/src/js/services/ui/reducer.js +++ b/src/js/services/ui/reducer.js @@ -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 } }); diff --git a/src/scss/components/_context-menu.scss b/src/scss/components/_context-menu.scss index ee92f93d..55ab07ef 100755 --- a/src/scss/components/_context-menu.scss +++ b/src/scss/components/_context-menu.scss @@ -60,7 +60,8 @@ } } - @include responsive( $bp_medium ){ + &.touch{ + bottom: 0 !important; left: 0 !important; right: 0 !important;