Resize window when enter / exit presentation mode

pull/10616/head
Alex P 2017-02-24 15:23:29 -08:00
parent 7d44024a33
commit 6287dc777f
3 changed files with 13 additions and 2 deletions

View File

@ -468,5 +468,5 @@ export const STROKE_WIDTH = {
light: 1.5,
};
export const PRESENTATION_MODE_ANIMATION_DELAY = 250 // In milliseconds.
export const PRESENTATION_MODE_ANIMATION_DELAY = 0 // In milliseconds.
export const PRESENTATION_MODE_NOTIFICATION_DELAY = 2000 // In milliseconds.

View File

@ -0,0 +1,10 @@
// Trigger resize event to relayout the React Layout plugin
export default function resizeLayout() {
return next => action => {
next(action);
if (action.type === 'ENABLE_PRESENTATION_MODE' || action.type === 'DISABLE_PRESENTATION_MODE') {
window.dispatchEvent(new Event('resize'));
}
}
}

View File

@ -2,6 +2,7 @@ import {createStore, applyMiddleware, compose} from 'redux';
import {combineReducers} from 'redux';
import thunkMiddleware from 'redux-thunk';
import makeQueryExecuter from 'src/shared/middleware/queryExecuter';
import resizeLayout from 'src/shared/middleware/resizeLayout';
import * as dataExplorerReducers from 'src/data_explorer/reducers';
import * as sharedReducers from 'src/shared/reducers';
import rulesReducer from 'src/kapacitor/reducers/rules';
@ -20,7 +21,7 @@ const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
export default function configureStore(initialState) {
const createPersistentStore = composeEnhancers(
persistStateEnhancer(),
applyMiddleware(thunkMiddleware, makeQueryExecuter()),
applyMiddleware(thunkMiddleware, makeQueryExecuter(), resizeLayout),
)(createStore);