2017-02-16 23:02:40 +00:00
|
|
|
/* @flow */
|
|
|
|
|
|
|
|
import {
|
2017-04-01 05:52:40 +00:00
|
|
|
CLEAR_TOOLBOX_TIMEOUT,
|
2018-04-20 11:24:14 +00:00
|
|
|
SET_OVERFLOW_MENU_VISIBLE,
|
2017-02-16 23:02:40 +00:00
|
|
|
SET_TOOLBAR_HOVERED,
|
2017-04-12 19:06:56 +00:00
|
|
|
SET_TOOLBOX_ALWAYS_VISIBLE,
|
|
|
|
SET_TOOLBOX_ENABLED,
|
2017-04-01 05:52:40 +00:00
|
|
|
SET_TOOLBOX_TIMEOUT,
|
|
|
|
SET_TOOLBOX_TIMEOUT_MS,
|
2019-06-19 12:44:39 +00:00
|
|
|
SET_TOOLBOX_VISIBLE,
|
|
|
|
TOGGLE_TOOLBOX_VISIBLE
|
2017-02-16 23:02:40 +00:00
|
|
|
} from './actionTypes';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2017-04-01 05:52:40 +00:00
|
|
|
* Signals that toolbox timeout should be cleared.
|
2017-02-16 23:02:40 +00:00
|
|
|
*
|
|
|
|
* @returns {{
|
2017-04-01 05:52:40 +00:00
|
|
|
* type: CLEAR_TOOLBOX_TIMEOUT
|
2017-02-16 23:02:40 +00:00
|
|
|
* }}
|
|
|
|
*/
|
2017-04-01 05:52:40 +00:00
|
|
|
export function clearToolboxTimeout(): Object {
|
2017-02-16 23:02:40 +00:00
|
|
|
return {
|
2017-04-01 05:52:40 +00:00
|
|
|
type: CLEAR_TOOLBOX_TIMEOUT
|
2017-02-16 23:02:40 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-04-20 11:24:14 +00:00
|
|
|
/**
|
|
|
|
* Shows/hides the overflow menu.
|
|
|
|
*
|
|
|
|
* @param {boolean} visible - True to show it or false to hide it.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_OVERFLOW_MENU_VISIBLE,
|
|
|
|
* visible: boolean
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setOverflowMenuVisible(visible: boolean): Object {
|
|
|
|
return {
|
|
|
|
type: SET_OVERFLOW_MENU_VISIBLE,
|
|
|
|
visible
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-02-16 23:02:40 +00:00
|
|
|
/**
|
|
|
|
* Signals that toolbar is hovered value should be changed.
|
|
|
|
*
|
|
|
|
* @param {boolean} hovered - Flag showing whether toolbar is hovered.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_TOOLBAR_HOVERED,
|
|
|
|
* hovered: boolean
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setToolbarHovered(hovered: boolean): Object {
|
|
|
|
return {
|
|
|
|
type: SET_TOOLBAR_HOVERED,
|
|
|
|
hovered
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-04-04 11:53:10 +00:00
|
|
|
/**
|
|
|
|
* Signals that always visible toolbars value should be changed.
|
|
|
|
*
|
|
|
|
* @param {boolean} alwaysVisible - Value to be set in redux store.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_TOOLBOX_ALWAYS_VISIBLE,
|
|
|
|
* alwaysVisible: boolean
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setToolboxAlwaysVisible(alwaysVisible: boolean): Object {
|
|
|
|
return {
|
|
|
|
type: SET_TOOLBOX_ALWAYS_VISIBLE,
|
|
|
|
alwaysVisible
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-04-01 05:52:40 +00:00
|
|
|
/* eslint-disable flowtype/space-before-type-colon */
|
|
|
|
|
2017-04-12 19:06:56 +00:00
|
|
|
/**
|
|
|
|
* Enables/disables the toolbox.
|
|
|
|
*
|
|
|
|
* @param {boolean} enabled - True to enable the toolbox or false to disable it.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_TOOLBOX_ENABLED,
|
|
|
|
* enabled: boolean
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setToolboxEnabled(enabled: boolean): Object {
|
|
|
|
return {
|
|
|
|
type: SET_TOOLBOX_ENABLED,
|
|
|
|
enabled
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-02-16 23:02:40 +00:00
|
|
|
/**
|
|
|
|
* Dispatches an action which sets new timeout and clears the previous one.
|
|
|
|
*
|
|
|
|
* @param {Function} handler - Function to be invoked after the timeout.
|
2017-04-01 05:52:40 +00:00
|
|
|
* @param {number} timeoutMS - Delay.
|
2017-02-16 23:02:40 +00:00
|
|
|
* @returns {{
|
2017-04-01 05:52:40 +00:00
|
|
|
* type: SET_TOOLBOX_TIMEOUT,
|
|
|
|
* handler: Function,
|
|
|
|
* timeoutMS: number
|
2017-02-16 23:02:40 +00:00
|
|
|
* }}
|
|
|
|
*/
|
2017-04-01 05:52:40 +00:00
|
|
|
export function setToolboxTimeout(handler: Function, timeoutMS: number)
|
|
|
|
: Object {
|
2017-02-16 23:02:40 +00:00
|
|
|
return {
|
2017-04-01 05:52:40 +00:00
|
|
|
type: SET_TOOLBOX_TIMEOUT,
|
2017-02-16 23:02:40 +00:00
|
|
|
handler,
|
2017-04-01 05:52:40 +00:00
|
|
|
timeoutMS
|
2017-02-16 23:02:40 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-04-01 05:52:40 +00:00
|
|
|
/* eslint-enable flowtype/space-before-type-colon */
|
|
|
|
|
2017-02-16 23:02:40 +00:00
|
|
|
/**
|
2017-04-01 05:52:40 +00:00
|
|
|
* Dispatches an action which sets new toolbox timeout value.
|
2017-02-16 23:02:40 +00:00
|
|
|
*
|
2017-04-01 05:52:40 +00:00
|
|
|
* @param {number} timeoutMS - Delay.
|
2017-02-16 23:02:40 +00:00
|
|
|
* @returns {{
|
2017-04-01 05:52:40 +00:00
|
|
|
* type: SET_TOOLBOX_TIMEOUT_MS,
|
|
|
|
* timeoutMS: number
|
2017-02-16 23:02:40 +00:00
|
|
|
* }}
|
|
|
|
*/
|
2017-04-01 05:52:40 +00:00
|
|
|
export function setToolboxTimeoutMS(timeoutMS: number): Object {
|
2017-02-16 23:02:40 +00:00
|
|
|
return {
|
2017-04-01 05:52:40 +00:00
|
|
|
type: SET_TOOLBOX_TIMEOUT_MS,
|
|
|
|
timeoutMS
|
2017-02-16 23:02:40 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-01 05:52:40 +00:00
|
|
|
* Shows/hides the toolbox.
|
2017-02-16 23:02:40 +00:00
|
|
|
*
|
2017-04-01 05:52:40 +00:00
|
|
|
* @param {boolean} visible - True to show the toolbox or false to hide it.
|
2017-02-16 23:02:40 +00:00
|
|
|
* @returns {{
|
2017-04-01 05:52:40 +00:00
|
|
|
* type: SET_TOOLBOX_VISIBLE,
|
2017-02-16 23:02:40 +00:00
|
|
|
* visible: boolean
|
|
|
|
* }}
|
|
|
|
*/
|
2017-04-01 05:52:40 +00:00
|
|
|
export function setToolboxVisible(visible: boolean): Object {
|
2017-02-16 23:02:40 +00:00
|
|
|
return {
|
2017-04-01 05:52:40 +00:00
|
|
|
type: SET_TOOLBOX_VISIBLE,
|
2017-02-16 23:02:40 +00:00
|
|
|
visible
|
|
|
|
};
|
|
|
|
}
|
2019-06-19 12:44:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Action to toggle the toolbox visibility.
|
|
|
|
*
|
|
|
|
* @returns {{
|
|
|
|
* type: TOGGLE_TOOLBOX_VISIBLE
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function toggleToolboxVisible() {
|
|
|
|
return {
|
|
|
|
type: TOGGLE_TOOLBOX_VISIBLE
|
|
|
|
};
|
|
|
|
}
|